public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix timer_stats printout of events/sec
@ 2007-10-01 13:05 Anton Blanchard
  0 siblings, 0 replies; only message in thread
From: Anton Blanchard @ 2007-10-01 13:05 UTC (permalink / raw)
  To: mingo, tglx; +Cc: linux-kernel


Hi,

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>
---

diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c
index 3c38fb5..c36bb7e 100644
--- a/kernel/time/timer_stats.c
+++ b/kernel/time/timer_stats.c
@@ -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);
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-01 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-01 13:05 [PATCH] Fix timer_stats printout of events/sec Anton Blanchard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox