summaryrefslogtreecommitdiffstats
path: root/src/collectors/common-contexts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:15:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:15:35 +0000
commitf09848204fa5283d21ea43e262ee41aa578e1808 (patch)
treec62385d7adf209fa6a798635954d887f718fb3fb /src/collectors/common-contexts
parentReleasing debian version 1.46.3-2. (diff)
downloadnetdata-f09848204fa5283d21ea43e262ee41aa578e1808.tar.xz
netdata-f09848204fa5283d21ea43e262ee41aa578e1808.zip
Merging upstream version 1.47.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/collectors/common-contexts')
-rw-r--r--src/collectors/common-contexts/common-contexts.h2
-rw-r--r--src/collectors/common-contexts/system.interrupts.h39
-rw-r--r--src/collectors/common-contexts/system.ipc.h34
3 files changed, 75 insertions, 0 deletions
diff --git a/src/collectors/common-contexts/common-contexts.h b/src/collectors/common-contexts/common-contexts.h
index 9d2d77147..1938230dc 100644
--- a/src/collectors/common-contexts/common-contexts.h
+++ b/src/collectors/common-contexts/common-contexts.h
@@ -20,7 +20,9 @@ typedef void (*instance_labels_cb_t)(RRDSET *st, void *data);
#include "system.io.h"
#include "system.ram.h"
+#include "system.interrupts.h"
#include "system.processes.h"
+#include "system.ipc.h"
#include "mem.swap.h"
#include "mem.pgfaults.h"
#include "mem.available.h"
diff --git a/src/collectors/common-contexts/system.interrupts.h b/src/collectors/common-contexts/system.interrupts.h
new file mode 100644
index 000000000..dffd70572
--- /dev/null
+++ b/src/collectors/common-contexts/system.interrupts.h
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_SYSTEM_INTERRUPTS_H
+#define NETDATA_SYSTEM_INTERRUPTS_H
+
+#include "common-contexts.h"
+
+#define _
+
+static inline void common_interrupts(uint64_t interrupts, int update_every, char *ext_module) {
+ static RRDSET *st_intr = NULL;
+ static RRDDIM *rd_interrupts = NULL;
+
+ char *module = (!ext_module) ? _COMMON_PLUGIN_MODULE_NAME: ext_module;
+
+ if(unlikely(!st_intr)) {
+ st_intr = rrdset_create_localhost( "system"
+ , "intr"
+ , NULL
+ , "interrupts"
+ , NULL
+ , "CPU Interrupts"
+ , "interrupts/s"
+ , _COMMON_PLUGIN_NAME
+ , module
+ , NETDATA_CHART_PRIO_SYSTEM_INTR
+ , update_every
+ , RRDSET_TYPE_LINE);
+
+ rrdset_flag_set(st_intr, RRDSET_FLAG_DETAIL);
+
+ rd_interrupts = rrddim_add(st_intr, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_intr, rd_interrupts, (collected_number)interrupts);
+ rrdset_done(st_intr);
+}
+
+#endif //NETDATA_SYSTEM_INTERRUPTS_H
diff --git a/src/collectors/common-contexts/system.ipc.h b/src/collectors/common-contexts/system.ipc.h
new file mode 100644
index 000000000..129ce6dfa
--- /dev/null
+++ b/src/collectors/common-contexts/system.ipc.h
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#ifndef NETDATA_SYSTEM_IPC_H
+#define NETDATA_SYSTEM_IPC_H
+
+#include "common-contexts.h"
+
+static inline void common_semaphore_ipc(uint64_t semaphore, NETDATA_DOUBLE red, char *module, int update_every) {
+ static RRDSET *st_semaphores = NULL;
+ static RRDDIM *rd_semaphores = NULL;
+ if(unlikely(!st_semaphores)) {
+ st_semaphores = rrdset_create_localhost("system"
+ , "ipc_semaphores"
+ , NULL
+ , "ipc semaphores"
+ , NULL
+ , "IPC Semaphores"
+ , "semaphores"
+ , _COMMON_PLUGIN_NAME
+ , module
+ , NETDATA_CHART_PRIO_SYSTEM_IPC_SEMAPHORES
+ , update_every
+ , RRDSET_TYPE_AREA
+ );
+ rd_semaphores = rrddim_add(st_semaphores, "semaphores", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ }
+
+ rrddim_set_by_pointer(st_semaphores, rd_semaphores, semaphore);
+ rrdset_done(st_semaphores);
+ if (!strcmp(module, "ipc"))
+ st_semaphores->red = red;
+}
+
+#endif //NETDATA_SYSTEM_IPC_H