ia64/xen-unstable

changeset 14154:ffe7e8ef2c98

[TOOLS] Added option to xentrace to discard records in the buffer
before beginning the trace.

Signed-off-by: George Dunlap <gdunlap@xensource.com>
author George Dunlap <gdunlap@xensource.com>
date Tue Feb 27 06:01:35 2007 -0500 (2007-02-27)
parents c2e7bacf0919
children 9abcc909befc
files tools/xentrace/xentrace.c
line diff
     1.1 --- a/tools/xentrace/xentrace.c	Tue Feb 27 01:52:27 2007 +0000
     1.2 +++ b/tools/xentrace/xentrace.c	Tue Feb 27 06:01:35 2007 -0500
     1.3 @@ -56,6 +56,7 @@ typedef struct settings_st {
     1.4      uint32_t evt_mask;
     1.5      uint32_t cpu_mask;
     1.6      unsigned long tbuf_size;
     1.7 +    int discard:1;
     1.8  } settings_t;
     1.9  
    1.10  settings_t opts;
    1.11 @@ -307,6 +308,13 @@ int monitor_tbufs(FILE *logfile)
    1.12      meta  = init_bufs_ptrs(tbufs_mapped, num, size);
    1.13      data  = init_rec_ptrs(meta, num);
    1.14  
    1.15 +    if(opts.discard) {
    1.16 +        for ( i = 0; (i < num) ; i++ )
    1.17 +        {
    1.18 +	    meta[i]->cons = meta[i]->prod;
    1.19 +        }
    1.20 +    }
    1.21 +
    1.22      /* now, scan buffers for events */
    1.23      while ( !interrupted )
    1.24      {
    1.25 @@ -413,6 +421,12 @@ error_t cmd_parser(int key, char *arg, s
    1.26      }
    1.27      break;
    1.28  
    1.29 +    case 'D': /* Discard traces currently in the buffer before beginning */
    1.30 +    {
    1.31 +        opts.discard=1;
    1.32 +    }
    1.33 +    break;
    1.34 +
    1.35      case ARGP_KEY_ARG:
    1.36      {
    1.37          if ( state->arg_num == 0 )
    1.38 @@ -458,6 +472,11 @@ const struct argp_option cmd_opts[] =
    1.39        "N.B. that the trace buffer cannot be resized.  If it has "
    1.40        "already been set this boot cycle, this argument will be ignored." },
    1.41  
    1.42 +    { .name = "discard-buffers", .key='D', .arg=NULL,
    1.43 +      .flags=OPTION_ARG_OPTIONAL,
    1.44 +      .doc = "Discard all records currently in the trace buffers before "
    1.45 +      " beginning." },
    1.46 +
    1.47      {0}
    1.48  };
    1.49