@cryptotaxi247 / netdata-1 / commits / 4f493d6da

made guest readings optional in /proc/stat #104

Costa Tsaousis (ktsaou) committed Mar 31, 2016 at 19:26 UTC 4f493d6da2159479cfbdd8e89d2bd03f485a02cc
1 file changed +3 -3
src/proc_stat.c
+3 -3
@@ -47,8 +47,8 @@ int do_proc_stat(int update_every, unsigned long long dt) {
47 for(l = 0; l < lines ;l++) {
48 if(strncmp(procfile_lineword(ff, l, 0), "cpu", 3) == 0) {
49 words = procfile_linewords(ff, l);
50 - if(words < 10) {
51 - error("Cannot read /proc/stat cpu line. Expected 10 params, read %d.", words);
50 + if(words < 9) {
51 + error("Cannot read /proc/stat cpu line. Expected 9 params, read %d.", words);
52 continue;
53 }
54
@@ -64,7 +64,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
64 irq = strtoull(procfile_lineword(ff, l, 6), NULL, 10);
65 softirq = strtoull(procfile_lineword(ff, l, 7), NULL, 10);
66 steal = strtoull(procfile_lineword(ff, l, 8), NULL, 10);
67 - guest = strtoull(procfile_lineword(ff, l, 9), NULL, 10);
67 + if(words >= 10) guest = strtoull(procfile_lineword(ff, l, 9), NULL, 10);
68 if(words >= 11) guest_nice = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
69
70 char *title = "Core utilization";