aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xentrace
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-02-26 14:39:26 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-02-26 14:39:26 +0000
commit2d28da91f9d164032b68e8eeff31f42c3773174e (patch)
tree47627fa2460780f60ddef905dbdf10e432cd2600 /tools/xentrace
parent1b5c30396246c7ba5bf66dccc7ba89b033a7a7e4 (diff)
downloadxen-2d28da91f9d164032b68e8eeff31f42c3773174e.tar.gz
xen-2d28da91f9d164032b68e8eeff31f42c3773174e.tar.bz2
xen-2d28da91f9d164032b68e8eeff31f42c3773174e.zip
xentrace: Add a time parameter
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Diffstat (limited to 'tools/xentrace')
-rw-r--r--tools/xentrace/xentrace.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index a6eae80b8e..526a69f73d 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -55,6 +55,7 @@ typedef struct settings_st {
uint32_t cpu_mask;
unsigned long tbuf_size;
unsigned long disk_rsvd;
+ unsigned long timeout;
uint8_t discard:1,
disable_tracing:1;
} settings_t;
@@ -534,6 +535,7 @@ void usage(void)
" it exits. Selecting this option will tell it to\n" \
" keep tracing on. Traces will be collected in\n" \
" Xen's trace buffers until they become full.\n" \
+" -T --time-interval=s Run xentrace for s seconds and quit.\n" \
" -?, --help Show this message\n" \
" -V, --version Print program version\n" \
"\n" \
@@ -603,6 +605,7 @@ void parse_args(int argc, char **argv)
{ "evt-mask", required_argument, 0, 'e' },
{ "trace-buf-size", required_argument, 0, 'S' },
{ "reserve-disk-space", required_argument, 0, 'r' },
+ { "time-interval", required_argument, 0, 'T' },
{ "discard-buffers", no_argument, 0, 'D' },
{ "dont-disable-tracing", no_argument, 0, 'x' },
{ "help", no_argument, 0, '?' },
@@ -648,6 +651,10 @@ void parse_args(int argc, char **argv)
opts.disable_tracing = 0;
break;
+ case 'T':
+ opts.timeout = argtol(optarg, 0);
+ break;
+
default:
usage();
}
@@ -660,7 +667,6 @@ void parse_args(int argc, char **argv)
opts.outfile = argv[optind];
}
-
/* *BSD has no O_LARGEFILE */
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@@ -677,6 +683,7 @@ int main(int argc, char **argv)
opts.cpu_mask = 0;
opts.disk_rsvd = 0;
opts.disable_tracing = 1;
+ opts.timeout = 0;
parse_args(argc, argv);
@@ -693,6 +700,9 @@ int main(int argc, char **argv)
if ( opts.cpu_mask != 0 )
set_mask(opts.cpu_mask, 1);
+ if ( opts.timeout != 0 )
+ alarm(opts.timeout);
+
if ( opts.outfile )
outfd = open(opts.outfile,
O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE,
@@ -717,6 +727,7 @@ int main(int argc, char **argv)
sigaction(SIGHUP, &act, NULL);
sigaction(SIGTERM, &act, NULL);
sigaction(SIGINT, &act, NULL);
+ sigaction(SIGALRM, &act, NULL);
ret = monitor_tbufs(outfd);