Received: from eggs.gnu.org ([2001:4830:134:3::10]:41320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn6cN-0000Ib-Rs for qemu-devel@nongnu.org; Thu, 22 Sep 2016 12:13:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn6cI-0006lW-QU for qemu-devel@nongnu.org; Thu, 22 Sep 2016 12:12:58 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:44918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn6cI-0006k9-Fw for qemu-devel@nongnu.org; Thu, 22 Sep 2016 12:12:54 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1474533652-31170-1-git-send-email-berrange@redhat.com> <1474533652-31170-9-git-send-email-berrange@redhat.com> <87ponwnmcl.fsf@fimbulvetr.bsc.es> <20160922124423.GL352@redhat.com> Date: Thu, 22 Sep 2016 18:12:52 +0200 In-Reply-To: <20160922124423.GL352@redhat.com> (Daniel P. Berrange's message of "Thu, 22 Sep 2016 13:44:24 +0100") Message-ID: <87h997lxq3.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 08/17] trace: remove the TraceEventID and TraceEventVCPUID enums List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Daniel P Berrange writes: > On Thu, Sep 22, 2016 at 02:35:38PM +0200, Llu=C3=ADs 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 =3D e.api(e.QEMU_EVENT)) >>=20 >> > - # 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)) >>=20 >> > - # per-vCPU event identifiers >> > - out('typedef enum {') >> > - >> > + numvcpu =3D 0 >> > for e in events: >> > if "vcpu" in e.properties: >> > - out(' TRACE_VCPU_%s,' % e.name.upper()) >> > + numvcpu +=3D 1 >>=20 >> > - out(' TRACE_VCPU_EVENT_COUNT', >> > - '} TraceEventVCPUID;') >>=20 >> Here's a more pythonic way to write it: >>=20 >> numvcpu =3D 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 a= lien QEMU developers feel about this (to me, it certainly looks ugly to keep the explicit for loop). Feel free to ignore it. Cheers, Lluis