mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Add a new summary mode to collect stats for each cgroup. $ sudo ./perf trace -as --bpf-summary --summary-mode=cgroup -- sleep 1 Summary of events: cgroup /user.slice/user-657345.slice/user@657345.service/session.slice/org.gnome.Shell@x11.service, 535 events syscall calls errors total min avg max stddev (msec) (msec) (msec) (msec) (%) --------------- -------- ------ -------- --------- --------- --------- ------ ppoll 15 0 373.600 0.004 24.907 197.491 55.26% poll 15 0 1.325 0.001 0.088 0.369 38.76% close 66 0 0.567 0.007 0.009 0.026 3.55% write 150 0 0.471 0.001 0.003 0.010 3.29% recvmsg 94 83 0.290 0.000 0.003 0.037 16.39% ioctl 26 0 0.237 0.001 0.009 0.096 50.13% timerfd_create 66 0 0.236 0.003 0.004 0.024 8.92% timerfd_settime 70 0 0.160 0.001 0.002 0.012 7.66% writev 10 0 0.118 0.001 0.012 0.019 18.17% read 9 0 0.021 0.001 0.002 0.004 14.07% getpid 14 0 0.019 0.000 0.001 0.004 20.28% cgroup /system.slice/polkit.service, 94 events syscall calls errors total min avg max stddev (msec) (msec) (msec) (msec) (%) --------------- -------- ------ -------- --------- --------- --------- ------ ppoll 22 0 19.811 0.000 0.900 9.273 63.88% write 30 0 0.040 0.001 0.001 0.003 12.09% recvmsg 12 0 0.018 0.001 0.002 0.006 28.15% read 18 0 0.013 0.000 0.001 0.003 21.99% poll 12 0 0.006 0.000 0.001 0.001 4.48% cgroup /user.slice/user-657345.slice/user@657345.service/app.slice/app-org.gnome.Terminal.slice/gnome-terminal-server.service, 21 events syscall calls errors total min avg max stddev (msec) (msec) (msec) (msec) (%) --------------- -------- ------ -------- --------- --------- --------- ------ ppoll 4 0 17.476 0.003 4.369 13.298 69.65% recvmsg 15 12 0.068 0.002 0.005 0.014 26.53% writev 1 0 0.033 0.033 0.033 0.033 0.00% poll 1 0 0.005 0.005 0.005 0.005 0.00% ... It works only for --bpf-summary for now. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Howard Chu <howardchu95@gmail.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: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20250501225337.928470-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
38 lines
887 B
C
38 lines
887 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef UTIL_TRACE_H
|
|
#define UTIL_TRACE_H
|
|
|
|
#include <stdio.h> /* for FILE */
|
|
|
|
enum trace_summary_mode {
|
|
SUMMARY__NONE = 0,
|
|
SUMMARY__BY_TOTAL,
|
|
SUMMARY__BY_THREAD,
|
|
SUMMARY__BY_CGROUP,
|
|
};
|
|
|
|
#ifdef HAVE_BPF_SKEL
|
|
|
|
int trace_prepare_bpf_summary(enum trace_summary_mode mode);
|
|
void trace_start_bpf_summary(void);
|
|
void trace_end_bpf_summary(void);
|
|
int trace_print_bpf_summary(FILE *fp);
|
|
void trace_cleanup_bpf_summary(void);
|
|
|
|
#else /* !HAVE_BPF_SKEL */
|
|
|
|
static inline int trace_prepare_bpf_summary(enum trace_summary_mode mode __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
static inline void trace_start_bpf_summary(void) {}
|
|
static inline void trace_end_bpf_summary(void) {}
|
|
static inline int trace_print_bpf_summary(FILE *fp __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void trace_cleanup_bpf_summary(void) {}
|
|
|
|
#endif /* HAVE_BPF_SKEL */
|
|
|
|
#endif /* UTIL_TRACE_H */
|