linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] tickless idle cpus: decrementer statistics - NOT MEANT FOR INCLUSION
@ 2006-04-07  6:32 Srivatsa Vaddagiri
  0 siblings, 0 replies; only message in thread
From: Srivatsa Vaddagiri @ 2006-04-07  6:32 UTC (permalink / raw)
  To: anton, benh, paulus; +Cc: linuxppc-dev, sri_vatsa_v

This patch (a hack) provides some statistics of decrementer exception on
each CPU. I used this purely to verify that tickless feature is working.

Anton, would this be useful statistics to be exposed (maybe in
/proc/interrupts)? If so, I could work out a more cleaner way of
providing this statistics to user.

Signed-off-by: Srivatsa Vaddagiri <vatsa@in.ibm.com>

---

 linux-2.6.17-rc1-root/arch/powerpc/kernel/time.c |    4 ++++
 linux-2.6.17-rc1-root/fs/proc/proc_misc.c        |   17 +++++++++++++++++
 2 files changed, 21 insertions(+)

diff -puN arch/powerpc/kernel/time.c~stat arch/powerpc/kernel/time.c
--- linux-2.6.17-rc1/arch/powerpc/kernel/time.c~stat	2006-04-07 11:29:20.000000000 +0530
+++ linux-2.6.17-rc1-root/arch/powerpc/kernel/time.c	2006-04-07 11:29:20.000000000 +0530
@@ -757,6 +757,8 @@ void start_hz_timer(struct pt_regs *regs
 static inline int clear_hzless_mask(void) { return 0;}
 #endif
 
+DEFINE_PER_CPU(int, dec_ticks);
+
 /*
  * For iSeries shared processors, we have to let the hypervisor
  * set the hardware decrementer.  We set a virtual decrementer
@@ -780,6 +782,8 @@ void timer_interrupt(struct pt_regs * re
 
 	irq_enter();
 
+	__get_cpu_var(dec_ticks) += 1;
+
 	clear_hzless_mask();
 
 	profile_tick(CPU_PROFILING, regs);
diff -puN fs/proc/proc_misc.c~stat fs/proc/proc_misc.c
--- linux-2.6.17-rc1/fs/proc/proc_misc.c~stat	2006-04-07 11:29:20.000000000 +0530
+++ linux-2.6.17-rc1-root/fs/proc/proc_misc.c	2006-04-07 11:29:20.000000000 +0530
@@ -243,6 +243,22 @@ static int version_read_proc(char *page,
 	return proc_calc_metrics(page, start, off, count, eof, len);
 }
 
+DECLARE_PER_CPU(int, dec_ticks);
+
+static int decrementer_read_proc(char *page, char **start, off_t off,
+				 int count, int *eof, void *data)
+{
+	int len, cpu;
+	char *cp = page;
+
+	for_each_cpu(cpu)
+		cp += sprintf (cp, "%d ", per_cpu(dec_ticks, cpu));
+
+	len = cp - page;
+
+	return proc_calc_metrics(page, start, off, count, eof, len);
+}
+
 extern struct seq_operations cpuinfo_op;
 static int cpuinfo_open(struct inode *inode, struct file *file)
 {
@@ -740,6 +756,7 @@ void __init proc_misc_init(void)
 		{"uptime",	uptime_read_proc},
 		{"meminfo",	meminfo_read_proc},
 		{"version",	version_read_proc},
+		{"decrementer",	decrementer_read_proc},
 #ifdef CONFIG_PROC_HARDWARE
 		{"hardware",	hardware_read_proc},
 #endif

_

-- 
Regards,
vatsa

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

only message in thread, other threads:[~2006-04-07  6:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-07  6:32 [PATCH 4/4] tickless idle cpus: decrementer statistics - NOT MEANT FOR INCLUSION Srivatsa Vaddagiri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).