| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_SYSTEM_INTERRUPTS_H |
| 4 | #define NETDATA_SYSTEM_INTERRUPTS_H |
| 5 | |
| 6 | #include "common-contexts.h" |
| 7 | |
| 8 | #define _ |
| 9 | |
| 10 | static inline void common_interrupts(uint64_t interrupts, int update_every, char *ext_module) { |
| 11 | static RRDSET *st_intr = NULL; |
| 12 | static RRDDIM *rd_interrupts = NULL; |
| 13 | |
| 14 | char *module = (!ext_module) ? _COMMON_PLUGIN_MODULE_NAME: ext_module; |
| 15 | |
| 16 | if(unlikely(!st_intr)) { |
| 17 | st_intr = rrdset_create_localhost( "system" |
| 18 | , "intr" |
| 19 | , NULL |
| 20 | , "interrupts" |
| 21 | , NULL |
| 22 | , "CPU Interrupts" |
| 23 | , "interrupts/s" |
| 24 | , _COMMON_PLUGIN_NAME |
| 25 | , module |
| 26 | , NETDATA_CHART_PRIO_SYSTEM_INTR |
| 27 | , update_every |
| 28 | , RRDSET_TYPE_LINE); |
| 29 | |
| 30 | rd_interrupts = rrddim_add(st_intr, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); |
| 31 | } |
| 32 | |
| 33 | rrddim_set_by_pointer(st_intr, rd_interrupts, (collected_number)interrupts); |
| 34 | rrdset_done(st_intr); |
| 35 | } |
| 36 | |
| 37 | #endif //NETDATA_SYSTEM_INTERRUPTS_H |