correct idle percentage for Linux

This commit is contained in:
marschap
2004-12-30 17:16:21 +00:00
parent 7355c40b60
commit 6e8850087c
+9 -1
View File
@@ -497,8 +497,16 @@ int machine_get_smpload(load_type *result, int *numcpus)
int machine_get_uptime(double *up, double *idle)
{
double local_up, local_idle;
reread(uptime_fd, "get_uptime:");
sscanf(procbuf, "%lf %lf", up, idle);
sscanf(procbuf, "%lf %lf", &local_up, &local_idle);
if (up != NULL)
*up = local_up;
if (idle != NULL)
*idle = (local_up != 0)
? 100 * local_idle / local_up
: 100;
return(TRUE);
}