Commit 9565c918 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

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: default avatarNamhyung 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 309e133d
...@@ -858,9 +858,16 @@ static void print_bad_events(int bad, int total) ...@@ -858,9 +858,16 @@ static void print_bad_events(int bad, int total)
{ {
/* Output for debug, this have to be removed */ /* Output for debug, this have to be removed */
int i; int i;
int broken = 0;
const char *name[4] = const char *name[4] =
{ "acquire", "acquired", "contended", "release" }; { "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("\n=== output for debug===\n\n");
pr_info("bad: %d, total: %d\n", bad, total); pr_info("bad: %d, total: %d\n", bad, total);
pr_info("bad rate: %.2f %%\n", (double)bad / (double)total * 100); pr_info("bad rate: %.2f %%\n", (double)bad / (double)total * 100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment