.args_type = "name:s,option:b",
.params = "name on|off",
.help = "changes status of a specific trace event",
- .mhandler.cmd = do_change_trace_event_state,
+ .mhandler.cmd = do_trace_event_set_state,
},
STEXI
#ifdef CONFIG_TRACE_SIMPLE
#include "trace.h"
#endif
+#include "trace/control.h"
#include "ui/qemu-spice.h"
//#define DEBUG
}
#ifdef CONFIG_TRACE_SIMPLE
-static void do_change_trace_event_state(Monitor *mon, const QDict *qdict)
+static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
{
const char *tp_name = qdict_get_str(qdict, "name");
bool new_state = qdict_get_bool(qdict, "option");
- int ret = st_change_trace_event_state(tp_name, new_state);
+ int ret = trace_event_set_state(tp_name, new_state);
if (!ret) {
monitor_printf(mon, "unknown event name \"%s\"\n", tp_name);
st_print_trace((FILE *)mon, &monitor_fprintf);
}
-static void do_info_trace_events(Monitor *mon)
+static void do_trace_print_events(Monitor *mon)
{
- st_print_trace_events((FILE *)mon, &monitor_fprintf);
+ trace_print_events((FILE *)mon, &monitor_fprintf);
}
#endif
.args_type = "",
.params = "",
.help = "show available trace-events & their state",
- .mhandler.info = do_info_trace_events,
+ .mhandler.info = do_trace_print_events,
},
#endif
{
#ifndef TRACE_CONTROL_H
#define TRACE_CONTROL_H
-#include <stdbool.h>
+#include "qemu-common.h"
+
+
+/** Print the state of all events. */
+void trace_print_events(FILE *stream, fprintf_function stream_printf);
+/** Set the state of an event.
+ *
+ * @return Whether the state changed.
+ */
+bool trace_event_set_state(const char *name, bool state);
/** Initialize the tracing backend.
#include "trace/control.h"
+void trace_print_events(FILE *stream, fprintf_function stream_printf)
+{
+ fprintf(stderr, "warning: "
+ "cannot print the trace events with the current backend\n");
+ stream_printf(stream, "error: "
+ "operation not supported with the current backend\n");
+}
+
+bool trace_event_set_state(const char *name, bool state)
+{
+ fprintf(stderr, "warning: "
+ "cannot set the state of a trace event with the current backend\n");
+ return false;
+}
+
bool trace_backend_init(const char *file)
{
if (file) {
}
}
-void st_print_trace_events(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...))
+void st_flush_trace_buffer(void)
+{
+ flush_trace_file(true);
+}
+
+void trace_print_events(FILE *stream, fprintf_function stream_printf)
{
unsigned int i;
}
}
-bool st_change_trace_event_state(const char *name, bool enabled)
+bool trace_event_set_state(const char *name, bool state)
{
unsigned int i;
for (i = 0; i < NR_TRACE_EVENTS; i++) {
if (!strcmp(trace_list[i].tp_name, name)) {
- trace_list[i].state = enabled;
+ trace_list[i].state = state;
return true;
}
}
return false;
}
-void st_flush_trace_buffer(void)
-{
- flush_trace_file(true);
-}
-
bool trace_backend_init(const char *file)
{
pthread_t thread;
void trace5(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5);
void trace6(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3, uint64_t x4, uint64_t x5, uint64_t x6);
void st_print_trace(FILE *stream, fprintf_function stream_printf);
-void st_print_trace_events(FILE *stream, fprintf_function stream_printf);
-bool st_change_trace_event_state(const char *tname, bool tstate);
void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
void st_set_trace_file_enabled(bool enable);
bool st_set_trace_file(const char *file);