WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxc: simplify performance counters API

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxc: simplify performance counters API
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Oct 2010 06:50:32 -0700
Delivery-date: Wed, 20 Oct 2010 06:54:24 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1287419851 -3600
# Node ID b15d1f14810fb746b2a2df24f7075d333532cf58
# Parent  1449b5e2bad56093e6d48101b28aa99613dd9dac
libxc: simplify performance counters API

Current function has heavily overloaded semantics for the various
arguments. Separate out into more specific functions.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxc/xc_misc.c |   45 ++++++++++++++++++++++++++++++++++-----------
 tools/libxc/xenctrl.h |   13 +++++++------
 tools/misc/xenperf.c  |    9 +++------
 3 files changed, 44 insertions(+), 23 deletions(-)

diff -r 1449b5e2bad5 -r b15d1f14810f tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     Mon Oct 18 17:36:46 2010 +0100
+++ b/tools/libxc/xc_misc.c     Mon Oct 18 17:37:31 2010 +0100
@@ -167,20 +167,29 @@ int xc_mca_op(xc_interface *xch, struct 
 }
 #endif
 
-int xc_perfc_control(xc_interface *xch,
-                     uint32_t opcode,
-                     xc_perfc_desc_t *desc,
-                     xc_perfc_val_t *val,
-                     int *nbr_desc,
-                     int *nbr_val)
-{
-    int rc;
+int xc_perfc_reset(xc_interface *xch)
+{
     DECLARE_SYSCTL;
 
     sysctl.cmd = XEN_SYSCTL_perfc_op;
-    sysctl.u.perfc_op.cmd = opcode;
-    set_xen_guest_handle(sysctl.u.perfc_op.desc, desc);
-    set_xen_guest_handle(sysctl.u.perfc_op.val, val);
+    sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_reset;
+    set_xen_guest_handle(sysctl.u.perfc_op.desc, NULL);
+    set_xen_guest_handle(sysctl.u.perfc_op.val, NULL);
+
+    return do_sysctl(xch, &sysctl);
+}
+
+int xc_perfc_query_number(xc_interface *xch,
+                          int *nbr_desc,
+                          int *nbr_val)
+{
+    int rc;
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_perfc_op;
+    sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_query;
+    set_xen_guest_handle(sysctl.u.perfc_op.desc, NULL);
+    set_xen_guest_handle(sysctl.u.perfc_op.val, NULL);
 
     rc = do_sysctl(xch, &sysctl);
 
@@ -190,6 +199,20 @@ int xc_perfc_control(xc_interface *xch,
         *nbr_val = sysctl.u.perfc_op.nr_vals;
 
     return rc;
+}
+
+int xc_perfc_query(xc_interface *xch,
+                   xc_perfc_desc_t *desc,
+                   xc_perfc_val_t *val)
+{
+    DECLARE_SYSCTL;
+
+    sysctl.cmd = XEN_SYSCTL_perfc_op;
+    sysctl.u.perfc_op.cmd = XEN_SYSCTL_PERFCOP_query;
+    set_xen_guest_handle(sysctl.u.perfc_op.desc, desc);
+    set_xen_guest_handle(sysctl.u.perfc_op.val, val);
+
+    return do_sysctl(xch, &sysctl);
 }
 
 int xc_lockprof_control(xc_interface *xch,
diff -r 1449b5e2bad5 -r b15d1f14810f tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Mon Oct 18 17:36:46 2010 +0100
+++ b/tools/libxc/xenctrl.h     Mon Oct 18 17:37:31 2010 +0100
@@ -887,14 +887,15 @@ unsigned long xc_make_page_below_4G(xc_i
 
 typedef xen_sysctl_perfc_desc_t xc_perfc_desc_t;
 typedef xen_sysctl_perfc_val_t xc_perfc_val_t;
+int xc_perfc_reset(xc_interface *xch);
+int xc_perfc_query_number(xc_interface *xch,
+                          int *nbr_desc,
+                          int *nbr_val);
 /* IMPORTANT: The caller is responsible for mlock()'ing the @desc and @val
    arrays. */
-int xc_perfc_control(xc_interface *xch,
-                     uint32_t op,
-                     xc_perfc_desc_t *desc,
-                     xc_perfc_val_t *val,
-                     int *nbr_desc,
-                     int *nbr_val);
+int xc_perfc_query(xc_interface *xch,
+                   xc_perfc_desc_t *desc,
+                   xc_perfc_val_t *val);
 
 typedef xen_sysctl_lockprof_data_t xc_lockprof_data_t;
 /* IMPORTANT: The caller is responsible for mlock()'ing the @data array. */
diff -r 1449b5e2bad5 -r b15d1f14810f tools/misc/xenperf.c
--- a/tools/misc/xenperf.c      Mon Oct 18 17:36:46 2010 +0100
+++ b/tools/misc/xenperf.c      Mon Oct 18 17:37:31 2010 +0100
@@ -137,8 +137,7 @@ int main(int argc, char *argv[])
     
     if ( reset )
     {
-        if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_reset,
-                              NULL, NULL, NULL, NULL) != 0 )
+        if ( xc_perfc_reset(xc_handle) != 0 )
         {
             fprintf(stderr, "Error reseting performance counters: %d (%s)\n",
                     errno, strerror(errno));
@@ -148,8 +147,7 @@ int main(int argc, char *argv[])
         return 0;
     }
 
-    if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query,
-                          NULL, NULL, &num_desc, &num_val) != 0 )
+    if ( xc_perfc_query_number(xc_handle, &num_desc, &num_val) != 0 )
     {
         fprintf(stderr, "Error getting number of perf counters: %d (%s)\n",
                 errno, strerror(errno));
@@ -169,8 +167,7 @@ int main(int argc, char *argv[])
         exit(-1);
     }
 
-    if ( xc_perfc_control(xc_handle, XEN_SYSCTL_PERFCOP_query,
-                          pcd, pcv, NULL, NULL) != 0 )
+    if ( xc_perfc_query(xc_handle, pcd, pcv) != 0 )
     {
         fprintf(stderr, "Error getting perf counter: %d (%s)\n",
                 errno, strerror(errno));

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxc: simplify performance counters API, Xen patchbot-unstable <=