perf bpf-filter: Support filtering on cgroups
authorNamhyung Kim <namhyung@kernel.org>
Mon, 26 Aug 2024 22:10:44 +0000 (15:10 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 28 Aug 2024 21:21:49 +0000 (18:21 -0300)
commit91e88437d5156b209b1d69b69b560f0a02b80712
treeb0c644eabb842e985ed4cc7a4235e2591036876e
parent591156f25f6bc71b143d4a7c7cbe7cdb68dda94e
perf bpf-filter: Support filtering on cgroups

The new cgroup filter can take either of '==' or '!=' operator and a
pathname for the target cgroup.

  $ perf record -a --all-cgroups -e cycles --filter 'cgroup == /abc/def' -- sleep 1

Users should have --all-cgroups option in the command line to enable
cgroup filtering.  Technically it doesn't need to have the option as
it can get the current task's cgroup info directly from BPF.  But I want
to follow the convention for the other sample info.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20240826221045.1202305-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/bpf-filter.c
tools/perf/util/bpf-filter.l
tools/perf/util/bpf-filter.y
tools/perf/util/bpf_skel/sample-filter.h
tools/perf/util/bpf_skel/sample_filter.bpf.c
tools/perf/util/bpf_skel/vmlinux/vmlinux.h