From 40b9cd25f789e02145fda5e1f3fde7e7dd9e3b61 Mon Sep 17 00:00:00 2001 From: Lluís Vilanova Date: Mon, 11 Jul 2016 12:53:46 +0200 Subject: trace: Conditionally trace events based on their per-vCPU state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- scripts/tracetool/format/h.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'scripts/tracetool/format/h.py') diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index 0835406216..3763e9aecb 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) -- cgit 1.4.1