diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-08-17 11:50:48 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-08-17 11:50:48 +0300 |
commit | 2257e268b1154966c5b0141b23695db1043ff39d (patch) | |
tree | dae4b032afb9872568cf7921b39d30c79a6c3fee /tools/perf/util/evsel.c | |
parent | 27aac20574110abfd594175a668dc58b23b2b14a (diff) | |
parent | ac9a40905a610fb02086a37b11ff4bf046825a88 (diff) | |
download | linux-2257e268b1154966c5b0141b23695db1043ff39d.tar.xz |
Merge branch 'linus' into x86/boot, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r-- | tools/perf/util/evsel.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 87b431886670..413f74df08de 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -273,7 +273,7 @@ struct perf_evsel *perf_evsel__new_cycles(void) struct perf_event_attr attr = { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES, - .exclude_kernel = 1, + .exclude_kernel = geteuid() != 0, }; struct perf_evsel *evsel; @@ -298,8 +298,10 @@ struct perf_evsel *perf_evsel__new_cycles(void) goto out; /* use asprintf() because free(evsel) assumes name is allocated */ - if (asprintf(&evsel->name, "cycles%.*s", - attr.precise_ip ? attr.precise_ip + 1 : 0, ":ppp") < 0) + if (asprintf(&evsel->name, "cycles%s%s%.*s", + (attr.precise_ip || attr.exclude_kernel) ? ":" : "", + attr.exclude_kernel ? "u" : "", + attr.precise_ip ? attr.precise_ip + 1 : 0, "ppp") < 0) goto error_free; out: return evsel; |