diff options
author | Namhyung Kim <namhyung@kernel.org> | 2022-08-11 11:54:53 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-08-11 17:56:47 -0300 |
commit | 07fc958b0cfcd8e44f0de13625a551dd16b97eb4 (patch) | |
tree | 901859b4c59030cefdb7ecf1cc33604676243aad /tools/perf/util/bpf_off_cpu.c | |
parent | 806731a9465b42aaf887cbaf8bfee7eccc9417de (diff) | |
download | linux-07fc958b0cfcd8e44f0de13625a551dd16b97eb4.tar.bz2 |
perf offcpu: Check process id for the given workload
Current task filter checks task->pid which is different for each
thread. But we want to profile all the threads in the process. So
let's compare process id (or thread-group id: tgid) instead.
Before:
$ sudo perf record --off-cpu -- perf bench sched messaging -t
$ sudo perf report --stat | grep -A1 offcpu
offcpu-time stats:
SAMPLE events: 2
After:
$ sudo perf record --off-cpu -- perf bench sched messaging -t
$ sudo perf report --stat | grep -A1 offcpu
offcpu-time stats:
SAMPLE events: 850
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Blake Jones <blakejones@google.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20220811185456.194721-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/bpf_off_cpu.c')
-rw-r--r-- | tools/perf/util/bpf_off_cpu.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/bpf_off_cpu.c b/tools/perf/util/bpf_off_cpu.c index f289b7713598..7dbcb025da87 100644 --- a/tools/perf/util/bpf_off_cpu.c +++ b/tools/perf/util/bpf_off_cpu.c @@ -78,6 +78,7 @@ static void off_cpu_start(void *arg) u8 val = 1; skel->bss->has_task = 1; + skel->bss->uses_tgid = 1; fd = bpf_map__fd(skel->maps.task_filter); pid = perf_thread_map__pid(evlist->core.threads, 0); bpf_map_update_elem(fd, &pid, &val, BPF_ANY); |