diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2016-11-23 15:49:10 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2016-11-23 15:49:10 +0000 |
commit | 87649cf32bd0e14d5a903fb85b01e9f41a253540 (patch) | |
tree | bbefda6dac074aeb87529592e8e5064f69cbe024 /src/proc_softirqs.c | |
parent | Imported Upstream version 1.3.0+dfsg (diff) | |
download | netdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.tar.xz netdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.zip |
New upstream version 1.4.0+dfsgupstream/1.4.0+dfsg
Diffstat (limited to 'src/proc_softirqs.c')
-rw-r--r-- | src/proc_softirqs.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/proc_softirqs.c b/src/proc_softirqs.c index a5165040..ebbbf2ae 100644 --- a/src/proc_softirqs.c +++ b/src/proc_softirqs.c @@ -21,8 +21,7 @@ static inline struct interrupt *get_interrupts_array(int lines, int cpus) { static struct interrupt *irrs = NULL; static int allocated = 0; - if(lines < allocated) return irrs; - else { + if(lines > allocated) { irrs = (struct interrupt *)reallocz(irrs, lines * recordsize(cpus)); allocated = lines; } @@ -134,8 +133,8 @@ int do_proc_softirqs(int update_every, unsigned long long dt) { int c; for(c = 0; c < cpus ; c++) { - char id[256+1]; - snprintfz(id, 256, "cpu%d_softirqs", c); + char id[50+1]; + snprintfz(id, 50, "cpu%d_softirqs", c); st = rrdset_find_bytype("cpu", id); if(!st) { @@ -148,10 +147,9 @@ int do_proc_softirqs(int update_every, unsigned long long dt) { } if(core_sum == 0) continue; // try next core - char name[256+1], title[256+1]; - snprintfz(name, 256, "cpu%d_softirqs", c); - snprintfz(title, 256, "CPU%d softirqs", c); - st = rrdset_create("cpu", id, name, "softirqs", "cpu.softirqs", title, "softirqs/s", 3000 + c, update_every, RRDSET_TYPE_STACKED); + 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); for(l = 0; l < lines ;l++) { struct interrupt *irr = irrindex(irrs, l, cpus); |