All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Kravetz <kravetz@us.ibm.com>
To: linuxppc-dev@ozlabs.org
Cc: Bryan Rosenburg <rosnbrg@us.ibm.com>, Christopher Yeoh <cyeoh@samba.org>
Subject: [PATCH 0/3] powerpc: Instrument Hypervisor Calls: add sysfs files
Date: Tue, 13 Jun 2006 20:54:20 -0700	[thread overview]
Message-ID: <20060614035420.GD6759@monkey.ibm.com> (raw)
In-Reply-To: <20060614034756.GA6759@monkey.ibm.com>

Make statistics available via files in sysfs.

-- 
Signed-off-by: Mike Kravetz <kravetz@us.ibm.com>


diff -Naupr linux-2.6.17-rc6/arch/powerpc/kernel/sysfs.c linux-2.6.17-rc6.work/arch/powerpc/kernel/sysfs.c
--- linux-2.6.17-rc6/arch/powerpc/kernel/sysfs.c	2006-06-06 00:57:02.000000000 +0000
+++ linux-2.6.17-rc6.work/arch/powerpc/kernel/sysfs.c	2006-06-13 21:42:32.000000000 +0000
@@ -356,6 +356,39 @@ static ssize_t show_physical_id(struct s
 }
 static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL);
 
+#ifdef CONFIG_HCALL_STATS
+DECLARE_PER_CPU(struct hcall_stats[MAX_HCALL_OPCODES+1], hcall_stats);
+
+static ssize_t show_hcall_stats(struct sys_device *dev, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, sysdev);
+	struct hcall_stats *hs = per_cpu(hcall_stats, cpu->sysdev.id);
+	size_t rc = 0;
+	size_t b_written = 0;
+	size_t b_remain = PAGE_SIZE;
+	unsigned long i;
+
+	for (i=0; i<MAX_HCALL_OPCODES+1; i++){
+		if (!hs[i].num_calls)
+			continue;
+
+		b_written = snprintf(buf+rc, b_remain,
+				"%lu %lu %lu\n",
+				i<<2, hs[i].num_calls, hs[i].total_time);
+
+		if (b_written >= b_remain)
+			break;	/* end of buffer */
+
+		rc += b_written;
+		b_remain -= b_written;
+	}
+
+	return rc;
+}
+
+static SYSDEV_ATTR(hcall_stats, 0666, show_hcall_stats, NULL);
+#endif /* CONFIG_HCALL_STATS */
+
 static int __init topology_init(void)
 {
 	int cpu;
@@ -390,6 +423,9 @@ static int __init topology_init(void)
 			register_cpu(c, cpu, parent);
 
 			sysdev_create_file(&c->sysdev, &attr_physical_id);
+#ifdef CONFIG_HCALL_STATS
+			sysdev_create_file(&c->sysdev, &attr_hcall_stats);
+#endif
 		}
 
 		if (cpu_online(cpu))

  parent reply	other threads:[~2006-06-14  5:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-14  3:47 [PATCH 0/3] powerpc: Instrument Hypervisor Calls Mike Kravetz
2006-06-14  3:50 ` [PATCH 1/3] powerpc: Instrument Hypervisor Calls: merge headers Mike Kravetz
2006-06-14  3:52 ` [PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers Mike Kravetz
2006-06-14  7:23   ` Arnd Bergmann
2006-06-14 14:42   ` Nathan Lynch
2006-06-14 22:33     ` Paul Mackerras
2006-06-14 22:40       ` Nathan Lynch
2006-06-14 23:52         ` Mike Kravetz
2006-06-15 11:09           ` Arnd Bergmann
2006-06-15 14:58             ` Mike Kravetz
2006-06-15 16:06               ` Arnd Bergmann
2006-06-16 16:11       ` Mike Kravetz
2006-06-14  3:54 ` Mike Kravetz [this message]
2006-06-14 14:22   ` [PATCH 0/3] powerpc: Instrument Hypervisor Calls: add sysfs files Nathan Lynch
2006-06-15 11:45     ` Christopher Yeoh
2006-06-14 14:30   ` Dave C Boutcher
2006-06-14 14:39 ` [RFC] New hcall mechanism Was: [PATCH 0/3] powerpc: Instrument Hypervisor Calls Jimi Xenidis

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=20060614035420.GD6759@monkey.ibm.com \
    --to=kravetz@us.ibm.com \
    --cc=cyeoh@samba.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rosnbrg@us.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.