summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evsel.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2017-10-02 13:58:12 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-10-02 13:58:12 -0300
commitc976a7d6db215481261b63a89a408cb265a9812b (patch)
tree57a61a7149d34f83493453391ca8e01f85244aef /tools/perf/util/evsel.c
parenta47ba4d77e1236d214e5116b5631bc4c2d6e6369 (diff)
parent1addcd55bc54d669000221b41e379458ff3e6747 (diff)
downloadlinux-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.c7
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;