diff options
author | Namhyung Kim <namhyung@kernel.org> | 2022-08-02 12:10:04 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-08-02 18:03:31 -0300 |
commit | 6d499a6b3d90277dbb7e408e7c70d68b507ef383 (patch) | |
tree | c7b31abbff7da55a7a83e42f7f149377f17ba46c /tools/perf/builtin-lock.c | |
parent | ceb13bfc01d55388092c00796a5b76aa3dfa483a (diff) | |
download | linux-6d499a6b3d90277dbb7e408e7c70d68b507ef383.tar.gz |
perf lock: Print the number of lost entries for BPF
Like the normal 'perf lock contention' output, it'd print the number of
lost entries for BPF if exists or -v option is passed.
Currently it uses BROKEN_CONTENDED stat for the lost count (due to full
stack maps).
$ sudo perf lock con -a -b --map-nr-entries 128 sleep 5
...
=== output for debug===
bad: 43, total: 14903
bad rate: 0.29 %
histogram of events caused bad sequence
acquire: 0
acquired: 0
contended: 43
release: 0
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Blake Jones <blakejones@google.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
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 <songliubraving@fb.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20220802191004.347740-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-lock.c')
-rw-r--r-- | tools/perf/builtin-lock.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index c6cc6c296419..dd11d3471baf 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1472,8 +1472,11 @@ static void print_contention_result(void) pr_info(" %10s %s\n\n", "type", "caller"); bad = total = 0; + if (use_bpf) + bad = bad_hist[BROKEN_CONTENDED]; + while ((st = pop_from_result())) { - total++; + total += use_bpf ? st->nr_contended : 1; if (st->broken) bad++; @@ -1687,6 +1690,9 @@ static int __cmd_contention(int argc, const char **argv) lock_contention_stop(); lock_contention_read(&con); + + /* abuse bad hist stats for lost entries */ + bad_hist[BROKEN_CONTENDED] = con.lost; } else { err = perf_session__process_events(session); if (err) |