mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 07:22:34 +00:00
This covers two different use cases. The first one is cgroup
filtering given by -G/--cgroup option which controls the off-cpu
profiling for tasks in the given cgroups only.
The other use case is cgroup sampling which is enabled by
--all-cgroups option and it adds PERF_SAMPLE_CGROUP to the sample_type
to set the cgroup id of the task in the sample data.
Example output.
$ sudo perf record -a --off-cpu --all-cgroups sleep 1
$ sudo perf report --stdio -s comm,cgroup --call-graph=no
...
# Samples: 144 of event 'offcpu-time'
# Event count (approx.): 48452045427
#
# Children Self Command Cgroup
# ........ ........ ............... ..........................................
#
61.57% 5.60% Chrome_ChildIOT /user.slice/user-657345.slice/[email protected]/app.slice/...
29.51% 7.38% Web Content /user.slice/user-657345.slice/[email protected]/app.slice/...
17.48% 1.59% Chrome_IOThread /user.slice/user-657345.slice/[email protected]/app.slice/...
16.48% 4.12% pipewire-pulse /user.slice/user-657345.slice/[email protected]/session.slice/...
14.48% 2.07% perf /user.slice/user-657345.slice/[email protected]/app.slice/...
14.30% 7.15% CompositorTileW /user.slice/user-657345.slice/[email protected]/app.slice/...
13.33% 6.67% Timer /user.slice/user-657345.slice/[email protected]/app.slice/...
...
Signed-off-by: Namhyung Kim <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Acked-by: Ian Rogers <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Blake Jones <[email protected]>
Cc: Hao Luo <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Milian Wolff <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Song Liu <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
30 lines
656 B
C
30 lines
656 B
C
#ifndef PERF_UTIL_OFF_CPU_H
|
|
#define PERF_UTIL_OFF_CPU_H
|
|
|
|
struct evlist;
|
|
struct target;
|
|
struct perf_session;
|
|
struct record_opts;
|
|
|
|
#define OFFCPU_EVENT "offcpu-time"
|
|
|
|
#ifdef HAVE_BPF_SKEL
|
|
int off_cpu_prepare(struct evlist *evlist, struct target *target,
|
|
struct record_opts *opts);
|
|
int off_cpu_write(struct perf_session *session);
|
|
#else
|
|
static inline int off_cpu_prepare(struct evlist *evlist __maybe_unused,
|
|
struct target *target __maybe_unused,
|
|
struct record_opts *opts __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
static inline int off_cpu_write(struct perf_session *session __maybe_unused)
|
|
{
|
|
return -1;
|
|
}
|
|
#endif
|
|
|
|
#endif /* PERF_UTIL_OFF_CPU_H */
|