qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]