From: Jérémie Galarneau Date: Thu, 25 May 2017 09:15:52 +0000 (-0400) Subject: Tests: add consumer testpoint to pause data consumption X-Git-Tag: v2.10.0-rc2~30 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=19246bd67f449b68426e95a9d31f701514796d84;p=lttng-tools.git Tests: add consumer testpoint to pause data consumption Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-consumerd/Makefile.am b/src/bin/lttng-consumerd/Makefile.am index acb8d7d44..b7401de88 100644 --- a/src/bin/lttng-consumerd/Makefile.am +++ b/src/bin/lttng-consumerd/Makefile.am @@ -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 index 000000000..5836d823c --- /dev/null +++ b/src/bin/lttng-consumerd/testpoint.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 - Jérémie Galarneau + * + * 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 + +/* Testpoints, internal use only */ +TESTPOINT_DECL(consumerd_data_thread_poll); + +#endif /* CONSUMERD_TESTPOINT_H */ diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index b2feb3945..d07e5b492 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -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