consumer: add extra debug output
[lttng-tools.git] / src / common / consumer / consumer.c
index a1c669894bec5e9472e072c9410817a58399ec41..26209279ee65a49ec8c06ba88baed8dd275da90e 100644 (file)
@@ -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;
 }
This page took 0.024392 seconds and 5 git commands to generate.