// given a base, get a pointer to each record
#define irrindex(base, line, cpus) ((struct interrupt *)&((char *)(base))[line * recordsize(cpus)])
-static inline struct interrupt *get_interrupts_array(uint32_t lines, int cpus) {
+static inline struct interrupt *get_interrupts_array(size_t lines, int cpus) {
static struct interrupt *irrs = NULL;
- static uint32_t allocated = 0;
+ static size_t allocated = 0;
if(unlikely(lines != allocated)) {
uint32_t l;
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
- snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/proc/softirqs");
+ snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/softirqs");
ff = procfile_open(config_get("plugin:proc:/proc/softirqs", "filename to monitor", filename), " \t", PROCFILE_FLAG_DEFAULT);
if(unlikely(!ff)) return 1;
}
ff = procfile_readall(ff);
if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time
- uint32_t lines = procfile_lines(ff), l;
- uint32_t words = procfile_linewords(ff, 0);
+ size_t lines = procfile_lines(ff), l;
+ size_t words = procfile_linewords(ff, 0);
if(unlikely(!lines)) {
error("Cannot read /proc/softirqs, zero lines reported.");
irr->id = procfile_lineword(ff, l, 0);
if(unlikely(!irr->id || !irr->id[0])) continue;
- int idlen = strlen(irr->id);
- if(unlikely(irr->id[idlen - 1] == ':'))
+ size_t idlen = strlen(irr->id);
+ if(unlikely(idlen && irr->id[idlen - 1] == ':'))
irr->id[idlen - 1] = '\0';
int c;
for(c = 0; c < cpus ;c++) {
if(likely((c + 1) < (int)words))
- irr->cpu[c].value = strtoull(procfile_lineword(ff, l, (uint32_t)(c + 1)), NULL, 10);
+ irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t)(c + 1)));
else
irr->cpu[c].value = 0;
// --------------------------------------------------------------------
- st = rrdset_find_bytype("system", "softirqs");
- if(unlikely(!st)) st = rrdset_create("system", "softirqs", NULL, "softirqs", NULL, "System softirqs", "softirqs/s", 950, update_every, RRDSET_TYPE_STACKED);
+ st = rrdset_find_bytype_localhost("system", "softirqs");
+ if(unlikely(!st)) st = rrdset_create_localhost("system", "softirqs", NULL, "softirqs", NULL, "System softirqs"
+ , "softirqs/s", 950, update_every, RRDSET_TYPE_STACKED);
else rrdset_next(st);
for(l = 0; l < lines ;l++) {
if(unlikely(!irr->rd || strncmp(irr->name, irr->rd->name, MAX_INTERRUPT_NAME) != 0)) {
irr->rd = rrddim_find(st, irr->id);
if(unlikely(!irr->rd))
- irr->rd = rrddim_add(st, irr->id, irr->name, 1, 1, RRDDIM_INCREMENTAL);
+ irr->rd = rrddim_add(st, irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL);
else
rrddim_set_name(st, irr->rd, irr->name);
char id[50+1];
snprintfz(id, 50, "cpu%d_softirqs", c);
- st = rrdset_find_bytype("cpu", id);
+ st = rrdset_find_bytype_localhost("cpu", id);
if(unlikely(!st)) {
// find if everything is zero
unsigned long long core_sum = 0 ;
char title[100+1];
snprintfz(title, 100, "CPU%d softirqs", c);
- st = rrdset_create("cpu", id, NULL, "softirqs", "cpu.softirqs", title, "softirqs/s", 3000 + c, update_every, RRDSET_TYPE_STACKED);
+ st = rrdset_create_localhost("cpu", id, NULL, "softirqs", "cpu.softirqs", title, "softirqs/s", 3000 + c
+ , update_every, RRDSET_TYPE_STACKED);
}
else rrdset_next(st);
if(unlikely(!irr->cpu[c].rd)) {
irr->cpu[c].rd = rrddim_find(st, irr->id);
if(unlikely(!irr->cpu[c].rd))
- irr->cpu[c].rd = rrddim_add(st, irr->id, irr->name, 1, 1, RRDDIM_INCREMENTAL);
+ irr->cpu[c].rd = rrddim_add(st, irr->id, irr->name, 1, 1, RRD_ALGORITHM_INCREMENTAL);
else
rrddim_set_name(st, irr->cpu[c].rd, irr->name);
}