Tests: add consumer testpoint to pause data consumption
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 25 May 2017 09:15:52 +0000 (05:15 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 17:42:24 +0000 (13:42 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-consumerd/Makefile.am
src/bin/lttng-consumerd/testpoint.h [new file with mode: 0644]
src/common/consumer/consumer.c

index acb8d7d44b896ba639245cf8f6a4f05375e6cba8..b7401de88c30a2a3c2d9401557f4ef923f4e4410 100644 (file)
@@ -15,6 +15,8 @@ lttng_consumerd_LDADD = \
           $(top_builddir)/src/common/health/libhealth.la \
           $(top_builddir)/src/common/testpoint/libtestpoint.la
 
+lttng_consumerd_LDFLAGS = -rdynamic
+
 if HAVE_LIBLTTNG_UST_CTL
 lttng_consumerd_LDADD += -llttng-ust-ctl
 endif
diff --git a/src/bin/lttng-consumerd/testpoint.h b/src/bin/lttng-consumerd/testpoint.h
new file mode 100644 (file)
index 0000000..5836d82
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License, version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef CONSUMERD_TESTPOINT_H
+#define CONSUMERD_TESTPOINT_H
+
+#include <common/testpoint/testpoint.h>
+
+/* Testpoints, internal use only */
+TESTPOINT_DECL(consumerd_data_thread_poll);
+
+#endif /* CONSUMERD_TESTPOINT_H */
index b2feb3945c8a40f3c1476e4dba7d9b659b8f9f8b..d07e5b4925317f026fbe8b9483b54eae19c7ae77 100644 (file)
@@ -67,6 +67,7 @@ struct consumer_channel_msg {
        uint64_t key;                           /* del */
 };
 
+/* Flag used to temporarily pause data consumption from testpoints. */
 int data_consumption_paused;
 
 /*
@@ -2554,6 +2555,12 @@ void *consumer_thread_data_poll(void *data)
                        goto end;
                }
 
+               if (caa_unlikely(data_consumption_paused)) {
+                       DBG("Data consumption paused, sleeping...");
+                       sleep(1);
+                       goto restart;
+               }
+
                /*
                 * If the consumer_data_pipe triggered poll go directly to the
                 * beginning of the loop to update the array. We want to prioritize
This page took 0.027623 seconds and 4 git commands to generate.