]> git.baikalelectronics.ru Git - kernel.git/commit
perf stat: Enable BPF counter with --for-each-cgroup
authorNamhyung Kim <namhyung@kernel.org>
Thu, 1 Jul 2021 21:12:27 +0000 (14:12 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 5 Jul 2021 17:16:57 +0000 (14:16 -0300)
commitb9cbed26c53e59c1938b6f2fbd4635cac2de0420
treec11bd7514b0816654dc15e63c7162e52a820a694
parent6efc9b90018888bc6649703a3a2ea4c5bfd3c7a2
perf stat: Enable BPF counter with --for-each-cgroup

Recently bperf was added to use BPF to count perf events for various
purposes.  This is an extension for the approach and targetting to
cgroup usages.

Unlike the other bperf, it doesn't share the events with other
processes but it'd reduce unnecessary events (and the overhead of
multiplexing) for each monitored cgroup within the perf session.

When --for-each-cgroup is used with --bpf-counters, it will open
cgroup-switches event per cpu internally and attach the new BPF
program to read given perf_events and to aggregate the results for
cgroups.  It's only called when task is switched to a task in a
different cgroup.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20210701211227.1403788-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Makefile.perf
tools/perf/util/Build
tools/perf/util/bpf_counter.c
tools/perf/util/bpf_counter_cgroup.c [new file with mode: 0644]
tools/perf/util/bpf_skel/bperf_cgroup.bpf.c [new file with mode: 0644]
tools/perf/util/cgroup.c
tools/perf/util/cgroup.h