From: Mathieu Desnoyers Date: Tue, 5 Mar 2013 20:17:22 +0000 (-0500) Subject: Reactivate error printing X-Git-Tag: v2.2.0-rc1~61 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=009769ca153da7ddfaa63643a84d4d19708b4586;p=lttng-ust.git Reactivate error printing Print errors at buffer teardown if LTTNG_UST_DEBUG=1 is set (env. var.) when launching the consumerd. This is possible now that consumerd owns the buffers. Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c index 6719626c..393aa9f0 100644 --- a/libringbuffer/ring_buffer_frontend.c +++ b/libringbuffer/ring_buffer_frontend.c @@ -105,15 +105,10 @@ struct switch_offsets { DEFINE_URCU_TLS(unsigned int, lib_ring_buffer_nesting); -/* - * TODO: this is unused. Errors are saved within the ring buffer. - * Eventually, allow consumerd to print these errors. - */ static void lib_ring_buffer_print_errors(struct channel *chan, - struct lttng_ust_lib_ring_buffer *buf, int cpu, - struct lttng_ust_shm_handle *handle) - __attribute__((unused)); + struct lttng_ust_lib_ring_buffer *buf, int cpu, + struct lttng_ust_shm_handle *handle); /** * lib_ring_buffer_reset - Reset ring buffer to initial values. @@ -402,8 +397,31 @@ static void channel_unregister_notifiers(struct channel *chan, //channel_backend_unregister_notifiers(&chan->backend); } -static void channel_free(struct channel *chan, struct lttng_ust_shm_handle *handle) +static void channel_print_errors(struct channel *chan, + struct lttng_ust_shm_handle *handle) +{ + const struct lttng_ust_lib_ring_buffer_config *config = + &chan->backend.config; + int cpu; + + if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { + for_each_possible_cpu(cpu) { + struct lttng_ust_lib_ring_buffer *buf = + shmp(handle, chan->backend.buf[cpu].shmp); + lib_ring_buffer_print_errors(chan, buf, cpu, handle); + } + } else { + struct lttng_ust_lib_ring_buffer *buf = + shmp(handle, chan->backend.buf[0].shmp); + + lib_ring_buffer_print_errors(chan, buf, -1, handle); + } +} + +static void channel_free(struct channel *chan, + struct lttng_ust_shm_handle *handle) { + channel_print_errors(chan, handle); channel_backend_free(&chan->backend, handle); /* chan is freed by shm teardown */ shm_object_table_destroy(handle->table); @@ -1014,8 +1032,8 @@ void lib_ring_buffer_print_buffer_errors(struct lttng_ust_lib_ring_buffer *buf, static void lib_ring_buffer_print_errors(struct channel *chan, - struct lttng_ust_lib_ring_buffer *buf, int cpu, - struct lttng_ust_shm_handle *handle) + struct lttng_ust_lib_ring_buffer *buf, int cpu, + struct lttng_ust_shm_handle *handle) { const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; void *priv = channel_get_private(chan);