summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLluís <xscript@gmx.net>2011-08-31 20:31:51 +0200
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2011-09-01 10:34:54 +0100
commit9a82b6a590bd7c845ab9754b34b33ffee982ccb2 (patch)
treec23b7078b7db55c798577eb28f281873a5d2062c /scripts
parent03727e6a06087dc8f46d5674b4b29262bf7377a4 (diff)
downloadqemu-9a82b6a590bd7c845ab9754b34b33ffee982ccb2.tar.gz
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 'scripts')
-rwxr-xr-xscripts/tracetool33
1 files changed, 28 insertions, 5 deletions
diff --git a/scripts/tracetool b/scripts/tracetool
index c740080ebb..743d246289 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -241,7 +241,12 @@ linetoh_begin_stderr()
{
cat <<EOF
#include <stdio.h>
+#include "trace/stderr.h"
+
+extern TraceEvent trace_list[];
EOF
+
+ stderr_event_num=0
}
linetoh_stderr()
@@ -260,29 +265,47 @@ linetoh_stderr()
cat <<EOF
static inline void trace_$name($args)
{
- fprintf(stderr, "$name $fmt\n" $argnames);
+ if (trace_list[$stderr_event_num].state != 0) {
+ fprintf(stderr, "$name $fmt\n" $argnames);
+ }
}
EOF
+ stderr_event_num=$((stderr_event_num + 1))
+
}
linetoh_end_stderr()
{
-return
+ cat <<EOF
+#define NR_TRACE_EVENTS $stderr_event_num
+EOF
}
linetoc_begin_stderr()
{
-return
+ cat <<EOF
+#include "trace.h"
+
+TraceEvent trace_list[] = {
+EOF
+ stderr_event_num=0
}
linetoc_stderr()
{
-return
+ local name
+ name=$(get_name "$1")
+ cat <<EOF
+{.tp_name = "$name", .state=0},
+EOF
+ stderr_event_num=$(($stderr_event_num + 1))
}
linetoc_end_stderr()
{
-return
+ cat <<EOF
+};
+EOF
}
#END OF STDERR