Lluís | 9a82b6a | 2011-08-31 20:31:51 +0200 | [diff] [blame] | 1 | #include "trace.h" |
| 2 | #include "trace/control.h" |
| 3 | |
| 4 | |
| 5 | void trace_print_events(FILE *stream, fprintf_function stream_printf) |
| 6 | { |
Lluís Vilanova | c6f18b9 | 2013-03-05 14:48:00 +0100 | [diff] [blame] | 7 | TraceEventID i; |
Lluís | 9a82b6a | 2011-08-31 20:31:51 +0200 | [diff] [blame] | 8 | |
Lluís Vilanova | c6f18b9 | 2013-03-05 14:48:00 +0100 | [diff] [blame] | 9 | for (i = 0; i < trace_event_count(); i++) { |
| 10 | TraceEvent *ev = trace_event_id(i); |
Lluís | 9a82b6a | 2011-08-31 20:31:51 +0200 | [diff] [blame] | 11 | stream_printf(stream, "%s [Event ID %u] : state %u\n", |
Lluís Vilanova | c6f18b9 | 2013-03-05 14:48:00 +0100 | [diff] [blame] | 12 | trace_event_get_name(ev), i, trace_event_get_state_dynamic(ev)); |
Lluís | 9a82b6a | 2011-08-31 20:31:51 +0200 | [diff] [blame] | 13 | } |
| 14 | } |
| 15 | |
Lluís Vilanova | c6f18b9 | 2013-03-05 14:48:00 +0100 | [diff] [blame] | 16 | void trace_event_set_state_dynamic_backend(TraceEvent *ev, bool state) |
Lluís | 9a82b6a | 2011-08-31 20:31:51 +0200 | [diff] [blame] | 17 | { |
Lluís Vilanova | c6f18b9 | 2013-03-05 14:48:00 +0100 | [diff] [blame] | 18 | ev->dstate = state; |
Lluís | 9a82b6a | 2011-08-31 20:31:51 +0200 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | bool trace_backend_init(const char *events, const char *file) |
| 22 | { |
| 23 | if (file) { |
| 24 | fprintf(stderr, "error: -trace file=...: " |
| 25 | "option not supported by the selected tracing backend\n"); |
| 26 | return false; |
| 27 | } |
| 28 | trace_backend_init_events(events); |
| 29 | return true; |
| 30 | } |