From 4ef81e4ac900975a4627ec36e3693ccbce727a62 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 17 Oct 2018 15:41:37 -0400 Subject: [PATCH] Fix: sync event enablers before choosing header type On session start, we should allocate the event IDs before figuring out the number of events per channel and select the proper header type. Without this, the number of events is always perceived to be 0, which selects the "compact" header type. For a channel containing many events (e.g. enable-event -k -a), this selects an inefficient header type. With this fix, it selects the "large" header type, which is more appropriate for a larger number of event IDs. This will lead to a reduced trace throughput for tracing workloads that have many events. Signed-off-by: Mathieu Desnoyers --- lttng-events.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lttng-events.c b/lttng-events.c index 3964df5f..f1be6028 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -226,6 +226,9 @@ int lttng_session_enable(struct lttng_session *session) /* Set transient enabler state to "enabled" */ session->tstate = 1; + /* We need to sync enablers with session before activation. */ + lttng_session_sync_enablers(session); + /* * Snapshot the number of events per channel to know the type of header * we need to use. @@ -239,9 +242,6 @@ int lttng_session_enable(struct lttng_session *session) chan->header_type = 2; /* large */ } - /* We need to sync enablers with session before activation. */ - lttng_session_sync_enablers(session); - /* Clear each stream's quiescent state. */ list_for_each_entry(chan, &session->chan, list) { if (chan->channel_type != METADATA_CHANNEL) -- 2.34.1