Skip to content

Commit

Permalink
Fix timer_stats printout of events/sec
Browse files Browse the repository at this point in the history
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: Anton Blanchard <anton@samba.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Anton Blanchard authored and Linus Torvalds committed Oct 7, 2007
1 parent 0c2043a commit 74922be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/time/timer_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ static int tstats_show(struct seq_file *m, void *v)
ms = 1;

if (events && period.tv_sec)
seq_printf(m, "%ld total events, %ld.%ld events/sec\n", events,
events / period.tv_sec, events * 1000 / ms);
seq_printf(m, "%ld total events, %ld.%03ld events/sec\n",
events, events * 1000 / ms,
(events * 1000000 / ms) % 1000);
else
seq_printf(m, "%ld total events\n", events);

Expand Down

0 comments on commit 74922be

Please sign in to comment.