diff options
| author | Tanish Desai <tanishdesai37@gmail.com> | 2025-09-29 17:49:28 +0200 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2025-10-01 11:22:07 -0400 |
| commit | 809caa0d40a853144c02456737ed1e47859b0308 (patch) | |
| tree | 4e0ea212454ab7e5e6e92a50972b9cba499a1d3e /scripts/tracetool/format | |
| parent | 02d4a4a674d45d41c9afd1fd161c14eca81f7a86 (diff) | |
| download | focaccia-qemu-809caa0d40a853144c02456737ed1e47859b0308.tar.gz focaccia-qemu-809caa0d40a853144c02456737ed1e47859b0308.zip | |
tracetool: add CHECK_TRACE_EVENT_GET_STATE
Add a new attribute CHECK_TRACE_EVENT_GET_STATE to the backends. When present and True, the code generated by the generate function is wrapped in a conditional that checks whether the event is enabled; this removes the need for repeating the same conditional in multiple backends. Signed-off-by: Tanish Desai <tanishdesai37@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20250929154938.594389-7-pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts/tracetool/format')
| -rw-r--r-- | scripts/tracetool/format/h.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index be7f32e67b..dd58713a15 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -55,7 +55,6 @@ def generate(events, backend, group): out(' false)') - # tracer without checks out('', 'static inline void %(api)s(%(args)s)', '{', @@ -63,11 +62,17 @@ def generate(events, backend, group): args=e.args) if "disable" not in e.properties: - backend.generate(e, group) - + backend.generate(e, group, check_trace_event_get_state=False) + + if backend.check_trace_event_get_state: + event_id = 'TRACE_' + e.name.upper() + cond = "trace_event_get_state(%s)" % event_id + out(' if (%(cond)s) {', + cond=cond) + backend.generate(e, group, check_trace_event_get_state=True) + out(' }') out('}') - backend.generate_end(events, group) out('#endif /* TRACE_%s_GENERATED_TRACERS_H */' % group.upper()) |