Skip to contentSkip to conversation

PATCH: provide hooks for perfc print/reset/gather

PATCH Tristan Gingold 1 participant 1 message Aug 4, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I'd like to use the perfc API to report counters not easily countable (such as the number of valid entries in a table. Counting it on the fly may be very costly).
These hooks provide the basic infrastructure for that.

(empty hooks added for ia64 and powerpc, x86 hooks call ptwr_eip_stat_XX).

Tristan.

# HG changeset patch
# User gingold@virtu10
# Node ID 6c4b7669876b707b5eccf2ad99be6681f5b52366 # Parent 6286aede6482ff468795ca9d9c58c94fae2dd758 Provides hooks for perfc print/reset/gather.

These arch-neutral hooks allow architectures to report hardware counters.

xen/common/perfc.c +6 -6
diff -r 6286aede6482 -r 6c4b7669876b xen/common/perfc.c
@@ -8,6 +8,7 @@
 #include <xen/mm.h>
 #include <xen/guest_access.h>
 #include <public/dom0_ops.h>
+#include <asm/perfc.h>
 
 #undef  PERFCOUNTER
 #undef  PERFCOUNTER_CPU
@@ -89,9 +90,7 @@ void perfc_printall(unsigned char key)
         printk("\n");
     }
 
-#ifdef PERF_ARRAYS
-    ptwr_eip_stat_print();
-#endif
+    arch_perfc_printall();
 }
 
 void perfc_reset(unsigned char key)
@@ -130,9 +129,7 @@ void perfc_reset(unsigned char key)
         }
     }
 
-#ifdef PERF_ARRAYS
-    ptwr_eip_stat_reset();
-#endif
+    arch_perfc_reset ();
 }
 
 static dom0_perfc_desc_t perfc_d[NR_PERFCTRS];
@@ -180,6 +177,9 @@ static int perfc_copy_info(XEN_GUEST_HAN
     }
     if (perfc_vals == NULL)
         return -ENOMEM;
+
+    /* Architecture may fill counters from hardware.  */
+    arch_perfc_gather();
 
     /* We gather the counts together every time. */
     for ( i = 0; i < NR_PERFCTRS; i++ )
xen/include/asm-ia64/perfc.h new file +16 -0
diff -r 6286aede6482 -r 6c4b7669876b xen/include/asm-ia64/perfc.h
@@ -0,0 +1,16 @@
+#ifndef __ASM_PERFC_H__
+#define __ASM_PERFC_H__
+
+static inline void arch_perfc_printall (void)
+{
+}
+
+static inline void arch_perfc_reset (void)
+{
+}
+
+static inline void arch_perfc_gather (void)
+{
+}
+
+#endif
xen/include/asm-powerpc/perfc.h new file +16 -0
diff -r 6286aede6482 -r 6c4b7669876b xen/include/asm-powerpc/perfc.h
@@ -0,0 +1,16 @@
+#ifndef __ASM_PERFC_H__
+#define __ASM_PERFC_H__
+
+static inline void arch_perfc_printall (void)
+{
+}
+
+static inline void arch_perfc_reset (void)
+{
+}
+
+static inline void arch_perfc_gather (void)
+{
+}
+
+#endif
xen/include/asm-x86/perfc.h new file +23 -0
diff -r 6286aede6482 -r 6c4b7669876b xen/include/asm-x86/perfc.h
@@ -0,0 +1,23 @@
+#ifndef __ASM_PERFC_H__
+#define __ASM_PERFC_H__
+#include <asm/mm.h>
+
+static inline void arch_perfc_printall (void)
+{
+#ifdef PERF_ARRAYS
+    ptwr_eip_stat_print();
+#endif
+}
+
+static inline void arch_perfc_reset (void)
+{
+#ifdef PERF_ARRAYS
+    ptwr_eip_stat_reset();
+#endif
+}
+
+static inline void arch_perfc_gather (void)
+{
+}
+
+#endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel