aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xentrace/xentrace.c
diff options
context:
space:
mode:
authorGeorge Dunlap <gdunlap@xensource.com>2007-02-27 06:01:35 -0500
committerGeorge Dunlap <gdunlap@xensource.com>2007-02-27 06:01:35 -0500
commitf186b11e236aa0e3786a5188ec035341aed2e403 (patch)
treeee5860926bd8934ccd2fa0bb173b2e8b5434751b /tools/xentrace/xentrace.c
parent6bd6a1390ef9d30ace350ec8f5d51515b67b62e1 (diff)
downloadxen-f186b11e236aa0e3786a5188ec035341aed2e403.tar.gz
xen-f186b11e236aa0e3786a5188ec035341aed2e403.tar.bz2
xen-f186b11e236aa0e3786a5188ec035341aed2e403.zip
[TOOLS] Added option to xentrace to discard records in the buffer
before beginning the trace. Signed-off-by: George Dunlap <gdunlap@xensource.com>
Diffstat (limited to 'tools/xentrace/xentrace.c')
-rw-r--r--tools/xentrace/xentrace.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index d37d86d8b6..d0cea17c2e 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -56,6 +56,7 @@ typedef struct settings_st {
uint32_t evt_mask;
uint32_t cpu_mask;
unsigned long tbuf_size;
+ int discard:1;
} settings_t;
settings_t opts;
@@ -307,6 +308,13 @@ int monitor_tbufs(FILE *logfile)
meta = init_bufs_ptrs(tbufs_mapped, num, size);
data = init_rec_ptrs(meta, num);
+ if(opts.discard) {
+ for ( i = 0; (i < num) ; i++ )
+ {
+ meta[i]->cons = meta[i]->prod;
+ }
+ }
+
/* now, scan buffers for events */
while ( !interrupted )
{
@@ -413,6 +421,12 @@ error_t cmd_parser(int key, char *arg, struct argp_state *state)
}
break;
+ case 'D': /* Discard traces currently in the buffer before beginning */
+ {
+ opts.discard=1;
+ }
+ break;
+
case ARGP_KEY_ARG:
{
if ( state->arg_num == 0 )
@@ -458,6 +472,11 @@ const struct argp_option cmd_opts[] =
"N.B. that the trace buffer cannot be resized. If it has "
"already been set this boot cycle, this argument will be ignored." },
+ { .name = "discard-buffers", .key='D', .arg=NULL,
+ .flags=OPTION_ARG_OPTIONAL,
+ .doc = "Discard all records currently in the trace buffers before "
+ " beginning." },
+
{0}
};