Hi,
The below patch fixes various issues with the xenperf code, and adds a syscall counter to xenolinux.
Thanks
Ross
------------------------------------------------------------------------------
Some fixes to the performance counters code, and added system call statistics.
Signed-of-by: Ross McIlroy <mcilrorc@xxxxxxxxxxxxx>
diff -r 83c73802f02a linux-2.6-xen-sparse/arch/xen/Kconfig
--- a/linux-2.6-xen-sparse/arch/xen/Kconfig Fri Aug 26 09:29:54 2005
+++ b/linux-2.6-xen-sparse/arch/xen/Kconfig Fri Aug 26 11:52:49 2005
@@ -134,6 +134,9 @@
help
fakes out a shadow mode kernel
+config XEN_SYSCALL_STATS
+ bool "system call statistics"
+ default n
config XEN_SCRUB_PAGES
bool "Scrub memory before freeing it to Xen"
diff -r 83c73802f02a linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile Fri Aug 26 09:29:54 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile Fri Aug 26 11:52:49 2005
@@ -43,6 +43,7 @@
c-obj-$(CONFIG_EFI) += efi.o efi_stub.o
c-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
c-obj-$(CONFIG_SMP_ALTERNATIVES)+= smpalts.o
+c-obj-$(CONFIG_XEN_SYSCALL_STATS)+= syscall_stats.o
obj-$(CONFIG_SWIOTLB) += swiotlb.o
EXTRA_AFLAGS := -traditional
diff -r 83c73802f02a linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S Fri Aug 26 09:29:54 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S Fri Aug 26 11:52:49 2005
@@ -256,6 +256,9 @@
jnz syscall_trace_entry
cmpl $(nr_syscalls), %eax
jae syscall_badsys
+#ifdef CONFIG_XEN_SYSCALL_STATS
+ lock incl syscall_stats(,%eax,4)
+#endif
call *sys_call_table(,%eax,4)
movl %eax,EAX(%esp)
cli
@@ -281,6 +284,9 @@
cmpl $(nr_syscalls), %eax
jae syscall_badsys
syscall_call:
+#ifdef CONFIG_XEN_SYSCALL_STATS
+ lock incl syscall_stats(,%eax,4)
+#endif
call *sys_call_table(,%eax,4)
movl %eax,EAX(%esp) # store the return value
syscall_exit:
diff -r 83c73802f02a tools/misc/cpuperf/cpuperf.c
--- a/tools/misc/cpuperf/cpuperf.c Fri Aug 26 09:29:54 2005
+++ b/tools/misc/cpuperf/cpuperf.c Fri Aug 26 11:52:49 2005
@@ -243,15 +243,13 @@
}
if (read) {
- while((cpu_mask&1)) {
- int i;
- for (i=0x300;i<0x312;i++) {
- printf("%010llu ",cpus_rdmsr( cpu_mask, i ) );
- }
- printf("\n");
- cpu_mask>>=1;
- }
- exit(1);
+
+ int i;
+ for (i=0x300;i<0x312;i++) {
+ printf("%010llu ",cpus_rdmsr( cpu_mask, i ) );
+ }
+ printf("\n");
+ exit(1);
}
if (!escr) {
diff -r 83c73802f02a xen/include/xen/perfc.h
--- a/xen/include/xen/perfc.h Fri Aug 26 09:29:54 2005
+++ b/xen/include/xen/perfc.h Fri Aug 26 11:52:49 2005
@@ -5,6 +5,7 @@
#ifdef PERF_COUNTERS
#include <asm/atomic.h>
+#include <xen/lib.h>
/*
* NOTE: new counters must be defined in perfc_defn.h
@@ -87,7 +88,7 @@
* Histogram: special treatment for 0 and 1 count. After that equally spaced
* with last bucket taking the rest.
*/
-#ifdef PERFC_ARRAYS
+#ifdef PERF_ARRAYS
#define perfc_incr_histo(_x,_v,_n) \
do { \
if ( (_v) == 0 ) \
diff -r 83c73802f02a linux-2.6-xen-sparse/arch/xen/i386/kernel/syscall_stats.c
--- /dev/null Fri Aug 26 09:29:54 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/syscall_stats.c Fri Aug 26 11:52:49 2005
@@ -0,0 +1,91 @@
+/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
+ ****************************************************************************
+ * (C) 2005 - Rolf Neugebauer - Intel Research Cambridge
+ ****************************************************************************
+ *
+ * File: syscall_stats.c
+ * Author: Rolf Neugebauer (rolf.neugebauer@xxxxxxxxx)
+ * Date: Mar 2005
+ *
+ * Description: add a proc interface to get per system call stats
+ */
+
+
+#include <linux/config.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <asm/unistd.h>
+
+unsigned long syscall_stats[NR_syscalls];
+static unsigned char foobar[4];
+
+/* a write just resests the counter */
+static ssize_t syscall_write(struct file *f, const char *data,
+ size_t size, loff_t *pos)
+{
+ printk("resetting syscall stats\n");
+ memset(&syscall_stats, 0, sizeof(syscall_stats));
+ return size;
+}
+
+static int show_syscall(struct seq_file *m, void *v)
+{
+ int i;
+ for ( i=0; i<NR_syscalls; i++ )
+ {
+ seq_printf(m, "%lu ", syscall_stats[i]);
+ }
+ seq_printf(m, "\n");
+ return 0;
+}
+
+static void *c_start(struct seq_file *m, loff_t *pos)
+{
+ return *pos == 0 ? foobar : NULL;
+}
+
+static void *c_next(struct seq_file *m, void *v, loff_t *pos)
+{
+ ++*pos;
+ return c_start(m, pos);
+}
+
+static void c_stop(struct seq_file *m, void *v)
+{
+}
+
+static struct seq_operations syscall_op = {
+ start: c_start,
+ next: c_next,
+ stop: c_stop,
+ show: show_syscall,
+};
+
+static int syscall_open(struct inode *inode, struct file *file)
+{
+ return seq_open(file, &syscall_op);
+}
+
+static struct file_operations proc_syscall_operations = {
+ open: syscall_open,
+ read: seq_read,
+ write: syscall_write,
+ llseek: seq_lseek,
+ release: seq_release,
+};
+
+
+static struct proc_dir_entry *entry;
+
+static int __init syscall_stats_init(void)
+{
+ printk("Initialising syscall stats.\n");
+
+ entry = create_proc_entry("syscalls", 0777, NULL);
+ if (entry)
+ entry->proc_fops = &proc_syscall_operations;
+ else
+ printk("Unable to create /proc/syscalls.\n");
+ return 0;
+}
+subsys_initcall(syscall_stats_init);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|