Received: from eggs.gnu.org ([2001:4830:134:3::10]:55372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmP6S-0004aT-3J for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:45:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmP6O-0004wc-Qd for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:45:08 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:47173 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmP6O-0004vj-FE for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:45:04 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1474296549-29171-1-git-send-email-berrange@redhat.com> <1474296549-29171-14-git-send-email-berrange@redhat.com> <87oa3j6a07.fsf@fimbulvetr.bsc.es> <20160920135003.GM25490@redhat.com> Date: Tue, 20 Sep 2016 19:45:02 +0200 In-Reply-To: <20160920135003.GM25490@redhat.com> (Daniel P. Berrange's message of "Tue, 20 Sep 2016 14:50:03 +0100") Message-ID: <87lgymv529.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 v3 13/18] trace: dynamically allocate event IDs at runtime 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 Mon, Sep 19, 2016 at 08:05:12PM +0200, Llu=C3=ADs Vilanova wrote: >> Daniel P Berrange writes: >>=20 >> > 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. >>=20 >> > Signed-off-by: Daniel P. Berrange >> > --- >> > 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(-) >>=20 >> > 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)) >>=20 >> > - next_id =3D 0 >> > - next_vcpu_id =3D 0 >> > for e in events: >> > - id =3D next_id >> > - next_id +=3D 1 >> > if "vcpu" in e.properties: >> > - vcpu_id =3D next_vcpu_id >> > - next_vcpu_id +=3D 1 >> > + vcpu_id =3D 0 >> > else: >> > vcpu_id =3D "TRACE_VCPU_EVENT_NONE" >> > out('TraceEvent %(event)s =3D {', >> > - ' .id =3D %(id)s,', >> > + ' .id =3D 0,', >>=20 >> 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