linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
To: anton@samba.org, benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@ozlabs.org, sri_vatsa_v@yahoo.com
Subject: [PATCH 4/4] tickless idle cpus: decrementer statistics - NOT MEANT FOR INCLUSION
Date: Fri, 7 Apr 2006 12:02:56 +0530	[thread overview]
Message-ID: <20060407063256.GD22416@in.ibm.com> (raw)

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

                 reply	other threads:[~2006-04-07  6:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060407063256.GD22416@in.ibm.com \
    --to=vatsa@in.ibm.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    --cc=sri_vatsa_v@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).