1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

update machinery: fix for update_stat() on linux

This commit is contained in:
Phil Sutter 2009-09-08 22:15:09 +02:00
parent 47c88b2149
commit 466a253a8c

View File

@ -616,6 +616,14 @@ inline static void update_stat(void)
const char *stat_template = NULL; const char *stat_template = NULL;
unsigned int malloc_cpu_size = 0; unsigned int malloc_cpu_size = 0;
extern void* global_cpu; extern void* global_cpu;
static double last_stat_update = 0.0;
/* since we use wrappers for this function, the update machinery
* can't eliminate double invocations of this function. Check for
* them here, otherwise cpu_usage counters are freaking out. */
if (last_stat_update == current_update_time)
return;
last_stat_update = current_update_time;
/* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */ /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */
if (!cpu_setup || !info.cpu_usage) { if (!cpu_setup || !info.cpu_usage) {