[PATCH 0/4] perf lock contention: Support task/addr aggregation mode (v1)

From: Namhyung Kim
Date: Fri Dec 09 2022 - 14:07:39 EST


Hello,

This patchset adds two more aggregation modes for perf lock contention.

The first one is the per-task mode with -t/--threads option. The option
was there already but it remained broken with BPF for a while. Now it
supports the output with and without BPF.

# perf lock contention -a -b -t -- sleep 1
contended total wait max wait avg wait pid comm

11 11.85 us 2.23 us 1.08 us 0 swapper
2 11.13 us 10.22 us 5.56 us 749053 ThreadPoolForeg
1 8.15 us 8.15 us 8.15 us 321353 Chrome_ChildIOT
2 2.73 us 1.77 us 1.37 us 320761 Chrome_ChildIOT
1 1.40 us 1.40 us 1.40 us 320502 chrome
1 379 ns 379 ns 379 ns 321227 chrome

The other one is the per-lock-instance mode with -l/--lock-addr option.
If the lock has a symbol, it will be displayed as well.

# perf lock contention -a -b -l -- sleep 1
contended total wait max wait avg wait address symbol

3 4.79 us 2.33 us 1.60 us ffffffffbaed50c0 rcu_state
4 4.19 us 1.62 us 1.05 us ffffffffbae07a40 jiffies_lock
1 1.94 us 1.94 us 1.94 us ffff9262277861e0
1 387 ns 387 ns 387 ns ffff9260bfda4f60

It's based on the current acme/tmp.perf/core branch.
You can find the code in the 'perf/lock-con-aggr-v1' branch in

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Thanks,
Namhyung


Namhyung Kim (4):
perf lock contention: Add lock_data.h for common data
perf lock contention: Implement -t/--threads option for BPF
perf lock contention: Add -l/--lock-addr option
perf test: Update perf lock contention test

tools/perf/Documentation/perf-lock.txt | 4 +
tools/perf/builtin-lock.c | 95 ++++++++++++++-----
tools/perf/tests/shell/lock_contention.sh | 48 ++++++++++
tools/perf/util/bpf_lock_contention.c | 72 ++++++++++----
.../perf/util/bpf_skel/lock_contention.bpf.c | 67 +++++++++----
tools/perf/util/bpf_skel/lock_data.h | 30 ++++++
tools/perf/util/lock-contention.h | 1 +
7 files changed, 255 insertions(+), 62 deletions(-)
create mode 100644 tools/perf/util/bpf_skel/lock_data.h


base-commit: b22802e295a80ec16e355d7208d2fbbd7bbc1b7a
--
2.39.0.rc1.256.g54fd8350bd-goog