linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v4 0/2] perf stat: Support inherit events for bperf
@ 2024-10-12  2:32 Tengda Wu
  2024-10-12  2:32 ` [PATCH -next v4 1/2] perf stat: Support inherit events during fork() " Tengda Wu
  2024-10-12  2:32 ` [PATCH -next v4 2/2] perf test: Use sqrtloop workload to test bperf event Tengda Wu
  0 siblings, 2 replies; 8+ messages in thread
From: Tengda Wu @ 2024-10-12  2:32 UTC (permalink / raw)
  To: Peter Zijlstra, song, Namhyung Kim
  Cc: Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	kan.liang, linux-perf-users, linux-kernel, bpf

Hi,

Here is the 4th version of the series to support inherit events for bperf.
This version adds an `inherit` flag to bperf to control inherit behavior.
Considering future scalability, wrap the `inherit` flag with a new struct
`bpf_stat_opts` before passing it to bpf_counter__load().


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:
---------
v4: (Address comments from Song and Namhyung, thanks)
 * Add an `inherit` flag to bperf to control inherit behavior

v3: https://lore.kernel.org/all/20240916014318.267709-1-wutengda@huaweicloud.com/
 * Use pid or tgid based on filter type in new_task prog
 * Add comments to explain pid usage for TGID type in exit_task prog

v2: https://lore.kernel.org/all/20240905115918.772234-1-wutengda@huaweicloud.com/
 * 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@huaweicloud.com/


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

 tools/perf/builtin-stat.c                     |  4 +-
 tools/perf/tests/shell/stat_bpf_counters.sh   |  2 +-
 tools/perf/util/bpf_counter.c                 | 57 +++++++++---
 tools/perf/util/bpf_counter.h                 | 13 ++-
 tools/perf/util/bpf_counter_cgroup.c          |  3 +-
 tools/perf/util/bpf_skel/bperf_follower.bpf.c | 87 +++++++++++++++++--
 tools/perf/util/bpf_skel/bperf_u.h            |  5 ++
 7 files changed, 146 insertions(+), 25 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-19 16:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-12  2:32 [PATCH -next v4 0/2] perf stat: Support inherit events for bperf Tengda Wu
2024-10-12  2:32 ` [PATCH -next v4 1/2] perf stat: Support inherit events during fork() " Tengda Wu
2024-10-16 21:16   ` Namhyung Kim
2024-10-17  2:53     ` Tengda Wu
2024-10-18 17:12       ` Namhyung Kim
2024-10-19  8:27         ` Tengda Wu
2024-10-19 16:28           ` Namhyung Kim
2024-10-12  2:32 ` [PATCH -next v4 2/2] perf test: Use sqrtloop workload to test bperf event Tengda Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).