From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXl7F-0003vY-Dm for qemu-devel@nongnu.org; Thu, 11 Aug 2016 04:13:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXl7C-0001qD-5O for qemu-devel@nongnu.org; Thu, 11 Aug 2016 04:13:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXl7B-0001q6-TX for qemu-devel@nongnu.org; Thu, 11 Aug 2016 04:13:22 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 5B0034E32B for ; Thu, 11 Aug 2016 08:13:21 +0000 (UTC) Date: Thu, 11 Aug 2016 09:13:18 +0100 From: "Daniel P. Berrange" Message-ID: <20160811081317.GA27458@redhat.com> Reply-To: "Daniel P. Berrange" References: <1470756748-18933-1-git-send-email-berrange@redhat.com> <1470756748-18933-61-git-send-email-berrange@redhat.com> <87shucr8vo.fsf@fimbulvetr.bsc.es> <20160810145125.GP13393@redhat.com> <87eg5wppsj.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87eg5wppsj.fsf@fimbulvetr.bsc.es> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Stefan Hajnoczi On Wed, Aug 10, 2016 at 06:11:24PM +0200, Llu=C3=ADs Vilanova wrote: > Daniel P Berrange writes: >=20 > > On Wed, Aug 10, 2016 at 04:33:47PM +0200, Llu=C3=ADs Vilanova wrote: > >> Daniel P Berrange writes: > >>=20 > >> > Describe use of per-subdir trace events files and how it impacts > >> > code generation. > >>=20 > >> > Signed-off-by: Daniel P. Berrange > >> > --- > >> > docs/tracing.txt | 61 +++++++++++++++++++++++++++++++++++++++++++= ++++--------- > >> > 1 file changed, 52 insertions(+), 9 deletions(-) > >>=20 > >> > diff --git a/docs/tracing.txt b/docs/tracing.txt > >> > index 29f2f9a..b7ba179 100644 > >> > --- a/docs/tracing.txt > >> > +++ b/docs/tracing.txt > >> > @@ -27,18 +27,51 @@ for debugging, profiling, and observing execut= ion. > >>=20 > >> > =3D=3D Trace events =3D=3D > >>=20 > >> > +=3D=3D=3D Sub-directory setup =3D=3D=3D > >> > + > >> > Each directory in the source tree can declare a set of static tra= ce events > >> > -in a "trace-events" file. Each trace event declaration names the = event, its > >> > -arguments, and the format string which can be used for pretty-pri= nting: > >> > +in a "trace-events" file. The first (non-comment) statement in th= e file > >> > +must be "@id_offset(NN)" where NN is an integer that is unique am= ong all > >> > +"trace-events" files in the QEMU source tree. The IDs can be arbi= trarily > >> > +chosen, but extra fun the current "trace-events" files use values= from the > >> > +"powerful number" integer sequence :-) > >>=20 > >> Can we get rid of the "@id_offset(NN)"? If we're generating a trace-= events-all > >> all the same, we can use that to generate all the per-directory file= *and* still > >> keep the simpler flat event ids. >=20 > > One thing that occurred to me is that we could take a hash of the > > group name. Since we have few enough sub-dirs / groups, and a large > > enough ID space, it ought to be possible to get a hash which is > > unique. The trace tool can double check that all groups get a unique > > hash >=20 > Eliminating "@id_offset" is nice, but I would prefer to eliminate the e= vent > hierarchy too. Having the event groups is the only way to avoid re-numbering all events when a new one is added. > >> For example, first we concatenate /trace-events, /io/trace-events an= d > >> /hw/usb/trace-events into /trace-events-all to produce: > >>=20 > >> @group core > >> @dir / > >> # contents of /trace-events > >> @group io > >> @dir /io > >> # contents of /io/trace-events > >> @group hw_usb > >> @dir /hw/usb > >> # contents of /hw/usb/trace-events > >>=20 > >> Then we can use /trace-events-all to generate all the per-directory = trace.h > >> files while ensuring a perfectly flat event identifier space (a sing= le > >> generated-events.c is used). > >>=20 > >> This should minimize changes to tracing code and avoid further restr= ictions > >> (like the "top-level vcpu" one). >=20 > > That means when any individual trace file is changed, we re-generate = the > > world, which is exactly what this series is designed to avoid. >=20 > Nope. We re-generate /trace-events-all, but each individual file genera= ted > afterwards (taken from the "@dir" directive) will change only if its ne= w > contents do (the Makefile uses cmp to check if files need updating from= their > corresponding timestamp file). The contents will still need to change too if we have a global numbering space as your suggestion requires. The event groups are the only way to avoid that. 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 :|