--- slstatus.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/slstatus.c b/slstatus.c index 30a9d09..e1f0e00 100644 --- a/slstatus.c +++ b/slstatus.c _AT_@ -178,21 +178,18 @@ cpu_freq(void) static const char * cpu_perc(void) { - struct timespec delay; int perc; - long double a[4], b[4]; + static long double a[4]; + static int valid; + long double b[4]; + memcpy(b, a, sizeof(b)); if (pscanf("/proc/stat", "%*s %Lf %Lf %Lf %Lf", &a[0], &a[1], &a[2], &a[3]) != 4) { return unknown_str; } - - delay.tv_sec = (interval / 2) / 1000; - delay.tv_nsec = ((interval / 2) % 1000) * 1000000; - nanosleep(&delay, NULL); - - if (pscanf("/proc/stat", "%*s %Lf %Lf %Lf %Lf", &b[0], &b[1], &b[2], - &b[3]) != 4) { + if (!valid) { + valid = 1; return unknown_str; } -- 1.8.5.rc3Received on Mon Sep 11 2017 - 20:05:52 CEST
This archive was generated by hypermail 2.3.0 : Mon Sep 11 2017 - 20:12:46 CEST