summaryrefslogtreecommitdiff
path: root/tools/perf/util/perf_api_probe.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2021-05-27 21:28:35 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-06-01 16:32:00 +0300
commit4f2abe91922ba02bb419d91d92a518e4c805220b (patch)
tree72e49fef16a0ccbadc202ddbf60236dbd2059647 /tools/perf/util/perf_api_probe.c
parent3cb17cce1e76ccc5499915a4d7e095a1ad6bf7ff (diff)
downloadlinux-4f2abe91922ba02bb419d91d92a518e4c805220b.tar.xz
perf record: Move probing cgroup sampling support
I found that checking cgroup sampling support using the missing features doesn't work on old kernels. Because it added both attr.cgroup bit and PERF_SAMPLE_CGROUP bit, it needs to check whichever comes first (usually the actual event, not dummy). But it only checks the attr.cgroup bit which is set only in the dummy event so cannot detect failtures due the sample bits. Also we don't ignore the missing feature and retry, it'd be better checking it with the API probing logic. Committer notes: Extracted the minimal part to check using the new cgroup API probe routine, the part that removes the cgroup member can be left for further discussion. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210527182835.1634339-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/perf_api_probe.c')
-rw-r--r--tools/perf/util/perf_api_probe.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/perf_api_probe.c b/tools/perf/util/perf_api_probe.c
index 829af17a0867..020411682a3c 100644
--- a/tools/perf/util/perf_api_probe.c
+++ b/tools/perf/util/perf_api_probe.c
@@ -103,6 +103,11 @@ static void perf_probe_build_id(struct evsel *evsel)
evsel->core.attr.build_id = 1;
}
+static void perf_probe_cgroup(struct evsel *evsel)
+{
+ evsel->core.attr.cgroup = 1;
+}
+
bool perf_can_sample_identifier(void)
{
return perf_probe_api(perf_probe_sample_identifier);
@@ -182,3 +187,8 @@ bool perf_can_record_build_id(void)
{
return perf_probe_api(perf_probe_build_id);
}
+
+bool perf_can_record_cgroup(void)
+{
+ return perf_probe_api(perf_probe_cgroup);
+}