master
h 34 lines 1.47 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_SYSTEM_IPC_H
4 #define NETDATA_SYSTEM_IPC_H
5
6 #include "common-contexts.h"
7
8 static inline void common_semaphore_ipc(uint64_t semaphore, NETDATA_DOUBLE red, char *module, int update_every) {
9 static RRDSET *st_semaphores = NULL;
10 static RRDDIM *rd_semaphores = NULL;
11 if(unlikely(!st_semaphores)) {
12 st_semaphores = rrdset_create_localhost("system"
13 , "ipc_semaphores"
14 , NULL
15 , "ipc semaphores"
16 , NULL
17 , "IPC Semaphores"
18 , "semaphores"
19 , _COMMON_PLUGIN_NAME
20 , module
21 , NETDATA_CHART_PRIO_SYSTEM_IPC_SEMAPHORES
22 , update_every
23 , RRDSET_TYPE_AREA
24 );
25 rd_semaphores = rrddim_add(st_semaphores, "semaphores", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
26 }
27
28 rrddim_set_by_pointer(st_semaphores, rd_semaphores, semaphore);
29 rrdset_done(st_semaphores);
30 if (!strcmp(module, "ipc"))
31 st_semaphores->red = red;
32 }
33
34 #endif //NETDATA_SYSTEM_IPC_H