Received: from eggs.gnu.org ([2001:4830:134:3::10]:46311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhzIq-0008Fo-80 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 09:23:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhzIk-0003Kx-9B for qemu-devel@nongnu.org; Thu, 08 Sep 2016 09:23:39 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:40309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhzIj-0003Ju-Uj for qemu-devel@nongnu.org; Thu, 08 Sep 2016 09:23:34 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1470756748-18933-1-git-send-email-berrange@redhat.com> Date: Thu, 08 Sep 2016 15:23:26 +0200 In-Reply-To: <1470756748-18933-1-git-send-email-berrange@redhat.com> (Daniel P. Berrange's message of "Tue, 9 Aug 2016 16:31:28 +0100") Message-ID: <87vay6ed9t.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain 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: > I previously split the global trace-events file up into one file > per-subdirectory to avoid merge conflict hell. [...] 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 proposed. What about using global variables? Instead of the dstate array, each event could have this on the "public" header: /* 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; void trace_eventname(...) { if (trace_event_get_stateTRACE_EVENTNAME_ENABLED && ___trace_eventname_dstate) { /* ... */ } } The use of event IDs on generic code can be adapted like this: #define trace_event_get_state_dynamic_by_id(id) \ (unlikely(trace_events_enabled_count) && \ (___ ## id ## _DSTATE)) And then we can concatenate all "trace-events" files to generate the .c files: struct TraceEvent { /* ... */ bool *dstate; }; bool ___TRACE_EVENTNAME_DSTATE; struct TraceEvent ___trace_events[] = { { .name = "eventname", .sstate = 1, .dstate = ___trace_eventname_dstate; } } TraceEvent *TRACE_EVENTNAME = &___trace_events[...]; 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 names. Cheers, Lluis