From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjrBt-0000Fq-0o for qemu-devel@nongnu.org; Tue, 13 Sep 2016 13:08:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjrBo-0008PW-7k for qemu-devel@nongnu.org; Tue, 13 Sep 2016 13:08:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjrBn-0008PF-VG for qemu-devel@nongnu.org; Tue, 13 Sep 2016 13:08:08 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 7B98CBAEC for ; Tue, 13 Sep 2016 17:08:07 +0000 (UTC) Date: Tue, 13 Sep 2016 18:08:04 +0100 From: "Daniel P. Berrange" Message-ID: <20160913170804.GD30949@redhat.com> Reply-To: "Daniel P. Berrange" References: <1470756748-18933-1-git-send-email-berrange@redhat.com> <87vay6ed9t.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87vay6ed9t.fsf@fimbulvetr.bsc.es> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-2.8 v1 00/60] Modular build of trace event files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Stefan Hajnoczi On Thu, Sep 08, 2016 at 03:23:26PM +0200, Llu=C3=ADs Vilanova wrote: > Daniel P Berrange writes: >=20 > > I previously split the global trace-events file up into one file > > per-subdirectory to avoid merge conflict hell. > [...] >=20 > Sorry, I could not find the message where the infrastructure is modifie= d to > provide this. But I think there's a more efficient way to provide modul= ar > auto-generated tracing code without the hierarchical indexing you propo= sed. NB, the simpletrace backend requires a globally unique 32-bit integer ID to be assigned to each trace event, so even with the approach you suggest below we still need to be able to assign a global ID for each event. So while your suggest below avoids having to pass around the dstate arrays, which is nice, we still have to assign event id offsets to each trace-event file in some manner TBD. >=20 > What about using global variables? Instead of the dstate array, each ev= ent could > have this on the "public" header: >=20 > /* define for static state */ > #define TRACE_EVENTNAME_ENABLED 1 > /* pointer to event descriptor */ > extern TraceEvent *TRACE_EVENTNAME; > /* variable with dynamic state */ > extern bool ___TRACE_EVENTNAME_DSTATE; >=20 > void trace_eventname(...) { > if (trace_event_get_stateTRACE_EVENTNAME_ENABLED && ___trace_even= tname_dstate) { > /* ... */ > } > } >=20 > The use of event IDs on generic code can be adapted like this: >=20 > #define trace_event_get_state_dynamic_by_id(id) \ > (unlikely(trace_events_enabled_count) && \ > (___ ## id ## _DSTATE)) >=20 > And then we can concatenate all "trace-events" files to generate the .c= files: >=20 > struct TraceEvent { > /* ... */ > bool *dstate; > }; >=20 > bool ___TRACE_EVENTNAME_DSTATE; >=20 > struct TraceEvent ___trace_events[] =3D { > { > .name =3D "eventname", > .sstate =3D 1, > .dstate =3D ___trace_eventname_dstate; > } > } >=20 > TraceEvent *TRACE_EVENTNAME =3D &___trace_events[...]; >=20 > So updating a single "trace-events" file does not force a recompile of = the whole > QEMU, but we retain the performance of the flat dstate array (now a per= -event > pointer) and the simpler flat structure for iteration based on event na= mes. 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 :|