relayd: add testpoints
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 27 Jan 2014 04:51:55 +0000 (23:51 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 28 Jan 2014 21:19:42 +0000 (16:19 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/bin/lttng-relayd/Makefile.am
src/bin/lttng-relayd/live.c
src/bin/lttng-relayd/main.c
src/bin/lttng-relayd/testpoint.h [new file with mode: 0644]

index 331b634b7bf03fa71e8ba0d5f902c3ad2d3f310c..f940e3f90085dd218d32e6e3a34175a6e4a27271 100644 (file)
@@ -13,7 +13,7 @@ lttng_relayd_SOURCES = main.c lttng-relayd.h utils.h utils.c cmd.h \
                        cmd-2-2.c cmd-2-2.h \
                        cmd-2-4.c cmd-2-4.h \
                        health-relayd.c health-relayd.h \
-                       lttng-viewer.h
+                       lttng-viewer.h testpoint.h
 
 # link on liblttngctl for check if relayd is already alive.
 lttng_relayd_LDADD = -lrt -lurcu-common -lurcu \
@@ -24,4 +24,5 @@ lttng_relayd_LDADD = -lrt -lurcu-common -lurcu \
                $(top_builddir)/src/common/compat/libcompat.la \
                $(top_builddir)/src/common/index/libindex.la \
                $(top_builddir)/src/common/health/libhealth.la \
-               $(top_builddir)/src/common/config/libconfig.la
+               $(top_builddir)/src/common/config/libconfig.la \
+               $(top_builddir)/src/common/testpoint/libtestpoint.la
index bfa7b85259ad7d3d2a75fdba5dfb416feccfe13c..80c3da57ac63d2ee0fd69b5942e063c7aefa4f16 100644 (file)
@@ -57,6 +57,7 @@
 #include "lttng-viewer.h"
 #include "utils.h"
 #include "health-relayd.h"
+#include "testpoint.h"
 
 static struct lttng_uri *live_uri;
 
@@ -253,6 +254,10 @@ void *thread_listener(void *data)
 
        lttng_relay_notify_ready();
 
+       if (testpoint(relayd_thread_live_listener)) {
+               goto error_testpoint;
+       }
+
        while (1) {
                health_code_update();
 
@@ -340,6 +345,7 @@ restart:
 exit:
 error:
 error_poll_add:
+error_testpoint:
        lttng_poll_clean(&events);
 error_create_poll:
        if (live_control_sock->fd >= 0) {
@@ -375,6 +381,10 @@ void *thread_dispatcher(void *data)
 
        health_register(health_relayd, HEALTH_RELAYD_TYPE_LIVE_DISPATCHER);
 
+       if (testpoint(relayd_thread_live_dispatcher)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        while (!CMM_LOAD_SHARED(live_dispatch_thread_exit)) {
@@ -423,6 +433,7 @@ void *thread_dispatcher(void *data)
        err = 0;
 
 error:
+error_testpoint:
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
@@ -1825,6 +1836,10 @@ void *thread_worker(void *data)
 
        health_register(health_relayd, HEALTH_RELAYD_TYPE_LIVE_WORKER);
 
+       if (testpoint(relayd_thread_live_worker)) {
+               goto error_testpoint;
+       }
+
        /* table of connections indexed on socket */
        relay_connections_ht = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
        if (!relay_connections_ht) {
@@ -1980,6 +1995,7 @@ relay_connections_ht_error:
                DBG("Viewer worker thread exited with error");
        }
        DBG("Viewer worker thread cleanup complete");
+error_testpoint:
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
index 789e3300abc1e33a604a5d5aa78ffc816ae3ce4d..8e6cb4d28a86ef35f59094c00774b177f1369cd3 100644 (file)
@@ -61,6 +61,7 @@
 #include "lttng-relayd.h"
 #include "live.h"
 #include "health-relayd.h"
+#include "testpoint.h"
 
 /* command line options */
 char *opt_output_path;
@@ -753,6 +754,10 @@ void *relay_thread_listener(void *data)
 
        lttng_relay_notify_ready();
 
+       if (testpoint(relayd_thread_listener)) {
+               goto error_testpoint;
+       }
+
        while (1) {
                health_code_update();
 
@@ -853,6 +858,7 @@ restart:
 exit:
 error:
 error_poll_add:
+error_testpoint:
        lttng_poll_clean(&events);
 error_create_poll:
        if (data_sock->fd >= 0) {
@@ -896,6 +902,10 @@ void *relay_thread_dispatcher(void *data)
 
        health_register(health_relayd, HEALTH_RELAYD_TYPE_DISPATCHER);
 
+       if (testpoint(relayd_thread_dispatcher)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        while (!CMM_LOAD_SHARED(dispatch_thread_exit)) {
@@ -942,6 +952,7 @@ void *relay_thread_dispatcher(void *data)
        err = 0;
 
 error:
+error_testpoint:
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
@@ -2560,6 +2571,10 @@ void *relay_thread_worker(void *data)
 
        health_register(health_relayd, HEALTH_RELAYD_TYPE_WORKER);
 
+       if (testpoint(relayd_thread_worker)) {
+               goto error_testpoint;
+       }
+
        health_code_update();
 
        /* table of connections indexed on socket */
@@ -2821,6 +2836,7 @@ relay_connections_ht_error:
        }
        DBG("Worker thread cleanup complete");
        free(data_buffer);
+error_testpoint:
        if (err) {
                health_error();
                ERR("Health error occurred in %s", __func__);
diff --git a/src/bin/lttng-relayd/testpoint.h b/src/bin/lttng-relayd/testpoint.h
new file mode 100644 (file)
index 0000000..ceece09
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef RELAYD_TESTPOINT_H
+#define RELAYD_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(relayd_thread_dispatcher);
+TESTPOINT_DECL(relayd_thread_worker);
+TESTPOINT_DECL(relayd_thread_listener);
+TESTPOINT_DECL(relayd_thread_live_dispatcher);
+TESTPOINT_DECL(relayd_thread_live_worker);
+TESTPOINT_DECL(relayd_thread_live_listener);
+
+#endif /* SESSIOND_TESTPOINT_H */
This page took 0.032203 seconds and 4 git commands to generate.