All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <George.Dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 4/4] xentrace: Add a time parameter
Date: Mon, 25 Feb 2008 17:00:11 +0000	[thread overview]
Message-ID: <47C2F41B.2090007@eu.citrix.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 04.xentrace.time-parameter.patch --]
[-- Type: text/x-patch, Size: 2503 bytes --]

xentrace: Add a time parameter
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 6c15f46f69b9 tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c	Mon Feb 25 15:58:39 2008 +0000
+++ b/tools/xentrace/xentrace.c	Mon Feb 25 16:13:32 2008 +0000
@@ -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();
         }
@@ -659,7 +666,6 @@ void parse_args(int argc, char **argv)
 
     opts.outfile = argv[optind];
 }
-
 
 /* *BSD has no O_LARGEFILE */
 #ifndef O_LARGEFILE
@@ -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);
 
@@ -692,6 +699,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,
@@ -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);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2008-02-25 17:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C2F41B.2090007@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.