The -l/--lock-addr option is to implement per-lock-instance contention stat using LOCK_AGGR_ADDR. It displays lock address and optionally symbol name if exists. $ sudo ./perf lock con -abl sleep 1 contended total wait max wait avg wait address symbol 1 36.28 us 36.28 us 36.28 us ffff92615d6448b8 9 10.91 us 1.84 us 1.21 us ffffffffbaed50c0 rcu_state 1 10.49 us 10.49 us 10.49 us ffff9262ac4f0c80 8 4.68 us 1.67 us 585 ns ffffffffbae07a40 jiffies_lock 3 3.03 us 1.45 us 1.01 us ffff9262277861e0 1 924 ns 924 ns 924 ns ffff926095ba9d20 1 436 ns 436 ns 436 ns ffff9260bfda4f60 Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Blake Jones <blakejones@google.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20221209190727.759804-4-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
30 lines
574 B
C
30 lines
574 B
C
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
|
/* Data structures shared between BPF and tools. */
|
|
#ifndef UTIL_BPF_SKEL_LOCK_DATA_H
|
|
#define UTIL_BPF_SKEL_LOCK_DATA_H
|
|
|
|
struct contention_key {
|
|
u64 aggr_key; /* can be stack_id, pid or lock addr */
|
|
};
|
|
|
|
#define TASK_COMM_LEN 16
|
|
|
|
struct contention_task_data {
|
|
char comm[TASK_COMM_LEN];
|
|
};
|
|
|
|
struct contention_data {
|
|
u64 total_time;
|
|
u64 min_time;
|
|
u64 max_time;
|
|
u32 count;
|
|
u32 flags;
|
|
};
|
|
|
|
enum lock_aggr_mode {
|
|
LOCK_AGGR_ADDR = 0,
|
|
LOCK_AGGR_TASK,
|
|
LOCK_AGGR_CALLER,
|
|
};
|
|
|
|
#endif /* UTIL_BPF_SKEL_LOCK_DATA_H */
|