@cryptotaxi247 / netdata-1 / commits / 43018545e

prevent adding idle cpu cores or disks

Costa Tsaousis (ktsaou) committed Dec 20, 2015 at 05:33 UTC 43018545ed5dd5455c6d0004c90913a839c069bd
2 files changed +12
src/proc_diskstats.c
+4
@@ -110,6 +110,10 @@ int do_proc_diskstats(int update_every, unsigned long long dt) {
110 // I/O completion time and the backlog that may be accumulating.
111 backlog_ms = strtoull(procfile_lineword(ff, l, 13), NULL, 10); // rq_ticks
112
113 +
114 + // do not add a disk that is completely idle
115 + if(!reads && !writes && !busy_ms) continue;
116 +
117 int def_enabled = 0;
118
119 // remove slashes from disk names
src/proc_softirqs.c
+8
@@ -131,6 +131,14 @@ int do_proc_softirqs(int update_every, unsigned long long dt) {
131
132 st = rrdset_find_bytype("cpu", id);
133 if(!st) {
134 + // find if everything is zero
135 + unsigned long long core_sum = 0 ;
136 + for(l = 0; l < lines ;l++) {
137 + if(!irrs[l].used) continue;
138 + core_sum += irrs[l].value[c];
139 + }
140 + if(core_sum == 0) continue; // try next core
141 +
142 char name[256], title[256];
143 snprintf(name, 256, "cpu%d_softirqs", c);
144 snprintf(title, 256, "CPU%d softirqs", c);