[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.8 v1 00/60] Modular build of trace event f
From: |
Lluís Vilanova |
Subject: |
Re: [Qemu-devel] [PATCH for-2.8 v1 00/60] Modular build of trace event files |
Date: |
Thu, 08 Sep 2016 15:23:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
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
- Re: [Qemu-devel] [PATCH for-2.8 v1 00/60] Modular build of trace event files,
Lluís Vilanova <=
Re: [Qemu-devel] [PATCH for-2.8 v1 00/60] Modular build of trace event files, Daniel P. Berrange, 2016/09/13