aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorPrerna Saxena <prerna@linux.vnet.ibm.com>2010-06-24 17:04:53 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2010-09-09 16:22:44 -0500
commit22890ab5e825601f4c3d5a1a6b4197904e5d1fee (patch)
treea2d75e9328a15bb4a0fc589015f8908f26b25282 /monitor.c
parent26f7227bfe9a9abee3fe5190cbfc35dd876e06d9 (diff)
trace: Support for dynamically enabling/disabling trace events
This patch adds support for dynamically enabling/disabling of trace events. This is done by internally maintaining each trace event's state, and permitting logging of data from a trace event only if it is in an 'active' state. Monitor commands added : 1) info trace-events : to view all available trace events and their state. 2) trace-event NAME on|off : to enable/disable data logging from a given trace event. Eg, trace-event paio_submit off disables logging of data when paio_submit is hit. By default, all trace-events are disabled. One can enable desired trace-events via the monitor. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> trace: Monitor command 'info trace' Monitor command 'info trace' to display contents of trace buffer Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> trace: Remove monitor.h dependency from simpletrace User-mode targets don't have a monitor so the simple trace backend currently does not build on those targets. This patch abstracts the monitor printing interface so there is no direct coupling between simpletrace and the monitor. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index e27f8d8d3b..0e69bc8b9d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -56,6 +56,9 @@
#include "json-parser.h"
#include "osdep.h"
#include "exec-all.h"
+#ifdef CONFIG_SIMPLE_TRACE
+#include "trace.h"
+#endif
//#define DEBUG
//#define DEBUG_COMPLETION
@@ -539,6 +542,15 @@ static void do_help_cmd(Monitor *mon, const QDict *qdict)
help_cmd(mon, qdict_get_try_str(qdict, "name"));
}
+#ifdef CONFIG_SIMPLE_TRACE
+static void do_change_trace_event_state(Monitor *mon, const QDict *qdict)
+{
+ const char *tp_name = qdict_get_str(qdict, "name");
+ bool new_state = qdict_get_bool(qdict, "option");
+ st_change_trace_event_state(tp_name, new_state);
+}
+#endif
+
static void user_monitor_complete(void *opaque, QObject *ret_data)
{
MonitorCompletionData *data = (MonitorCompletionData *)opaque;
@@ -938,6 +950,18 @@ static void do_info_cpu_stats(Monitor *mon)
}
#endif
+#if defined(CONFIG_SIMPLE_TRACE)
+static void do_info_trace(Monitor *mon)
+{
+ st_print_trace((FILE *)mon, &monitor_fprintf);
+}
+
+static void do_info_trace_events(Monitor *mon)
+{
+ st_print_trace_events((FILE *)mon, &monitor_fprintf);
+}
+#endif
+
/**
* do_quit(): Quit QEMU execution
*/
@@ -2594,6 +2618,22 @@ static const mon_cmd_t info_cmds[] = {
.help = "show roms",
.mhandler.info = do_info_roms,
},
+#if defined(CONFIG_SIMPLE_TRACE)
+ {
+ .name = "trace",
+ .args_type = "",
+ .params = "",
+ .help = "show current contents of trace buffer",
+ .mhandler.info = do_info_trace,
+ },
+ {
+ .name = "trace-events",
+ .args_type = "",
+ .params = "",
+ .help = "show available trace-events & their state",
+ .mhandler.info = do_info_trace_events,
+ },
+#endif
{
.name = NULL,
},