of trace events. Marking trace events disabled by default saves the user
from having to manually disable noisy trace events.
+== Generic interface and monitor commands ==
+
+You can programmatically query and control the dynamic state of trace events
+through a backend-agnostic interface:
+
+* trace_print_events
+
+* trace_event_set_state
+ Enables or disables trace events at runtime inside QEMU.
+ The function returns "true" if the state of the event has been successfully
+ changed, or "false" otherwise:
+
+ #include "trace/control.h"
+
+ trace_event_set_state("virtio_irq", true); /* enable */
+ [...]
+ trace_event_set_state("virtio_irq", false); /* disable */
+
+Note that some of the backends do not provide an implementation for this
+interface, in which case QEMU will just print a warning.
+
+This functionality is also provided through monitor commands:
+
+* info trace-events
+ View available trace events and their state. State 1 means enabled, state 0
+ means disabled.
+
+* trace-event NAME on|off
+ Enable/disable a given trace event.
+
== Trace backends ==
The "tracetool" script automates tedious trace event code generation and also
flushed and emptied. This means the 'info trace' will display few or no
entries if the buffer has just been flushed.
-* info trace-events
- View available trace events and their state. State 1 means enabled, state 0
- means disabled.
-
-* trace-event NAME on|off
- Enable/disable a given trace event.
-
* trace-file on|off|flush|set <path>
Enable/disable/flush the trace file or set the trace file name.
-==== Enabling/disabling trace events programmatically ====
-
-The st_change_trace_event_state() function can be used to enable or disable trace
-events at runtime inside QEMU:
-
- #include "trace.h"
-
- st_change_trace_event_state("virtio_irq", true); /* enable */
- [...]
- st_change_trace_event_state("virtio_irq", false); /* disable */
-
==== Analyzing trace files ====
The "simple" backend produces binary trace files that can be formatted with the
Output logs to @var{filename}.
ETEXI
-#ifdef CONFIG_TRACE_SIMPLE
{
.name = "trace-event",
.args_type = "name:s,option:b",
changes status of a trace event
ETEXI
+#if defined(CONFIG_SIMPLE_TRACE)
{
.name = "trace-file",
.args_type = "op:s?,arg:F?",
STEXI
@item info trace
show contents of trace buffer
+ETEXI
+#endif
+
+STEXI
@item info trace-events
show available trace events and their state
ETEXI
-#endif
STEXI
@end table
#include "json-parser.h"
#include "osdep.h"
#include "cpu.h"
+#include "trace/control.h"
#ifdef CONFIG_TRACE_SIMPLE
-#include "trace.h"
+#include "trace/simple.h"
#endif
#include "trace/control.h"
#include "ui/qemu-spice.h"
help_cmd(mon, qdict_get_try_str(qdict, "name"));
}
-#ifdef CONFIG_TRACE_SIMPLE
static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
{
const char *tp_name = qdict_get_str(qdict, "name");
}
}
+#ifdef CONFIG_SIMPLE_TRACE
static void do_trace_file(Monitor *mon, const QDict *qdict)
{
const char *op = qdict_get_try_str(qdict, "op");
{
st_print_trace((FILE *)mon, &monitor_fprintf);
}
+#endif
static void do_trace_print_events(Monitor *mon)
{
trace_print_events((FILE *)mon, &monitor_fprintf);
}
-#endif
/**
* do_quit(): Quit QEMU execution
.help = "show current contents of trace buffer",
.mhandler.info = do_info_trace,
},
+#endif
{
.name = "trace-events",
.args_type = "",
.help = "show available trace-events & their state",
.mhandler.info = do_trace_print_events,
},
-#endif
{
.name = NULL,
},