Daniel P Berrange writes:
> On Wed, Aug 10, 2016 at 04:00:17PM +0200, Lluís Vilanova wrote:
>> 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.
> Later patches rename this again, giving it a custom prefix for each
> group
I saw them later, sorry. But I still think these too should be renamed, to make
it clear it's related to tracing.
>> 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.
> I'd rather not try to refactor that logic at the same time - it could
> be done as a later patch, or if you want to submit a patch to fix that
> I can rebase on top of it.
I can do that.
>> [...]
>> > 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).
> Oh hmm, for qemu-img & friends, i geuss
Exactly.
Cheers,
Lluis