]> git.hungrycats.org Git - linux/commitdiff
Fix timer_stats printout of events/sec
authorAnton Blanchard <anton@samba.org>
Sun, 7 Oct 2007 07:24:31 +0000 (00:24 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 10 Oct 2007 17:50:16 +0000 (10:50 -0700)
commit 74922be1485818ed368c4cf4f0b100f70bf01e08 upstream.

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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/time/timer_stats.c

index 7bb561d0f5700100effd76de28cc87b08c173111..5717cfb9b080207828734ec856725b508b9a27ac 100644 (file)
@@ -319,8 +319,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);