diff options
author | Lluís <xscript@gmx.net> | 2011-08-31 20:31:51 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-09-01 10:34:54 +0100 |
commit | 9a82b6a590bd7c845ab9754b34b33ffee982ccb2 (patch) | |
tree | c23b7078b7db55c798577eb28f281873a5d2062c /trace/stderr.c | |
parent | 03727e6a06087dc8f46d5674b4b29262bf7377a4 (diff) |
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>
Diffstat (limited to 'trace/stderr.c')
-rw-r--r-- | trace/stderr.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/trace/stderr.c b/trace/stderr.c new file mode 100644 index 0000000000..7107c4a131 --- /dev/null +++ b/trace/stderr.c @@ -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; +} |