From: Mathieu Desnoyers Date: Tue, 27 Mar 2012 19:41:42 +0000 (-0400) Subject: Fix event lost count when buffer is full X-Git-Tag: v2.0.1~3 X-Git-Url: http://git.lttng.org/?a=commitdiff_plain;h=04489ab41c8840d811884b668fe4cc5b46ef69a7;p=lttng-ust.git Fix event lost count when buffer is full The tracing channels should count lost events due to buffer full, and the metadata channel should not (see comment), but not the opposite. This was a mixup between the two. Reported-by: David Goulet Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/ltt-ring-buffer-client.h b/liblttng-ust/ltt-ring-buffer-client.h index e041803c..d64af555 100644 --- a/liblttng-ust/ltt-ring-buffer-client.h +++ b/liblttng-ust/ltt-ring-buffer-client.h @@ -366,11 +366,8 @@ static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, uint64_t ts header->ctx.timestamp_end = tsc; header->ctx.content_size = data_size * CHAR_BIT; /* in bits */ header->ctx.packet_size = PAGE_ALIGN(data_size) * CHAR_BIT; /* in bits */ - /* - * We do not care about the records lost count, because the metadata - * channel waits and retry. - */ - (void) lib_ring_buffer_get_records_lost_full(&client_config, buf); + + records_lost += lib_ring_buffer_get_records_lost_full(&client_config, buf); records_lost += lib_ring_buffer_get_records_lost_wrap(&client_config, buf); records_lost += lib_ring_buffer_get_records_lost_big(&client_config, buf); header->ctx.events_discarded = records_lost; diff --git a/liblttng-ust/ltt-ring-buffer-metadata-client.h b/liblttng-ust/ltt-ring-buffer-metadata-client.h index 40f749d5..1e18df9d 100644 --- a/liblttng-ust/ltt-ring-buffer-metadata-client.h +++ b/liblttng-ust/ltt-ring-buffer-metadata-client.h @@ -131,7 +131,11 @@ static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, uint64_t ts header->content_size = data_size * CHAR_BIT; /* in bits */ header->packet_size = PAGE_ALIGN(data_size) * CHAR_BIT; /* in bits */ - records_lost += lib_ring_buffer_get_records_lost_full(&client_config, buf); + /* + * We do not care about the records lost count, because the metadata + * channel waits and retry. + */ + (void) lib_ring_buffer_get_records_lost_full(&client_config, buf); records_lost += lib_ring_buffer_get_records_lost_wrap(&client_config, buf); records_lost += lib_ring_buffer_get_records_lost_big(&client_config, buf); WARN_ON_ONCE(records_lost != 0);