diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2010-10-18 17:37:50 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2010-10-18 17:37:50 +0100 |
commit | 4f42a4e74f157e0d9cbb3595b1cc7e215c917428 (patch) | |
tree | 79205000fd9261234c650591d5adf4d8ede3e41f /tools/libxc/xc_misc.c | |
parent | 656ba9748a4af226415bf77039a20a1948444445 (diff) | |
download | xen-4f42a4e74f157e0d9cbb3595b1cc7e215c917428.tar.gz xen-4f42a4e74f157e0d9cbb3595b1cc7e215c917428.tar.bz2 xen-4f42a4e74f157e0d9cbb3595b1cc7e215c917428.zip |
libxc: simplify lock profiling API
Current function has heavily overloaded semantics for the various
arguments. Separate out into more specific functions.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_misc.c')
-rw-r--r-- | tools/libxc/xc_misc.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index a64a633e29..86b4f33158 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -215,8 +215,35 @@ int xc_perfc_query(xc_interface *xch, return do_sysctl(xch, &sysctl); } -int xc_lockprof_control(xc_interface *xch, - uint32_t opcode, +int xc_lockprof_reset(xc_interface *xch) +{ + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_lockprof_op; + sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_reset; + set_xen_guest_handle(sysctl.u.lockprof_op.data, NULL); + + return do_sysctl(xch, &sysctl); +} + +int xc_lockprof_query_number(xc_interface *xch, + uint32_t *n_elems) +{ + int rc; + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_lockprof_op; + sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_query; + set_xen_guest_handle(sysctl.u.lockprof_op.data, NULL); + + rc = do_sysctl(xch, &sysctl); + + *n_elems = sysctl.u.lockprof_op.nr_elem; + + return rc; +} + +int xc_lockprof_query(xc_interface *xch, uint32_t *n_elems, uint64_t *time, xc_lockprof_data_t *data) @@ -225,16 +252,13 @@ int xc_lockprof_control(xc_interface *xch, DECLARE_SYSCTL; sysctl.cmd = XEN_SYSCTL_lockprof_op; - sysctl.u.lockprof_op.cmd = opcode; - sysctl.u.lockprof_op.max_elem = n_elems ? *n_elems : 0; + sysctl.u.lockprof_op.cmd = XEN_SYSCTL_LOCKPROF_query; + sysctl.u.lockprof_op.max_elem = *n_elems; set_xen_guest_handle(sysctl.u.lockprof_op.data, data); rc = do_sysctl(xch, &sysctl); - if (n_elems) - *n_elems = sysctl.u.lockprof_op.nr_elem; - if (time) - *time = sysctl.u.lockprof_op.time; + *n_elems = sysctl.u.lockprof_op.nr_elem; return rc; } |