diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2010-07-13 09:26:33 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-09-09 16:22:44 -0500 |
commit | e5091d76399295aa5be86a16b76595a3029a89ca (patch) | |
tree | 3fd158bd3116cd691cde01854b8f72413f7b148e /monitor.c | |
parent | de6e310d2ea0f249736077857db73bbe5728b097 (diff) | |
download | qemu-e5091d76399295aa5be86a16b76595a3029a89ca.tar.gz qemu-e5091d76399295aa5be86a16b76595a3029a89ca.tar.bz2 qemu-e5091d76399295aa5be86a16b76595a3029a89ca.zip |
trace: Add trace-file command to open/close/flush trace file
This patch adds the trace-file command:
trace-file [on|off|flush]
Open, close, or flush the trace file. If no argument is given,
the status of the trace file is displayed.
The trace file is turned on by default but is only written out when the
trace buffer becomes full. The flush operation can be used to force
write out at any time.
Turning off the trace file does not change the state of trace events;
tracing will continue to the trace buffer. When the trace file is off,
use "info trace" to display the contents of the trace buffer in memory.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This commit also contains the trace-file sub-command from the following
commit:
commit 5ce8d1a957afae2c52ad748944ce72848ccf57bd
Author: Prerna Saxena <prerna@linux.vnet.ibm.com>
Date: Wed Aug 4 16:23:54 2010 +0530
trace: Add options to specify trace file name at startup and runtime
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,
[temp@system]$ qemu -trace FILENAME IMAGE
Allows the binary traces to be written to FILENAME instead of the option
set at config-time.
Also, this adds monitor sub-command 'set' to trace-file commands to
dynamically change trace log file at runtime.
Eg,
(qemu)trace-file set FILENAME
This allows one to set trace outputs to FILENAME from the default
specified at startup.
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -549,6 +549,29 @@ static void do_change_trace_event_state(Monitor *mon, const QDict *qdict) bool new_state = qdict_get_bool(qdict, "option"); st_change_trace_event_state(tp_name, new_state); } + +static void do_trace_file(Monitor *mon, const QDict *qdict) +{ + const char *op = qdict_get_try_str(qdict, "op"); + const char *arg = qdict_get_try_str(qdict, "arg"); + + if (!op) { + st_print_trace_file_status((FILE *)mon, &monitor_fprintf); + } else if (!strcmp(op, "on")) { + st_set_trace_file_enabled(true); + } else if (!strcmp(op, "off")) { + st_set_trace_file_enabled(false); + } else if (!strcmp(op, "flush")) { + st_flush_trace_buffer(); + } else if (!strcmp(op, "set")) { + if (arg) { + st_set_trace_file(arg); + } + } else { + monitor_printf(mon, "unexpected argument \"%s\"\n", op); + help_cmd(mon, "trace-file"); + } +} #endif static void user_monitor_complete(void *opaque, QObject *ret_data) |