[PATCH -next v2 0/2] perf stat: Support inherit events for bperf

From: Tengda Wu
Date: Thu Sep 05 2024 - 08:10:49 EST


Hi,

bperf (perf-stat --bpf-counter) has not supported inherit events
during fork() since it was first introduced.

This patch series tries to add this support by:
1) adding two new bpf programs to monitor task lifecycle;
2) recording new tasks in the filter map dynamically;
3) reusing `accum_key` of parent task for new tasks.

Thanks,
Tengda


Changelog:
---------
v2: (Address comments from Namhyung)
* Remove the unused init_filter_entries in follower bpf, declare
a global filter_entry_count in bpf_counter instead
* Attach on_newtask and on_exittask progs only if the filter type
is either PID or TGID

v1: https://lore.kernel.org/all/20240904123103.732507-1-wutengda@xxxxxxxxxxxxxxx/


Tengda Wu (2):
perf stat: Support inherit events during fork() for bperf
perf test: Use sqrtloop workload to test bperf event

tools/perf/tests/shell/stat_bpf_counters.sh | 2 +-
tools/perf/util/bpf_counter.c | 32 +++++++--
tools/perf/util/bpf_skel/bperf_follower.bpf.c | 70 +++++++++++++++++--
tools/perf/util/bpf_skel/bperf_u.h | 5 ++
4 files changed, 95 insertions(+), 14 deletions(-)

--
2.34.1