diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-30 22:31:45 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-30 22:31:45 +0100 |
commit | f6556b0d174a6a9d3d855f4ec92c7bf246e1b34c (patch) | |
tree | 46e0d9c15164b2c808fc6a0322b8543c0092892f /tools/libxc/xc_tbuf.c | |
parent | 07237aa4f333c3feeb9e11e172213d2d440af4dd (diff) | |
download | xen-f6556b0d174a6a9d3d855f4ec92c7bf246e1b34c.tar.gz xen-f6556b0d174a6a9d3d855f4ec92c7bf246e1b34c.tar.bz2 xen-f6556b0d174a6a9d3d855f4ec92c7bf246e1b34c.zip |
This is a set of changes which allow the tracebuffer functionality to
be enabled and disabled dynamically while the system is running. The
existing DOM0_TBUFCONTROL hypercall is used, and three new operations
have been added: enable, disable, and set_size. This is to address
concerns that use of the trace buffers impacts system performance.
The initial value of opt_tbuf_size is set to zero, so that trace
buffers remain disabled by default. They can be enabled as they used
to be, by adding tbuf_size= to the xen command line at boot time. They
can also be turned on and off any time when the system is running. The
size of the trace buffer allocation can also be changed dynamically
while the system is running. The trace buffers may be completely
deallocated by setting the size to zero. No change in buffer size can
be done while tracing is enabled;
Other Changes made:
- Update the constants in tools/xentrace/formats to match those in
public/trace.h
- libxc functions for enable/disable, get/set size
Still left to do:
- remove all ifdef's for trace buffers and the 'trace' build option
- xm command to do enable/disable trace buffers and get/set size
Signed-off-by: Rob Gardner <rob.gardner@hp.com>
Diffstat (limited to 'tools/libxc/xc_tbuf.c')
-rw-r--r-- | tools/libxc/xc_tbuf.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c new file mode 100644 index 0000000000..b47cde2867 --- /dev/null +++ b/tools/libxc/xc_tbuf.c @@ -0,0 +1,51 @@ +/****************************************************************************** + * xc_tbuf.c + * + * API for manipulating and accessing trace buffer parameters + * + * Copyright (c) 2005, Rob Gardner + */ + +#include "xc_private.h" + +int xc_tbuf_enable(int xc_handle, int enable) +{ + dom0_op_t op; + + op.cmd = DOM0_TBUFCONTROL; + op.interface_version = DOM0_INTERFACE_VERSION; + if (enable) + op.u.tbufcontrol.op = DOM0_TBUF_ENABLE; + else + op.u.tbufcontrol.op = DOM0_TBUF_DISABLE; + + return xc_dom0_op(xc_handle, &op); +} + +int xc_tbuf_set_size(int xc_handle, uint32_t size) +{ + dom0_op_t op; + + op.cmd = DOM0_TBUFCONTROL; + op.interface_version = DOM0_INTERFACE_VERSION; + op.u.tbufcontrol.op = DOM0_TBUF_SET_SIZE; + op.u.tbufcontrol.size = size; + + return xc_dom0_op(xc_handle, &op); +} + +int xc_tbuf_get_size(int xc_handle, uint32_t *size) +{ + int rc; + dom0_op_t op; + + op.cmd = DOM0_TBUFCONTROL; + op.interface_version = DOM0_INTERFACE_VERSION; + op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO; + + rc = xc_dom0_op(xc_handle, &op); + if (rc == 0) + *size = op.u.tbufcontrol.size; + return rc; +} + |