summaryrefslogtreecommitdiffstats
path: root/daemon/static_threads.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-01-26 18:05:42 +0000
commit112b5b91647c3dea45cc1c9bc364df526c8012f1 (patch)
tree450af925135ec664c4310a1eb28b69481094ee2a /daemon/static_threads.c
parentReleasing debian version 1.32.1-2. (diff)
downloadnetdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.tar.xz
netdata-112b5b91647c3dea45cc1c9bc364df526c8012f1.zip
Merging upstream version 1.33.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemon/static_threads.c')
-rw-r--r--daemon/static_threads.c161
1 files changed, 161 insertions, 0 deletions
diff --git a/daemon/static_threads.c b/daemon/static_threads.c
new file mode 100644
index 000000000..534b3c3d8
--- /dev/null
+++ b/daemon/static_threads.c
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "common.h"
+
+extern void *aclk_starter(void *ptr);
+extern void *analytics_main(void *ptr);
+extern void *checks_main(void *ptr);
+extern void *cpuidlejitter_main(void *ptr);
+extern void *global_statistics_main(void *ptr);
+extern void *health_main(void *ptr);
+extern void *pluginsd_main(void *ptr);
+extern void *service_main(void *ptr);
+extern void *statsd_main(void *ptr);
+
+const struct netdata_static_thread static_threads_common[] = {
+ {
+ .name = "PLUGIN[check]",
+ .config_section = CONFIG_SECTION_PLUGINS,
+ .config_name = "checks",
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = checks_main
+ },
+ {
+ .name = "PLUGIN[idlejitter]",
+ .config_section = CONFIG_SECTION_PLUGINS,
+ .config_name = "idlejitter",
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = cpuidlejitter_main
+ },
+ {
+ .name = "ANALYTICS",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = analytics_main
+ },
+ {
+ .name = "GLOBAL_STATS",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = global_statistics_main
+ },
+ {
+ .name = "HEALTH",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = health_main
+ },
+ {
+ .name = "PLUGINSD",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = pluginsd_main
+ },
+ {
+ .name = "SERVICE",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = service_main
+ },
+ {
+ .name = "STATSD",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = statsd_main
+ },
+ {
+ .name = "BACKENDS",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = backends_main
+ },
+ {
+ .name = "EXPORTING",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = exporting_main
+ },
+ {
+ .name = "STREAM",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = rrdpush_sender_thread
+ },
+ {
+ .name = "WEB_SERVER[static1]",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = socket_listen_main_static_threaded
+ },
+
+#if defined(ENABLE_ACLK) || defined(ACLK_NG)
+ {
+ .name = "ACLK_Main",
+ .config_section = NULL,
+ .config_name = NULL,
+ .enabled = 1,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = aclk_starter
+ },
+#endif
+
+ {NULL, NULL, NULL, 0, NULL, NULL, NULL}
+};
+
+struct netdata_static_thread *
+static_threads_concat(const struct netdata_static_thread *lhs,
+ const struct netdata_static_thread *rhs)
+{
+ struct netdata_static_thread *res;
+
+ int lhs_size = 0;
+ for (; lhs[lhs_size].name; lhs_size++) {}
+
+ int rhs_size = 0;
+ for (; rhs[rhs_size].name; rhs_size++) {}
+
+ res = callocz(lhs_size + rhs_size + 1, sizeof(struct netdata_static_thread));
+
+ for (int i = 0; i != lhs_size; i++)
+ memcpy(&res[i], &lhs[i], sizeof(struct netdata_static_thread));
+
+ for (int i = 0; i != rhs_size; i++)
+ memcpy(&res[lhs_size + i], &rhs[i], sizeof(struct netdata_static_thread));
+
+ return res;
+}