[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 13/18] trace: dynamically allocate event IDs
From: |
Lluís Vilanova |
Subject: |
Re: [Qemu-devel] [PATCH v3 13/18] trace: dynamically allocate event IDs at runtime |
Date: |
Tue, 20 Sep 2016 19:45:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Daniel P Berrange writes:
> On Mon, Sep 19, 2016 at 08:05:12PM +0200, Lluís Vilanova wrote:
>> Daniel P Berrange writes:
>>
>> > Instead of having the code generator assign event IDs and
>> > event VCPU IDs, assign them when the events are registered
>> > at runtime. This will allow us allow code to be generated
>> > from individual trace-events without having to figure out
>> > globally unique numbering at build time.
>>
>> > Signed-off-by: Daniel P. Berrange <address@hidden>
>> > ---
>> > scripts/tracetool/format/events_c.py | 10 ++--------
>> > scripts/tracetool/format/events_h.py | 7 -------
>> > trace/control.c | 11 ++++++++++-
>> > 3 files changed, 12 insertions(+), 16 deletions(-)
>>
>> > diff --git a/scripts/tracetool/format/events_c.py
>> > b/scripts/tracetool/format/events_c.py
>> > index 7f00b50..1b5790d 100644
>> > --- a/scripts/tracetool/format/events_c.py
>> > +++ b/scripts/tracetool/format/events_c.py
>> > @@ -28,25 +28,19 @@ def generate(events, backend):
>> > for e in events:
>> > out('uint16_t %s;' % e.api(e.QEMU_DSTATE))
>>
>> > - next_id = 0
>> > - next_vcpu_id = 0
>> > for e in events:
>> > - id = next_id
>> > - next_id += 1
>> > if "vcpu" in e.properties:
>> > - vcpu_id = next_vcpu_id
>> > - next_vcpu_id += 1
>> > + vcpu_id = 0
>> > else:
>> > vcpu_id = "TRACE_VCPU_EVENT_NONE"
>> > out('TraceEvent %(event)s = {',
>> > - ' .id = %(id)s,',
>> > + ' .id = 0,',
>>
>> Better to use some invalid value, like in TRACE_VCPU_EVENT_NONE.
> I don't think it adds anything todo that - TRACE_VCPU_EVENT_NONE is
> special because it is a persistent value for lifetime of QEMU
> that will be used by runtime comparisons. In contrast this is
> just a placeholder that gets replaced by the real value immediately
> at startup in trace_event_register_group(). We never even check
> the statically set value of 'id' - we just unconditionally replace
> it with the real value.
Makes sense.
Thanks,
Lluis
[Qemu-devel] [PATCH v3 14/18] trace: get rid of generated-events.h/generated-events.c, Daniel P. Berrange, 2016/09/19
[Qemu-devel] [PATCH v3 16/18] trace: push reading of events up a level to tracetool main, Daniel P. Berrange, 2016/09/19
[Qemu-devel] [PATCH v3 18/18] trace: introduce a formal group name for trace events, Daniel P. Berrange, 2016/09/19
Re: [Qemu-devel] [PATCH v3 00/18] Refactor trace to allow modular build, no-reply, 2016/09/19
Re: [Qemu-devel] [PATCH v3 00/18] Refactor trace to allow modular build, no-reply, 2016/09/19