mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
[TOOLS] Added option to xentrace to discard records in the buffer
before beginning the trace. Signed-off-by: George Dunlap <gdunlap@xensource.com>
This commit is contained in:
1 parent
6bd6a1390e
commit
f186b11e23
1 file changed
+19
@@ -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}
|
||||
};
|
||||
|
||||
|
||||