lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* [PATCH lttng-modules] Don't print ring-buffer's records count when it is not used
@ 2019-06-11 22:34 Jérémie Galarneau
  0 siblings, 0 replies; only message in thread
From: Jérémie Galarneau @ 2019-06-11 22:34 UTC (permalink / raw)
  To: lttng-dev

The teardown of a ring buffer causes a number of diagnostic messages
to be printed to 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>
---
 lib/ringbuffer/ring_buffer_frontend.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
index 90c665d..29107f0 100644
--- a/lib/ringbuffer/ring_buffer_frontend.c
+++ b/lib/ringbuffer/ring_buffer_frontend.c
@@ -1502,12 +1502,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, "
@@ -1521,7 +1522,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))
-- 
2.22.0

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-11 22:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 22:34 [PATCH lttng-modules] Don't print ring-buffer's records count when it is not used Jérémie Galarneau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).