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):

--- 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


Reply via email to