From: George Dunlap <George.Dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 3/4] xentrace: Disable tracing by default on exit
Date: Mon, 25 Feb 2008 16:59:20 +0000 [thread overview]
Message-ID: <47C2F3E8.4050503@eu.citrix.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 03.xentrace.disable-tracing.patch --]
[-- Type: text/x-patch, Size: 3023 bytes --]
xentrace: Disable tracing by default on exit
Includes an option to disable this behavior.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 0852863cb87e tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Mon Feb 25 15:53:46 2008 +0000
+++ b/tools/xentrace/xentrace.c Mon Feb 25 15:57:59 2008 +0000
@@ -55,7 +55,8 @@ typedef struct settings_st {
uint32_t cpu_mask;
unsigned long tbuf_size;
unsigned long disk_rsvd;
- uint8_t discard:1;
+ uint8_t discard:1,
+ disable_tracing:1;
} settings_t;
settings_t opts;
@@ -156,6 +157,28 @@ void write_buffer(unsigned int cpu, unsi
fail:
PERROR("Failed to write trace data");
exit(EXIT_FAILURE);
+}
+
+static void disable_tbufs(void)
+{
+ int xc_handle = xc_interface_open();
+ int ret;
+
+ if ( xc_handle < 0 )
+ {
+ perror("Couldn't open xc handle to disable tbufs.");
+ goto out;
+ }
+
+ ret = xc_tbuf_disable(xc_handle);
+
+ if ( ret != 0 )
+ {
+ perror("Couldn't disable trace buffers");
+ }
+
+out:
+ xc_interface_close(xc_handle);
}
static void get_tbufs(unsigned long *mfn, unsigned long *size)
@@ -465,6 +488,9 @@ int monitor_tbufs(int outfd)
wait_for_event_or_timeout(opts.poll_sleep);
}
+ if(opts.disable_tracing)
+ disable_tbufs();
+
/* cleanup */
free(meta);
free(data);
@@ -503,6 +529,11 @@ void usage(void)
" this argument will be ignored.\n" \
" -D --discard-buffers Discard all records currently in the trace\n" \
" buffers before beginning.\n" \
+" -x --dont-disable-tracing\n" \
+" By default, xentrace will disable tracing when\n" \
+" 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" \
" -?, --help Show this message\n" \
" -V, --version Print program version\n" \
"\n" \
@@ -573,6 +604,7 @@ void parse_args(int argc, char **argv)
{ "trace-buf-size", required_argument, 0, 'S' },
{ "reserve-disk-space", required_argument, 0, 'r' },
{ "discard-buffers", no_argument, 0, 'D' },
+ { "dont-disable-tracing", no_argument, 0, 'x' },
{ "help", no_argument, 0, '?' },
{ "version", no_argument, 0, 'V' },
{ 0, 0, 0, 0 }
@@ -610,6 +642,10 @@ void parse_args(int argc, char **argv)
case 'r': /* Disk-space reservation */
opts.disk_rsvd = argtol(optarg, 0);
+ break;
+
+ case 'x': /* Don't disable tracing */
+ opts.disable_tracing = 0;
break;
default:
@@ -640,6 +676,7 @@ int main(int argc, char **argv)
opts.evt_mask = 0;
opts.cpu_mask = 0;
opts.disk_rsvd = 0;
+ opts.disable_tracing = 1;
parse_args(argc, argv);
[-- 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 16:59 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=47C2F3E8.4050503@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.