Browse Source
Adds support to compile QEMU with multiple tracing backends at the same time. For example, you can compile QEMU with: $ ./configure --enable-trace-backends=ftrace,dtrace Where 'ftrace' can be handy for having an in-flight record of events, and 'dtrace' can be later used to extract more information from the system. This patch allows having both available without recompiling QEMU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>pull/12/head
committed by
Stefan Hajnoczi
20 changed files with 153 additions and 234 deletions
@ -1,40 +0,0 @@ |
|||
/*
|
|||
* Default implementation for backend initialization from commandline. |
|||
* |
|||
* Copyright (C) 2011-2012 Lluís Vilanova <vilanova@ac.upc.edu> |
|||
* |
|||
* This work is licensed under the terms of the GNU GPL, version 2. See |
|||
* the COPYING file in the top-level directory. |
|||
*/ |
|||
|
|||
#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"); |
|||
} |
|||
|
|||
void trace_event_set_state_dynamic_backend(TraceEvent *ev, bool state) |
|||
{ |
|||
fprintf(stderr, "warning: " |
|||
"cannot set the state of a trace event with the current backend\n"); |
|||
} |
|||
|
|||
bool trace_backend_init(const char *events, const char *file) |
|||
{ |
|||
if (events) { |
|||
fprintf(stderr, "error: -trace events=...: " |
|||
"option not supported by the selected tracing backend\n"); |
|||
return false; |
|||
} |
|||
if (file) { |
|||
fprintf(stderr, "error: -trace file=...: " |
|||
"option not supported by the selected tracing backend\n"); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
@ -1,10 +1,15 @@ |
|||
#ifndef TRACE_FTRACE_H |
|||
#define TRACE_FTRACE_H |
|||
|
|||
#include <stdbool.h> |
|||
|
|||
|
|||
#define MAX_TRACE_STRLEN 512 |
|||
#define _STR(x) #x |
|||
#define STR(x) _STR(x) |
|||
|
|||
extern int trace_marker_fd; |
|||
|
|||
bool ftrace_init(void); |
|||
|
|||
#endif /* ! TRACE_FTRACE_H */ |
|||
|
|||
@ -1,30 +0,0 @@ |
|||
#include "trace.h" |
|||
#include "trace/control.h" |
|||
|
|||
|
|||
void trace_print_events(FILE *stream, fprintf_function stream_printf) |
|||
{ |
|||
TraceEventID i; |
|||
|
|||
for (i = 0; i < trace_event_count(); i++) { |
|||
TraceEvent *ev = trace_event_id(i); |
|||
stream_printf(stream, "%s [Event ID %u] : state %u\n", |
|||
trace_event_get_name(ev), i, trace_event_get_state_dynamic(ev)); |
|||
} |
|||
} |
|||
|
|||
void trace_event_set_state_dynamic_backend(TraceEvent *ev, bool state) |
|||
{ |
|||
ev->dstate = state; |
|||
} |
|||
|
|||
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; |
|||
} |
|||
Loading…
Reference in new issue