Skip to content

Commit

Permalink
perf: Fix perf lock bad rate
Browse files Browse the repository at this point in the history
Fix the cast made to get the bad rate. It is made in the result
instead of the operands. We need the operands to be cast in double,
otherwise the result will always be zero.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
  • Loading branch information
fweisbec committed May 9, 2010
1 parent 84c7a21 commit 5efe08c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/perf/builtin-lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,8 @@ static void print_bad_events(int bad, int total)
{ "acquire", "acquired", "contended", "release" };

pr_info("\n=== output for debug===\n\n");
pr_info("bad:%d, total:%d\n", bad, total);
pr_info("bad rate:%f\n", (double)(bad / total));
pr_info("bad: %d, total: %d\n", bad, total);
pr_info("bad rate: %f %%\n", (double)bad / (double)total * 100);
pr_info("histogram of events caused bad sequence\n");
for (i = 0; i < BROKEN_MAX; i++)
pr_info(" %10s: %d\n", name[i], bad_hist[i]);
Expand Down

0 comments on commit 5efe08c

Please sign in to comment.