diff options
author | Namhyung Kim <namhyung@kernel.org> | 2023-04-06 14:06:08 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-06 21:52:31 -0300 |
commit | 954cdac74e1e7aca518c8ef49d4fa70c8ae72d7b (patch) | |
tree | 6b1459c1622e59f81648910fe3cfe537cae0a47d /tools/perf/util/bpf_skel/lock_contention.bpf.c | |
parent | 2d8d016527928ad65ad1fe11c9943d8b81f05d18 (diff) |
perf lock contention: Add data failure stat
It's possible to fail to update the data when the lock_stat map is full.
We should check that case and show the number at the end.
$ sudo ./perf lock con -ablv -E3 -- ./perf bench sched messaging
...
contended total wait max wait avg wait address symbol
6157 208.48 ms 69.29 us 33.86 us ffff934c001c1f00 (spinlock)
4030 72.04 ms 61.84 us 17.88 us ffff934c000415c0 (spinlock)
3201 50.30 ms 47.73 us 15.71 us ffff934c2eead850 (spinlock)
=== output for debug ===
bad: 0, total: 13388
bad rate: 0.00 %
histogram of failure reasons
task: 0
stack: 0
time: 0
data: 0 <----- added
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230406210611.1622492-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/bpf_skel/lock_contention.bpf.c')
-rw-r--r-- | tools/perf/util/bpf_skel/lock_contention.bpf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/util/bpf_skel/lock_contention.bpf.c b/tools/perf/util/bpf_skel/lock_contention.bpf.c index f9d2d792ccc8..cb87c98e5340 100644 --- a/tools/perf/util/bpf_skel/lock_contention.bpf.c +++ b/tools/perf/util/bpf_skel/lock_contention.bpf.c @@ -124,6 +124,7 @@ int aggr_mode; int task_fail; int stack_fail; int time_fail; +int data_fail; static inline int can_record(u64 *ctx) { @@ -380,7 +381,8 @@ int contention_end(u64 *ctx) if (aggr_mode == LOCK_AGGR_ADDR) first.flags |= check_lock_type(pelem->lock, pelem->flags); - bpf_map_update_elem(&lock_stat, &key, &first, BPF_NOEXIST); + if (bpf_map_update_elem(&lock_stat, &key, &first, BPF_NOEXIST) < 0) + __sync_fetch_and_add(&data_fail, 1); bpf_map_delete_elem(&tstamp, &pid); return 0; } |