mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
trace: [stderr] add support for dynamically enabling/disabling events
Uses the generic interface provided in "trace/control.h" in order to provide a programmatic interface as well as command line and monitor controls. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
This commit is contained in:
parent
03727e6a06
commit
9a82b6a590
7 changed files with 81 additions and 11 deletions
37
trace/stderr.c
Normal file
37
trace/stderr.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include "trace.h"
|
||||
#include "trace/control.h"
|
||||
|
||||
|
||||
void trace_print_events(FILE *stream, fprintf_function stream_printf)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < NR_TRACE_EVENTS; i++) {
|
||||
stream_printf(stream, "%s [Event ID %u] : state %u\n",
|
||||
trace_list[i].tp_name, i, trace_list[i].state);
|
||||
}
|
||||
}
|
||||
|
||||
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 = state;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool trace_backend_init(const char *events, const char *file)
|
||||
{
|
||||
if (file) {
|
||||
fprintf(stderr, "error: -trace file=...: "
|
||||
"option not supported by the selected tracing backend\n");
|
||||
return false;
|
||||
}
|
||||
trace_backend_init_events(events);
|
||||
return true;
|
||||
}
|
11
trace/stderr.h
Normal file
11
trace/stderr.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef TRACE_STDERR_H
|
||||
#define TRACE_STDERR_H
|
||||
|
||||
typedef uint64_t TraceEventID;
|
||||
|
||||
typedef struct {
|
||||
const char *tp_name;
|
||||
bool state;
|
||||
} TraceEvent;
|
||||
|
||||
#endif /* ! TRACE_STDERR_H */
|
Loading…
Add table
Add a link
Reference in a new issue