[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 08/17] trace: remove the TraceEventID and Tra
From: |
Lluís Vilanova |
Subject: |
Re: [Qemu-devel] [PATCH v4 08/17] trace: remove the TraceEventID and TraceEventVCPUID enums |
Date: |
Thu, 22 Sep 2016 18:12:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Daniel P Berrange writes:
> On Thu, Sep 22, 2016 at 02:35:38PM +0200, Lluís Vilanova wrote:
>> Daniel P Berrange writes:
[...]
>> > diff --git a/scripts/tracetool/format/events_h.py
>> > b/scripts/tracetool/format/events_h.py
>> > index 80a66c5..5da1d4c 100644
>> > --- a/scripts/tracetool/format/events_h.py
>> > +++ b/scripts/tracetool/format/events_h.py
>> > @@ -29,27 +29,15 @@ def generate(events, backend):
>> > out('extern TraceEvent %(event)s;',
>> > event = e.api(e.QEMU_EVENT))
>>
>> > - # event identifiers
>> > - out('typedef enum {')
>> > -
>> > - for e in events:
>> > - out(' TRACE_%s,' % e.name.upper())
>> > -
>> > - out(' TRACE_EVENT_COUNT',
>> > - '} TraceEventID;')
>> > -
>> > for e in events:
>> > out('extern uint16_t %s;' % e.api(e.QEMU_DSTATE))
>>
>> > - # per-vCPU event identifiers
>> > - out('typedef enum {')
>> > -
>> > + numvcpu = 0
>> > for e in events:
>> > if "vcpu" in e.properties:
>> > - out(' TRACE_VCPU_%s,' % e.name.upper())
>> > + numvcpu += 1
>>
>> > - out(' TRACE_VCPU_EVENT_COUNT',
>> > - '} TraceEventVCPUID;')
>>
>> Here's a more pythonic way to write it:
>>
>> numvcpu = len([e for e in events if "vcpu" in e.properties])
> FWIW I was tending to avoid this kind of idiom, since most of QEMU
> maintainers are C developers, for whom this looks rather alien.
I dont wanna enter into a coding style discussion, since I don't know how alien
QEMU developers feel about this (to me, it certainly looks ugly to keep the
explicit for loop). Feel free to ignore it.
Cheers,
Lluis
- [Qemu-devel] [PATCH v4 04/17] trace: remove global 'uint16 dstate[]' array, (continued)
- [Qemu-devel] [PATCH v4 04/17] trace: remove global 'uint16 dstate[]' array, Daniel P. Berrange, 2016/09/22
- [Qemu-devel] [PATCH v4 07/17] trace: give each trace event a named TraceEvent struct, Daniel P. Berrange, 2016/09/22
- [Qemu-devel] [PATCH v4 10/17] trace: don't abort qemu if ftrace can't be initialized, Daniel P. Berrange, 2016/09/22
- [Qemu-devel] [PATCH v4 09/17] trace: emit name <-> ID mapping in simpletrace header, Daniel P. Berrange, 2016/09/22
- [Qemu-devel] [PATCH v4 08/17] trace: remove the TraceEventID and TraceEventVCPUID enums, Daniel P. Berrange, 2016/09/22
Re: [Qemu-devel] [PATCH v4 08/17] trace: remove the TraceEventID and TraceEventVCPUID enums, Stefan Hajnoczi, 2016/09/23
[Qemu-devel] [PATCH v4 11/17] trace: provide mechanism for registering trace events, Daniel P. Berrange, 2016/09/22
[Qemu-devel] [PATCH v4 12/17] trace: dynamically allocate trace_dstate in CPUState, Daniel P. Berrange, 2016/09/22
[Qemu-devel] [PATCH v4 13/17] trace: dynamically allocate event IDs at runtime, Daniel P. Berrange, 2016/09/22