Daniel P Berrange writes: [...] > diff --git a/scripts/tracetool/format/events_c.py > b/scripts/tracetool/format/events_c.py > index 9203377..bab6404 100644 > --- a/scripts/tracetool/format/events_c.py > +++ b/scripts/tracetool/format/events_c.py > @@ -25,7 +25,10 @@ def generate(events, backend): > '#include "trace/control.h"', > '') > - out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {') > + out('uint16_t dstate[TRACE_EVENT_COUNT];') > + out('bool dstate_init[TRACE_EVENT_COUNT];') > + > + out('static TraceEvent trace_events[TRACE_EVENT_COUNT] = {') > for e in events: > if "vcpu" in e.properties:
I'd rather keep them as 'trace_events_dstate' and 'trace_events_dstate_init' if most references are auto-generated. Or maybe I just missed something. Also, maybe we should just try to get rid of the dstate_init structure. Only vcpu events need late initialization, which could be something like: trace_events_enabled_count--; dstate[ev->id]--; trace_event_set_state_dynamic(dstate, ev, true); Non-vcpu events shouldn't need late initialization. [...] > diff --git a/stubs/trace-control.c b/stubs/trace-control.c > index fe59836..31566c2 100644 > --- a/stubs/trace-control.c > +++ b/stubs/trace-control.c > @@ -11,16 +11,12 @@ > #include "trace/control.h" > -void trace_event_set_state_dynamic(TraceEvent *ev, bool state) > +void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool > state) > { > - TraceEventID id; > assert(trace_event_get_state_static(ev)); > - id = trace_event_get_id(ev); > - trace_events_enabled_count += state - trace_events_dstate[id]; > - trace_events_dstate[id] = state; > } Should not be empty (here, stub means it's not target code). Cheers, Lluis