PATCH [resend]: improved perfcounter framework
Hi,
I resend two patches for perfcounters.
xen-nperfc4.diffs provides hooks. This is the same as previously posted, here is the comment:
[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)]
xen-nperfc5.diffs removes array bounds constraint. It is a simplified version of the previously posted patch. The comment was:
[the current dom0_perfcounter hypercall has a limit on the number of values per counter (64). On ia64 we'd like to use arrays bigger than this limit. This patch removes this hard-limit: perfcounter descriptors and values are now passed by two distinct buffers.
This break the API compatibility. However because DOM0_PERFCCONTROL is used only by xenperf and only by developpers the patch didn't change DOM0_INTERFACE_VERSION.]
Tested on ia64.
Tristan.
# HG changeset patch
# User gingold@virtu10
# Node ID f353f99397732f9f229abc430ad5da096b1c3b6f # Parent c3e20511c74508c78b4b15e4c3f94f84ce1c3c40 Provides hooks for perfc print/reset/gather.
These arch-neutral hooks allow architectures to report hardware counters.
xen/common/perfc.c +3 -6
@@ -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 ];
# HG changeset patch
# User gingold@virtu10
# Node ID 2c06898a1e8448dfe3b2efdfaa6a79493d362422 # Parent f353f99397732f9f229abc430ad5da096b1c3b6f Change DOM0_PERFCCONTROL: remove array limit.
Descriptors and values are passed by two distinct buffers.
tools/libxc/xc_misc.c +11 -2
@@ -68,7 +68,10 @@ int xc_sched_id(int xc_handle,int xc_perfc_control (int xc_handle,uint32_t opcode, -xc_perfc_desc_t *desc) +xc_perfc_desc_t *desc, +xc_perfc_val_t *val, +int *nbr_desc, +int *nbr_val) {int rc;DECLARE_DOM0_OP ;
@@ -76,10 +79,16 @@ int xc_perfc_control(int xc_handle, op.cmd =DOM0_PERFCCONTROL ; op.u.perfccontrol.op = opcode;set_xen_guest_handle (op.u.perfccontrol.desc, desc); +set_xen_guest_handle (op.u.perfccontrol.val, val); rc =do_dom0_op (xc_handle, &op); -return (rc ==0 ) ? op.u.perfccontrol.nr_counters : rc; +if (nbr_desc) + *nbr_desc = op.u.perfccontrol.nr_counters; +if (nbr_val) + *nbr_val = op.u.perfccontrol.nr_vals; + +return rc; }long long xc_msr_read (int xc_handle,int cpu_mask,int msr)
tools/libxc/xenctrl.h +7 -2
@@ -466,10 +466,15 @@ unsigned long xc_make_page_below_4G(int unsigned long mfn);typedef dom0_perfc_desc_t xc_perfc_desc_t ; -/* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */ +typedef dom0_perfc_val_t xc_perfc_val_t ; +/* IMPORTANT: The caller is responsible for mlock()'ing the @desc and @val +arrays. */ int xc_perfc_control (int xc_handle,uint32_t op, -xc_perfc_desc_t *desc); +xc_perfc_desc_t *desc, +xc_perfc_val_t *val, +int *nbr_desc, +int *nbr_val);/* read/write msr */ long long xc_msr_read (int xc_handle,int cpu_mask,int msr);
tools/misc/xenperf.c +35 -25
96 lines not on this page · raw message
xen/common/perfc.c +52 -98
229 lines not on this page · raw message
xen/include/public/dom0_ops.h +5 -2
@@ -361,17 +361,20 @@ struct dom0_perfc_desc {struct dom0_perfc_desc {char name[80 ];/* name of perf counter */ uint32_t nr_vals;/* number of values for this counter */ -uint32_t vals[64 ];/* array of values */ };typedef struct dom0_perfc_desc dom0_perfc_desc_t ;DEFINE_XEN_GUEST_HANDLE (dom0_perfc_desc_t); +typedef uint32_t dom0_perfc_val_t ; +DEFINE_XEN_GUEST_HANDLE (dom0_perfc_val_t);struct dom0_perfccontrol {/* IN variables. */ uint32_t op;/* DOM0_PERFCCONTROL_OP_??? */ /* OUT variables. */ -uint32_t nr_counters;/* number of counters */ +uint32_t nr_counters;/* number of counters description */ +uint32_t nr_vals;/* number of values */ XEN_GUEST_HANDLE (dom0_perfc_desc_t) desc;/* counter information (or NULL) */ +XEN_GUEST_HANDLE (dom0_perfc_val_t) val;/* counter values (or NULL) */ };typedef struct dom0_perfccontrol dom0_perfccontrol_t ;DEFINE_XEN_GUEST_HANDLE (dom0_perfccontrol_t);
xen/include/xen/perfc.h +30 -25
65 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel