diff options
author | 2016-03-07 16:44:41 -0300 | |
---|---|---|
committer | 2016-03-08 10:11:17 +0100 | |
commit | 4a018cc47932ef1e68a0600ce3ac100df70fab2a (patch) | |
tree | 008fc6a2459816a7ceca4e8b7b4732be3751a22a /tools/perf/util/jitdump.c | |
parent | perf jit: Let jit_process() return errors (diff) | |
download | linux-4a018cc47932ef1e68a0600ce3ac100df70fab2a.tar.gz linux-4a018cc47932ef1e68a0600ce3ac100df70fab2a.tar.bz2 linux-4a018cc47932ef1e68a0600ce3ac100df70fab2a.zip |
perf jit: Move clockid validation
Move clockid validation into jit_process() so it can later be made
conditional.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1457005856-6143-6-git-send-email-adrian.hunter@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/jitdump.c')
-rw-r--r-- | tools/perf/util/jitdump.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index bd9e44f9fff2..cd272cc21e05 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -99,6 +99,21 @@ jit_close(struct jit_buf_desc *jd) } static int +jit_validate_events(struct perf_session *session) +{ + struct perf_evsel *evsel; + + /* + * check that all events use CLOCK_MONOTONIC + */ + evlist__for_each(session->evlist, evsel) { + if (evsel->attr.use_clockid == 0 || evsel->attr.clockid != CLOCK_MONOTONIC) + return -1; + } + return 0; +} + +static int jit_open(struct jit_buf_desc *jd, const char *name) { struct jitheader header; @@ -157,6 +172,14 @@ jit_open(struct jit_buf_desc *jd, const char *name) goto error; } + /* + * validate event is using the correct clockid + */ + if (jit_validate_events(jd->session)) { + pr_err("error, jitted code must be sampled with perf record -k 1\n"); + goto error; + } + bs = header.total_size - sizeof(header); if (bs > bsz) { |