From f8528c7a982be6612eb1d81f17e1badd8910dfd4 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 12 Dec 2019 12:12:22 -0500 Subject: [PATCH] consumer: add extra debug output MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathieu Desnoyers Change-Id: I9cc81de9c46d5379e288ece625ccfef4fbf8e022 Signed-off-by: Jérémie Galarneau --- src/common/consumer/consumer.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index a1c669894..26209279e 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -4084,7 +4084,13 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel, */ produced_pos = ALIGN_FLOOR(produced_pos, stream->max_sb_size); if (consumed_pos == produced_pos) { + DBG("Set rotate ready for stream %" PRIu64 " produced = %lu consumed = %lu", + stream->key, produced_pos, consumed_pos); stream->rotate_ready = true; + } else { + DBG("Different consumed and produced positions " + "for stream %" PRIu64 " produced = %lu consumed = %lu", + stream->key, produced_pos, consumed_pos); } /* * The rotation position is based on the packet_seq_num of the @@ -4109,6 +4115,8 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel, } stream->rotate_position = stream->last_sequence_number + 1 + ((produced_pos - consumed_pos) / stream->max_sb_size); + DBG("Set rotation position for stream %" PRIu64 " at position %" PRIu64, + stream->key, stream->rotate_position); if (!is_local_trace) { /* @@ -4290,6 +4298,11 @@ error: */ int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream) { + DBG("Check is rotate ready for stream %" PRIu64 + " ready %u rotate_position %" PRIu64 + " last_sequence_number %" PRIu64, + stream->key, stream->rotate_ready, + stream->rotate_position, stream->last_sequence_number); if (stream->rotate_ready) { return 1; } @@ -4318,6 +4331,12 @@ int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream) * but consumerd considers rotation ready when reaching the last * packet of the current chunk, hence the "rotate_position - 1". */ + + DBG("Check is rotate ready for stream %" PRIu64 + " last_sequence_number %" PRIu64 + " rotate_position %" PRIu64, + stream->key, stream->last_sequence_number, + stream->rotate_position); if (stream->last_sequence_number >= stream->rotate_position - 1) { return 1; } @@ -4330,6 +4349,8 @@ int lttng_consumer_stream_is_rotate_ready(struct lttng_consumer_stream *stream) */ void lttng_consumer_reset_stream_rotate_state(struct lttng_consumer_stream *stream) { + DBG("lttng_consumer_reset_stream_rotate_state for stream %" PRIu64, + stream->key); stream->rotate_position = -1ULL; stream->rotate_ready = false; } -- 2.34.1