diff options
author | Namhyung Kim <namhyung@kernel.org> | 2022-06-15 09:32:18 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-07-12 09:55:04 -0300 |
commit | 9565c9186d17ac55f5dc8a556bece847e49dee35 (patch) | |
tree | d5413e257a2a4fa22152723c56f2fd6513b628f0 /tools/perf/builtin-lock.c | |
parent | 309e133dfe2651eedd572b62af2215b94532b712 (diff) |
perf lock: Skip print_bad_events() if nothing bad
The debug output is meaningful when there are bad lock sequences.
Skip it unless there's one or -v option is given.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
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: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20220615163222.1275500-4-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 | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 118a036a81fb..2337b09dd2cd 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -858,9 +858,16 @@ static void print_bad_events(int bad, int total) { /* Output for debug, this have to be removed */ int i; + int broken = 0; const char *name[4] = { "acquire", "acquired", "contended", "release" }; + for (i = 0; i < BROKEN_MAX; i++) + broken += bad_hist[i]; + + if (broken == 0 && !verbose) + return; + pr_info("\n=== output for debug===\n\n"); pr_info("bad: %d, total: %d\n", bad, total); pr_info("bad rate: %.2f %%\n", (double)bad / (double)total * 100); |