summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-28 00:37:02 +0100
committerIngo Molnar <mingo@elte.hu>2009-12-28 09:03:34 +0100
commitd549c7690190d9739005e19604faad6da4b802ac (patch)
tree1a03376ecc41ecd9495298ed3ad34f72da7ecea0 /tools/perf/util/session.c
parentperf session: Share the common trace sample_check routine as perf_session__ha... (diff)
downloadlinux-d549c7690190d9739005e19604faad6da4b802ac.tar.xz
linux-d549c7690190d9739005e19604faad6da4b802ac.zip
perf session: Remove sample_type_check from event_ops
This is really something tools need to do before asking for the events to be processed, leaving perf_session__process_events to do just that, process events. Also add a msg parameter to perf_session__has_traces() so that the right message can be printed, fixing a regression added by me in the previous cset (right timechart message) and also fixing 'perf kmem', that was not asking if 'perf kmem record' was ran. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1261957026-15580-6-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 60eab8b3ff34..bc84a5217955 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -73,6 +73,8 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
if (mode == O_RDONLY && perf_session__open(self, force) < 0)
goto out_delete;
+
+ self->sample_type = perf_header__sample_type(&self->header);
out:
return self;
out_free:
@@ -302,11 +304,6 @@ int perf_session__process_events(struct perf_session *self,
page_size = getpagesize();
head = self->header.data_offset;
- self->sample_type = perf_header__sample_type(&self->header);
-
- err = -EINVAL;
- if (ops->sample_type_check && ops->sample_type_check(self) < 0)
- goto out_err;
if (!ops->full_paths) {
char bf[PATH_MAX];
@@ -394,13 +391,12 @@ out_err:
return err;
}
-int perf_session__has_traces(struct perf_session *self)
+bool perf_session__has_traces(struct perf_session *self, const char *msg)
{
if (!(self->sample_type & PERF_SAMPLE_RAW)) {
- pr_err("No trace sample to read. Did you call perf record "
- "without -R?");
- return -1;
+ pr_err("No trace sample to read. Did you call 'perf %s'?\n", msg);
+ return false;
}
- return 0;
+ return true;
}