aboutsummaryrefslogtreecommitdiff
path: root/scripts/tracetool/format
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2016-07-11 12:53:46 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-18 18:23:12 +0100
commit40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61 (patch)
treea88b3cbcc13588e5234bddaa84bb2790c743eab5 /scripts/tracetool/format
parent4815185902971c41fcdd700fa1fc3e1d9299900f (diff)
downloadqemu-40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61.zip
qemu-40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61.tar.gz
qemu-40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61.tar.bz2
trace: Conditionally trace events based on their per-vCPU state
Events with the 'vcpu' property are conditionally emitted according to their per-vCPU state. Other events are emitted normally based on their global tracing state. Note that the per-vCPU condition check applies to all tracing backends. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts/tracetool/format')
-rw-r--r--scripts/tracetool/format/h.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 0835406..3763e9a 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -23,21 +23,36 @@ def generate(events, backend):
'#define TRACE__GENERATED_TRACERS_H',
'',
'#include "qemu-common.h"',
+ '#include "trace/control.h"',
'')
backend.generate_begin(events)
for e in events:
+ if "vcpu" in e.properties:
+ trace_cpu = next(iter(e.args))[1]
+ cond = "trace_event_get_vcpu_state(%(cpu)s,"\
+ " TRACE_%(id)s,"\
+ " TRACE_VCPU_%(id)s)"\
+ % dict(
+ cpu=trace_cpu,
+ id=e.name.upper())
+ else:
+ cond = "true"
+
out('',
'static inline void %(api)s(%(args)s)',
'{',
+ ' if (%(cond)s) {',
api=e.api(),
- args=e.args)
+ args=e.args,
+ cond=cond)
if "disable" not in e.properties:
backend.generate(e)
- out('}')
+ out(' }',
+ '}')
backend.generate_end(events)