Fix: Don't print ring-buffer's records count when it is not used
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 11 Jun 2019 22:34:32 +0000 (18:34 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 11 Jun 2019 22:37:33 +0000 (00:37 +0200)
The teardown of a ring buffer causes a number of diagnostic messages
to be printed using printk. One of those contains the "records
count", which is only updated when lttng-modules is built with
LTTNG_RING_BUFFER_COUNT_EVENTS defined.

Move the "records count" printing to a different function and stub it
out when LTTNG_RING_BUFFER_COUNT_EVENTS is not defined
(default configuration).

This eliminates messages of the following form from the dmesg output
when an LTTng session is torn down.

[...] ring buffer relay-discard, cpu 0: 0 records written, 0 records overrun

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/ringbuffer/ring_buffer_frontend.c

index f367dffc70190c3a040491349bd97eff0778d34d..0d2d6936bbcf870bce1d093a762c9a733b8cbc8a 100644 (file)
@@ -1498,12 +1498,13 @@ void lib_ring_buffer_print_buffer_errors(struct lib_ring_buffer *buf,
                                                       cpu);
 }
 
+#ifdef LTTNG_RING_BUFFER_COUNT_EVENTS
 static
-void lib_ring_buffer_print_errors(struct channel *chan,
-                                 struct lib_ring_buffer *buf, int cpu)
+void lib_ring_buffer_print_records_count(struct channel *chan,
+                                        struct lib_ring_buffer *buf,
+                                        int cpu)
 {
        const struct lib_ring_buffer_config *config = &chan->backend.config;
-       void *priv = chan->backend.priv;
 
        if (!strcmp(chan->backend.name, "relay-metadata")) {
                printk(KERN_DEBUG "ring buffer %s: %lu records written, "
@@ -1517,7 +1518,26 @@ void lib_ring_buffer_print_errors(struct channel *chan,
                        chan->backend.name, cpu,
                        v_read(config, &buf->records_count),
                        v_read(config, &buf->records_overrun));
+       }
+}
+#else
+static
+void lib_ring_buffer_print_records_count(struct channel *chan,
+                                        struct lib_ring_buffer *buf,
+                                        int cpu)
+{
+}
+#endif
+
+static
+void lib_ring_buffer_print_errors(struct channel *chan,
+                                 struct lib_ring_buffer *buf, int cpu)
+{
+       const struct lib_ring_buffer_config *config = &chan->backend.config;
+       void *priv = chan->backend.priv;
 
+       lib_ring_buffer_print_records_count(chan, buf, cpu);
+       if (strcmp(chan->backend.name, "relay-metadata")) {
                if (v_read(config, &buf->records_lost_full)
                    || v_read(config, &buf->records_lost_wrap)
                    || v_read(config, &buf->records_lost_big))
This page took 0.026795 seconds and 4 git commands to generate.