Received: from eggs.gnu.org ([2001:4830:134:3::10]:55719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXW6Q-0004Hc-E4 for qemu-devel@nongnu.org; Wed, 10 Aug 2016 12:11:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXW6M-0003MY-3m for qemu-devel@nongnu.org; Wed, 10 Aug 2016 12:11:33 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:60773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXW6L-0003Ln-NW for qemu-devel@nongnu.org; Wed, 10 Aug 2016 12:11:30 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= 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> Date: Wed, 10 Aug 2016 18:11:24 +0200 In-Reply-To: <20160810145125.GP13393@redhat.com> (Daniel P. Berrange's message of "Wed, 10 Aug 2016 15:51:25 +0100") Message-ID: <87eg5wppsj.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 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: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Daniel P Berrange writes: > 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 execution. >>=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 trace e= vents >> > -in a "trace-events" file. Each trace event declaration names the even= t, its >> > -arguments, and the format string which can be used for pretty-printin= g: >> > +in a "trace-events" file. The first (non-comment) statement in the fi= le >> > +must be "@id_offset(NN)" where NN is an integer that is unique among = all >> > +"trace-events" files in the QEMU source tree. The IDs can be arbitrar= ily >> > +chosen, but extra fun the current "trace-events" files use values fro= m the >> > +"powerful number" integer sequence :-) >>=20 >> Can we get rid of the "@id_offset(NN)"? If we're generating a trace-even= ts-all >> all the same, we can use that to generate all the per-directory file *an= d* still >> keep the simpler flat event ids. > 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 Eliminating "@id_offset" is nice, but I would prefer to eliminate the event hierarchy too. >> For example, first we concatenate /trace-events, /io/trace-events and >> /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 trac= e.h >> files while ensuring a perfectly flat event identifier space (a single >> generated-events.c is used). >>=20 >> This should minimize changes to tracing code and avoid further restricti= ons >> (like the "top-level vcpu" one). > That means when any individual trace file is changed, we re-generate the > world, which is exactly what this series is designed to avoid. Nope. We re-generate /trace-events-all, but each individual file generated afterwards (taken from the "@dir" directive) will change only if its new contents do (the Makefile uses cmp to check if files need updating from the= ir corresponding timestamp file). Cheers, Lluis