From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmLR6-0003fm-Ky for qemu-devel@nongnu.org; Tue, 20 Sep 2016 09:50:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmLR1-0003rM-VM for qemu-devel@nongnu.org; Tue, 20 Sep 2016 09:50:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmLR1-0003qM-OR for qemu-devel@nongnu.org; Tue, 20 Sep 2016 09:50:07 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D67103D951 for ; Tue, 20 Sep 2016 13:50:06 +0000 (UTC) Date: Tue, 20 Sep 2016 14:50:03 +0100 From: "Daniel P. Berrange" Message-ID: <20160920135003.GM25490@redhat.com> Reply-To: "Daniel P. Berrange" References: <1474296549-29171-1-git-send-email-berrange@redhat.com> <1474296549-29171-14-git-send-email-berrange@redhat.com> <87oa3j6a07.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87oa3j6a07.fsf@fimbulvetr.bsc.es> 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: qemu-devel@nongnu.org, Stefan Hajnoczi 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. Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|