On Fri, Oct 02, 2026 at 12:45:49PM +0200, Paolo Bonzini wrote:
> On 10/1/26 17:12, Daniel P. Berrangé wrote:
> > If emitting a trace event requires computation for the parameters
> > passed to the probe, the callers should guard that computation
> > with trace_event_by_state_backends(), which is a macro expanding
> > to the a check of the "TRACE_...._DSTATE()" expression. For the
> > log backend this should include a check for LOG_TRACE being
> > present in the configured log level.
> This also needs something for Rust (apologies for the mailer damage):
Ok, I'll test that and include it in a future v3, since I already
sent out v2 before seeing this.
> --- a/scripts/tracetool/backend/log.py
> +++ b/scripts/tracetool/backend/log.py
> @@ -16,7 +16,6 @@
>
>
> PUBLIC = True
> -CHECK_TRACE_EVENT_GET_STATE = True
>
>
> def generate_h_begin(events, group):
> @@ -52,3 +51,9 @@ def generate_rs(event, group):
> ' }',
> fmt=expand_format_string(event.fmt, event.name + " "),
> args=event.args.rust_call_varargs())
> +
> +def generate_rs_backend_dstate(event, group):
> + out(' unsafe { (bindings::qemu_loglevel & bindings::LOG_TRACE) != 0
> && '
> + + 'trace_event_state_is_enabled(_%(event_id)s_DSTATE) } ||',
> + event_id = 'TRACE_' + e.name.upper())
> +
>
> Paolo
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|