[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/14] trace: Add trace file name command-line optio
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 12/14] trace: Add trace file name command-line option |
Date: |
Thu, 12 Aug 2010 11:36:33 +0100 |
From: Prerna Saxena <address@hidden>
This patch adds an optional command line switch '-trace' to specify the
filename to write traces to, when qemu starts.
Eg, If compiled with the 'simple' trace backend,
address@hidden qemu -trace FILENAME IMAGE
Allows the binary traces to be written to FILENAME instead of the option
set at config-time.
Signed-off-by: Prerna Saxena <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
qemu-options.hx | 11 +++++++++++
vl.c | 18 ++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index db86feb..a0c091f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2234,6 +2234,17 @@ Normally QEMU loads a configuration file from
@var{sysconfdir}/qemu.conf and
@var{sysconfdir}/address@hidden on startup. The @code{-nodefconfig}
option will prevent QEMU from loading these configuration files at startup.
ETEXI
+#ifdef CONFIG_SIMPLE_TRACE
+DEF("trace", HAS_ARG, QEMU_OPTION_trace,
+ "-trace\n"
+ " Specify a trace file to log traces to\n",
+ QEMU_ARCH_ALL)
+STEXI
address@hidden -trace
address@hidden -trace
+Specify a trace file to log output traces to.
+ETEXI
+#endif
HXCOMM This is the last statement. Insert new options before this line!
STEXI
diff --git a/vl.c b/vl.c
index b3e3676..99664e9 100644
--- a/vl.c
+++ b/vl.c
@@ -47,6 +47,10 @@
#include <dirent.h>
#include <netdb.h>
#include <sys/select.h>
+#ifdef CONFIG_SIMPLE_TRACE
+#include "trace.h"
+#endif
+
#ifdef CONFIG_BSD
#include <sys/stat.h>
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ||
defined(__DragonFly__)
@@ -1821,6 +1825,9 @@ int main(int argc, char **argv, char **envp)
int show_vnc_port = 0;
int defconfig = 1;
+#ifdef CONFIG_SIMPLE_TRACE
+ const char *trace_file = NULL;
+#endif
atexit(qemu_run_exit_notifiers);
error_set_progname(argv[0]);
@@ -2590,6 +2597,11 @@ int main(int argc, char **argv, char **envp)
}
xen_mode = XEN_ATTACH;
break;
+#ifdef CONFIG_SIMPLE_TRACE
+ case QEMU_OPTION_trace:
+ trace_file = optarg;
+ break;
+#endif
case QEMU_OPTION_readconfig:
{
int ret = qemu_read_config_file(optarg);
@@ -2633,6 +2645,12 @@ int main(int argc, char **argv, char **envp)
data_dir = CONFIG_QEMU_DATADIR;
}
+#ifdef CONFIG_SIMPLE_TRACE
+ /*
+ * Set the trace file name, if specified.
+ */
+ st_set_trace_file(trace_file);
+#endif
/*
* Default to max_cpus = smp_cpus, in case the user doesn't
* specify a max_cpus value.
--
1.7.1
- [Qemu-devel] [PATCH 00/14] trace: Add static tracing to QEMU, Stefan Hajnoczi, 2010/08/12
- [Qemu-devel] [PATCH 13/14] trace: Add LTTng Userspace Tracer backend, Stefan Hajnoczi, 2010/08/12
- [Qemu-devel] [PATCH 12/14] trace: Add trace file name command-line option,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 07/14] trace: Add simple built-in tracing backend, Stefan Hajnoczi, 2010/08/12
- [Qemu-devel] [PATCH 14/14] trace: Add user documentation, Stefan Hajnoczi, 2010/08/12
- [Qemu-devel] [PATCH 03/14] trace: Trace virtio-blk, multiwrite, and paio_submit, Stefan Hajnoczi, 2010/08/12
- [Qemu-devel] [PATCH 08/14] trace: Support for dynamically enabling/disabling trace events., Stefan Hajnoczi, 2010/08/12