Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182319
b: refs/heads/master
c: 2729559
h: refs/heads/master
i:
  182317: 58f6481
  182315: 6bb5099
  182311: b75180e
  182303: db7f0c7
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Dec 28, 2009
1 parent c38bddb commit 06c1854
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 52 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a58e61161074776aa34187ea369414ce4852394
refs/heads/master: 27295592c22e71bbd38110c302da8dbb43912a60
14 changes: 1 addition & 13 deletions trunk/tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,22 +342,10 @@ static int process_sample_event(event_t *event, struct perf_session *session)
return 0;
}

static int sample_type_check(struct perf_session *session)
{
if (!(session->sample_type & PERF_SAMPLE_RAW)) {
fprintf(stderr,
"No trace sample to read. Did you call perf record "
"without -R?");
return -1;
}

return 0;
}

static struct perf_event_ops event_ops = {
.process_sample_event = process_sample_event,
.process_comm_event = event__process_comm,
.sample_type_check = sample_type_check,
.sample_type_check = perf_session__has_traces,
};

static double fragmentation(unsigned long n_req, unsigned long n_alloc)
Expand Down
14 changes: 1 addition & 13 deletions trunk/tools/perf/builtin-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1653,23 +1653,11 @@ static int process_lost_event(event_t *event __used,
return 0;
}

static int sample_type_check(struct perf_session *session __used)
{
if (!(session->sample_type & PERF_SAMPLE_RAW)) {
fprintf(stderr,
"No trace sample to read. Did you call perf record "
"without -R?");
return -1;
}

return 0;
}

static struct perf_event_ops event_ops = {
.process_sample_event = process_sample_event,
.process_comm_event = event__process_comm,
.process_lost_event = process_lost_event,
.sample_type_check = sample_type_check,
.sample_type_check = perf_session__has_traces,
};

static int read_events(void)
Expand Down
13 changes: 1 addition & 12 deletions trunk/tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,23 +1029,12 @@ static void process_samples(struct perf_session *session)
}
}

static int sample_type_check(struct perf_session *session)
{
if (!(session->sample_type & PERF_SAMPLE_RAW)) {
fprintf(stderr, "No trace samples found in the file.\n"
"Have you used 'perf timechart record' to record it?\n");
return -1;
}

return 0;
}

static struct perf_event_ops event_ops = {
.process_comm_event = process_comm_event,
.process_fork_event = process_fork_event,
.process_exit_event = process_exit_event,
.process_sample_event = queue_sample_event,
.sample_type_check = sample_type_check,
.sample_type_check = perf_session__has_traces,
};

static int __cmd_timechart(void)
Expand Down
14 changes: 1 addition & 13 deletions trunk/tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,10 @@ static int process_sample_event(event_t *event, struct perf_session *session)
return 0;
}

static int sample_type_check(struct perf_session *session)
{
if (!(session->sample_type & PERF_SAMPLE_RAW)) {
fprintf(stderr,
"No trace sample to read. Did you call perf record "
"without -R?");
return -1;
}

return 0;
}

static struct perf_event_ops event_ops = {
.process_sample_event = process_sample_event,
.process_comm_event = event__process_comm,
.sample_type_check = sample_type_check,
.sample_type_check = perf_session__has_traces,
};

static int __cmd_trace(struct perf_session *session)
Expand Down
11 changes: 11 additions & 0 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,14 @@ int perf_session__process_events(struct perf_session *self,
out_err:
return err;
}

int perf_session__has_traces(struct perf_session *self)
{
if (!(self->sample_type & PERF_SAMPLE_RAW)) {
pr_err("No trace sample to read. Did you call perf record "
"without -R?");
return -1;
}

return 0;
}
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ struct symbol **perf_session__resolve_callchain(struct perf_session *self,
struct ip_callchain *chain,
struct symbol **parent);

int perf_session__has_traces(struct perf_session *self);

int perf_header__read_build_ids(int input, u64 offset, u64 file_size);

#endif /* __PERF_SESSION_H */

0 comments on commit 06c1854

Please sign in to comment.