diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-10-02 13:58:12 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-10-02 13:58:12 -0300 |
commit | c976a7d6db215481261b63a89a408cb265a9812b (patch) | |
tree | 57a61a7149d34f83493453391ca8e01f85244aef /tools/perf/util/evsel.c | |
parent | a47ba4d77e1236d214e5116b5631bc4c2d6e6369 (diff) | |
parent | 1addcd55bc54d669000221b41e379458ff3e6747 (diff) | |
download | linux-c976a7d6db215481261b63a89a408cb265a9812b.tar.gz linux-c976a7d6db215481261b63a89a408cb265a9812b.tar.bz2 linux-c976a7d6db215481261b63a89a408cb265a9812b.zip |
Merge remote-tracking branch 'tip/perf/urgent' into perf/core, to pick up fixes
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r-- | tools/perf/util/evsel.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 7389746c0dc4..f894893c203d 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -271,12 +271,17 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) return evsel; } +static bool perf_event_can_profile_kernel(void) +{ + return geteuid() == 0 || perf_event_paranoid() == -1; +} + struct perf_evsel *perf_evsel__new_cycles(bool precise) { struct perf_event_attr attr = { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES, - .exclude_kernel = geteuid() != 0, + .exclude_kernel = !perf_event_can_profile_kernel(), }; struct perf_evsel *evsel; |