From 8ac941422ce5ca7db88bd33568dac75982e21477 Mon Sep 17 00:00:00 2001 From: Christian Babeux Date: Tue, 2 Oct 2012 16:00:27 -0400 Subject: [PATCH] Add testpoints in lttng-sessiond for each threads This commit adds 8 new testpoints in the lttng-sessiond binary. These testpoints rely on the testpoints infrastructure introduced recently. Testpoints: thread_manage_clients thread_manage_clients_before_loop thread_registration_apps thread_manage_apps thread_manage_apps_before_loop thread_manage_kernel thread_manage_kernel_before_loop thread_manage_consumer The thread_ testpoints are placed directly at the thread start and they can be used to trigger failure in . The thread__before_loop testpoints are placed directly before the main processing loop of the thread and thus can be used to stall the processing of the thread. Signed-off-by: Christian Babeux Signed-off-by: David Goulet --- src/bin/lttng-sessiond/Makefile.am | 6 ++++-- src/bin/lttng-sessiond/main.c | 18 ++++++++++++++++ src/bin/lttng-sessiond/testpoint.h | 33 ++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 src/bin/lttng-sessiond/testpoint.h diff --git a/src/bin/lttng-sessiond/Makefile.am b/src/bin/lttng-sessiond/Makefile.am index 73be02302..b13059d77 100644 --- a/src/bin/lttng-sessiond/Makefile.am +++ b/src/bin/lttng-sessiond/Makefile.am @@ -21,7 +21,8 @@ lttng_sessiond_SOURCES = utils.c utils.h \ kernel-consumer.c kernel-consumer.h \ consumer.h filter.c filter.h \ health.c health.h \ - cmd.c cmd.h + cmd.c cmd.h \ + testpoint.h if HAVE_LIBLTTNG_UST_CTL lttng_sessiond_SOURCES += trace-ust.c ust-app.c ust-consumer.c ust-consumer.h @@ -38,7 +39,8 @@ lttng_sessiond_LDADD = -lrt -lurcu-common -lurcu \ $(top_builddir)/src/common/hashtable/libhashtable.la \ $(top_builddir)/src/common/libcommon.la \ $(top_builddir)/src/common/compat/libcompat.la \ - $(top_builddir)/src/common/relayd/librelayd.la + $(top_builddir)/src/common/relayd/librelayd.la \ + $(top_builddir)/src/common/testpoint/libtestpoint.la if HAVE_LIBLTTNG_UST_CTL lttng_sessiond_LDADD += -llttng-ust-ctl diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 85a20d795..1c5623bc3 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -61,6 +61,7 @@ #include "fd-limit.h" #include "filter.h" #include "health.h" +#include "testpoint.h" #define CONSUMERD_FILE "lttng-consumerd" @@ -688,8 +689,12 @@ static void *thread_manage_kernel(void *data) DBG("Thread manage kernel started"); + testpoint(thread_manage_kernel); + health_code_update(&health_thread_kernel); + testpoint(thread_manage_kernel_before_loop); + ret = create_thread_poll_set(&events, 2); if (ret < 0) { goto error_poll_create; @@ -860,6 +865,9 @@ static void *thread_manage_consumer(void *data) /* Inifinite blocking call, waiting for transmission */ restart: health_poll_update(&consumer_data->health); + + testpoint(thread_manage_consumer); + ret = lttng_poll_wait(&events, -1); health_poll_update(&consumer_data->health); if (ret < 0) { @@ -1057,6 +1065,8 @@ static void *thread_manage_apps(void *data) DBG("[thread] Manage application started"); + testpoint(thread_manage_apps); + rcu_register_thread(); rcu_thread_online(); @@ -1072,6 +1082,8 @@ static void *thread_manage_apps(void *data) goto error; } + testpoint(thread_manage_apps_before_loop); + health_code_update(&health_thread_app_manage); while (1) { @@ -1295,6 +1307,8 @@ static void *thread_registration_apps(void *data) DBG("[thread] Manage application registration started"); + testpoint(thread_registration_apps); + ret = lttcomm_listen_unix_sock(apps_sock); if (ret < 0) { goto error_listen; @@ -2994,6 +3008,8 @@ static void *thread_manage_clients(void *data) DBG("[thread] Manage client started"); + testpoint(thread_manage_clients); + rcu_register_thread(); health_code_update(&health_thread_cmd); @@ -3025,6 +3041,8 @@ static void *thread_manage_clients(void *data) kill(ppid, SIGUSR1); } + testpoint(thread_manage_clients_before_loop); + health_code_update(&health_thread_cmd); while (1) { diff --git a/src/bin/lttng-sessiond/testpoint.h b/src/bin/lttng-sessiond/testpoint.h new file mode 100644 index 000000000..458b0acb5 --- /dev/null +++ b/src/bin/lttng-sessiond/testpoint.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * 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 SESSIOND_TESTPOINT_H +#define SESSIOND_TESTPOINT_H + +#include + +/* Testpoints, internal use only */ +TESTPOINT_DECL(thread_manage_clients); +TESTPOINT_DECL(thread_manage_clients_before_loop); +TESTPOINT_DECL(thread_registration_apps); +TESTPOINT_DECL(thread_manage_apps); +TESTPOINT_DECL(thread_manage_apps_before_loop); +TESTPOINT_DECL(thread_manage_kernel); +TESTPOINT_DECL(thread_manage_kernel_before_loop); +TESTPOINT_DECL(thread_manage_consumer); + +#endif /* SESSIOND_TESTPOINT_H */ -- 2.34.1