Consumer: add testpoints
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 27 Jan 2014 03:43:13 +0000 (22:43 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 28 Jan 2014 21:19:41 +0000 (16:19 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/bin/lttng-consumerd/Makefile.am
src/common/Makefile.am
src/common/consumer-testpoint.h [new file with mode: 0644]
src/common/consumer-timer.c
src/common/consumer.c

index 1aa0f27f70cbeff0eeaa2ddc13dd3e884a8221f9..28034ca34e6a31d76404e866e45346cd184ff494 100644 (file)
@@ -13,6 +13,7 @@ lttng_consumerd_LDADD = \
           $(top_builddir)/src/common/libcommon.la \
           $(top_builddir)/src/common/index/libindex.la \
           $(top_builddir)/src/common/health/libhealth.la \
           $(top_builddir)/src/common/libcommon.la \
           $(top_builddir)/src/common/index/libindex.la \
           $(top_builddir)/src/common/health/libhealth.la \
+          $(top_builddir)/src/common/testpoint/libtestpoint.la \
           -lrt
 
 if HAVE_LIBLTTNG_UST_CTL
           -lrt
 
 if HAVE_LIBLTTNG_UST_CTL
index 3ba5fed5149ab91ff8536e7566858919b93dd34e..1a764aec197f5133b71646eec502f16c26126c66 100644 (file)
@@ -7,7 +7,8 @@ AM_CFLAGS = -fno-strict-aliasing
 
 noinst_HEADERS = lttng-kernel.h defaults.h macros.h error.h futex.h \
                                 uri.h utils.h lttng-kernel-old.h \
 
 noinst_HEADERS = lttng-kernel.h defaults.h macros.h error.h futex.h \
                                 uri.h utils.h lttng-kernel-old.h \
-                                consumer-metadata-cache.h consumer-timer.h
+                                consumer-metadata-cache.h consumer-timer.h \
+                                consumer-testpoint.h
 
 # Common library
 noinst_LTLIBRARIES = libcommon.la
 
 # Common library
 noinst_LTLIBRARIES = libcommon.la
diff --git a/src/common/consumer-testpoint.h b/src/common/consumer-testpoint.h
new file mode 100644 (file)
index 0000000..e94ce57
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef CONSUMERD_TESTPOINT_H
+#define CONSUMERD_TESTPOINT_H
+
+/*
+ * Copyright (C) 2012 - Christian Babeux <christian.babeux@efficios.com>
+ * Copyright (C) 2014 - Mathieu Desnoyers <mathieu.desnoyers@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.
+ */
+
+#include <common/testpoint/testpoint.h>
+
+/* Testpoints, internal use only */
+TESTPOINT_DECL(consumerd_thread_channel);
+TESTPOINT_DECL(consumerd_thread_metadata);
+TESTPOINT_DECL(consumerd_thread_data);
+TESTPOINT_DECL(consumerd_thread_sessiond);
+TESTPOINT_DECL(consumerd_thread_metadata_timer);
+
+#endif /* CONSUMERD_TESTPOINT_H */
index b681ae763379deaa55d68da8f6113b7b99b87eb3..b867a35bf0d6e9d44da62698fa366f7e06bd2d70 100644 (file)
@@ -28,6 +28,7 @@
 #include <common/consumer-stream.h>
 
 #include "consumer-timer.h"
 #include <common/consumer-stream.h>
 
 #include "consumer-timer.h"
+#include "consumer-testpoint.h"
 #include "ust-consumer/ust-consumer.h"
 
 static struct timer_signal_data timer_signal = {
 #include "ust-consumer/ust-consumer.h"
 
 static struct timer_signal_data timer_signal = {
@@ -472,6 +473,10 @@ void *consumer_timer_thread(void *data)
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA_TIMER);
 
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA_TIMER);
 
+       if (testpoint(consumerd_thread_metadata_timer)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        /* Only self thread will receive signal mask. */
        health_code_update();
 
        /* Only self thread will receive signal mask. */
@@ -503,7 +508,9 @@ void *consumer_timer_thread(void *data)
                }
        }
 
                }
        }
 
-       /* Currently never reached */
+error_testpoint:
+       /* Only reached in testpoint error */
+       health_error();
        health_unregister(health_consumerd);
 
        /* Never return */
        health_unregister(health_consumerd);
 
        /* Never return */
index cbcb2f74d27f8dfb8297b8c37f04b67112f6806e..36ec02479edc3b74ccf70df1cc8f6a8a023770fe 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "consumer.h"
 #include "consumer-stream.h"
 
 #include "consumer.h"
 #include "consumer-stream.h"
+#include "consumer-testpoint.h"
 
 struct lttng_consumer_global_data consumer_data = {
        .stream_count = 0,
 
 struct lttng_consumer_global_data consumer_data = {
        .stream_count = 0,
@@ -2254,6 +2255,10 @@ void *consumer_thread_metadata_poll(void *data)
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA);
 
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA);
 
+       if (testpoint(consumerd_thread_metadata)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        DBG("Thread metadata poll started");
        health_code_update();
 
        DBG("Thread metadata poll started");
@@ -2428,6 +2433,7 @@ end:
 
        lttng_poll_clean(&events);
 end_poll:
 
        lttng_poll_clean(&events);
 end_poll:
+error_testpoint:
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
@@ -2456,6 +2462,10 @@ void *consumer_thread_data_poll(void *data)
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_DATA);
 
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_DATA);
 
+       if (testpoint(consumerd_thread_data)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        local_stream = zmalloc(sizeof(struct lttng_consumer_stream *));
        health_code_update();
 
        local_stream = zmalloc(sizeof(struct lttng_consumer_stream *));
@@ -2687,6 +2697,7 @@ end:
         */
        (void) lttng_pipe_write_close(ctx->consumer_metadata_pipe);
 
         */
        (void) lttng_pipe_write_close(ctx->consumer_metadata_pipe);
 
+error_testpoint:
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
@@ -2787,6 +2798,10 @@ void *consumer_thread_channel_poll(void *data)
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_CHANNEL);
 
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_CHANNEL);
 
+       if (testpoint(consumerd_thread_channel)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        channel_ht = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        health_code_update();
 
        channel_ht = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
@@ -2988,6 +3003,7 @@ end:
 end_poll:
        destroy_channel_ht(channel_ht);
 end_ht:
 end_poll:
        destroy_channel_ht(channel_ht);
 end_ht:
+error_testpoint:
        DBG("Channel poll thread exiting");
        if (err) {
                health_error();
        DBG("Channel poll thread exiting");
        if (err) {
                health_error();
@@ -3043,6 +3059,10 @@ void *consumer_thread_sessiond_poll(void *data)
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_SESSIOND);
 
 
        health_register(health_consumerd, HEALTH_CONSUMERD_TYPE_SESSIOND);
 
+       if (testpoint(consumerd_thread_sessiond)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        DBG("Creating command socket %s", ctx->consumer_command_sock_path);
        health_code_update();
 
        DBG("Creating command socket %s", ctx->consumer_command_sock_path);
@@ -3179,6 +3199,7 @@ end:
                }
        }
 
                }
        }
 
+error_testpoint:
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
This page took 0.044511 seconds and 4 git commands to generate.