Received: from eggs.gnu.org ([2001:4830:134:3::10]:56801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biJbD-0007Qe-St for qemu-devel@nongnu.org; Fri, 09 Sep 2016 07:04:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biJb7-00079a-JH for qemu-devel@nongnu.org; Fri, 09 Sep 2016 07:03:58 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:60389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biJb7-00079F-8H for qemu-devel@nongnu.org; Fri, 09 Sep 2016 07:03:53 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1470756748-18933-1-git-send-email-berrange@redhat.com> <87vay6ed9t.fsf@fimbulvetr.bsc.es> <20160908134305.GL30602@redhat.com> Date: Fri, 09 Sep 2016 13:03:51 +0200 In-Reply-To: <20160908134305.GL30602@redhat.com> (Daniel P. Berrange's message of "Thu, 8 Sep 2016 14:43:05 +0100") Message-ID: <87y431bai0.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 00/60] Modular build of trace event files 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 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 modified= to >> provide this. But I think there's a more efficient way to provide modular >> auto-generated tracing code without the hierarchical indexing you propos= ed. > [snip] >> struct TraceEvent ___trace_events[] =3D { >> { >> .name =3D "eventname", >> .sstate =3D 1, >> .dstate =3D ___trace_eventname_dstate; >> } >> } >>=20 >> TraceEvent *TRACE_EVENTNAME =3D &___trace_events[...]; > Life would be simpler if we had the 'bool dstate' as part of the > TraceEvent struct, but doing so would essentially be reverting this > previous change: > commit 585ec7273e6fdab902b2128bc6c2a8136aafef04 > Author: Paolo Bonzini > Date: Wed Oct 28 07:06:27 2015 +0100 > trace: track enabled events in a separate array =20=20=20=20 > This is more cache friendly on the fast path, where we already have > the event id available. > I asked Paolo about this previously and he indicated it was a notable > performance improvement, so we can't put dstate back into the TraceEvent > struct :-( Sorry, there was a typo in my example code that led to this misunderstandin= g. I meant this for the global auto-generated .c: struct TraceEvent { /* ... */ bool *dstate; }; bool ___TRACE_EVENTNAME_DSTATE; struct TraceEvent ___trace_events[] =3D { { .name =3D "eventname", .sstate =3D 1, .dstate =3D &___TRACE_EVENTNAME_DSTATE; } } TraceEvent *TRACE_EVENTNAME =3D &___trace_events[...]; If you look at the modified macro I pasted for "trace/control-internal.h": #define trace_event_get_state_dynamic_by_id(id) \ (unlikely(trace_events_enabled_count) && \ (___ ## id ## _DSTATE)) We're retaining the fast-path performance of the seggregated boolean dstate array, while the event descriptor contains a pointer to the per-event dstate global boolean variable in case you want to get/set the dstate based on an = event pointer. Cheers, Lluis