correct idle percentage for Linux
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user