Commit 74922be1 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

Fix timer_stats printout of events/sec

When using /proc/timer_stats on ppc64 I noticed the events/sec field wasnt
accurate.  Sometimes the integer part was incorrect due to rounding (we
werent taking the fractional seconds into consideration).

The fraction part is also wrong, we need to pad the printf statement and
take the bottom three digits of 1000 times the value.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0c2043ab
...@@ -327,8 +327,9 @@ static int tstats_show(struct seq_file *m, void *v) ...@@ -327,8 +327,9 @@ static int tstats_show(struct seq_file *m, void *v)
ms = 1; ms = 1;
if (events && period.tv_sec) if (events && period.tv_sec)
seq_printf(m, "%ld total events, %ld.%ld events/sec\n", events, seq_printf(m, "%ld total events, %ld.%03ld events/sec\n",
events / period.tv_sec, events * 1000 / ms); events, events * 1000 / ms,
(events * 1000000 / ms) % 1000);
else else
seq_printf(m, "%ld total events\n", events); seq_printf(m, "%ld total events\n", events);
......
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