aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xentrace/setsize.c
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-10-30 22:31:45 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-10-30 22:31:45 +0100
commitf6556b0d174a6a9d3d855f4ec92c7bf246e1b34c (patch)
tree46e0d9c15164b2c808fc6a0322b8543c0092892f /tools/xentrace/setsize.c
parent07237aa4f333c3feeb9e11e172213d2d440af4dd (diff)
downloadxen-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/xentrace/setsize.c')
-rw-r--r--tools/xentrace/setsize.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/xentrace/setsize.c b/tools/xentrace/setsize.c
new file mode 100644
index 0000000000..0b5311ea57
--- /dev/null
+++ b/tools/xentrace/setsize.c
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <xenctrl.h>
+
+int main(int argc, char * argv[])
+{
+ unsigned int size;
+ int xc_handle = xc_interface_open();
+
+ if (xc_tbuf_get_size(xc_handle, &size) != 0) {
+ perror("Failure to get tbuf info from Xen. Guess size is 0.");
+ printf("This may mean that tracing is not compiled into xen.\n");
+ exit(1);
+ }
+ else
+ printf("Current tbuf size: 0x%x\n", size);
+
+ if (argc < 2)
+ exit(0);
+
+ size = atoi(argv[1]);
+
+ if (xc_tbuf_set_size(xc_handle, size) != 0) {
+ perror("set_size Hypercall failure");
+ exit(1);
+ }
+
+ if (xc_tbuf_get_size(xc_handle, &size) != 0)
+ perror("Failure to get tbuf info from Xen. Guess size is 0.");
+ else
+ printf("New tbuf size: 0x%x\n", size);
+
+ xc_interface_close(xc_handle);
+ return 0;
+}