1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

Merge pull request #111 from rtoijala/patch-1

Call get_cpu_count() when needed
This commit is contained in:
Brenden Matthews 2015-07-30 15:58:12 -07:00
commit bf4f560f5d

View File

@ -571,23 +571,27 @@ struct text_object *construct_text_object(char *s, const char *arg,
__var = 0; \ __var = 0; \
} }
END OBJ(cpu, &update_cpu_usage) END OBJ(cpu, &update_cpu_usage)
get_cpu_count();
SCAN_CPU(arg, obj->data.i); SCAN_CPU(arg, obj->data.i);
obj->callbacks.percentage = &cpu_percentage; obj->callbacks.percentage = &cpu_percentage;
DBGP2("Adding $cpu for CPU %d", obj->data.i); DBGP2("Adding $cpu for CPU %d", obj->data.i);
#ifdef BUILD_X11 #ifdef BUILD_X11
END OBJ(cpugauge, &update_cpu_usage) END OBJ(cpugauge, &update_cpu_usage)
get_cpu_count();
SCAN_CPU(arg, obj->data.i); SCAN_CPU(arg, obj->data.i);
scan_gauge(obj, arg, 1); scan_gauge(obj, arg, 1);
obj->callbacks.gaugeval = &cpu_barval; obj->callbacks.gaugeval = &cpu_barval;
DBGP2("Adding $cpugauge for CPU %d", obj->data.i); DBGP2("Adding $cpugauge for CPU %d", obj->data.i);
#endif #endif
END OBJ(cpubar, &update_cpu_usage) END OBJ(cpubar, &update_cpu_usage)
get_cpu_count();
SCAN_CPU(arg, obj->data.i); SCAN_CPU(arg, obj->data.i);
scan_bar(obj, arg, 1); scan_bar(obj, arg, 1);
obj->callbacks.barval = &cpu_barval; obj->callbacks.barval = &cpu_barval;
DBGP2("Adding $cpubar for CPU %d", obj->data.i); DBGP2("Adding $cpubar for CPU %d", obj->data.i);
#ifdef BUILD_X11 #ifdef BUILD_X11
END OBJ(cpugraph, &update_cpu_usage) END OBJ(cpugraph, &update_cpu_usage)
get_cpu_count();
char *buf = 0; char *buf = 0;
SCAN_CPU(arg, obj->data.i); SCAN_CPU(arg, obj->data.i);
buf = scan_graph(obj, arg, 1); buf = scan_graph(obj, arg, 1);