array getCpuStat(
[int
$maxWaitTime = 3000])
|
|
returns a hash with the following keys: 'user' => cpu usage for 'user' processes.
'system' => cpu usage for 'system' processes. 'nice' => cpu usage for low-priority processes. 'idle' => free cpu 'available' => idle + nice, because you can grab the nice cpu power for you aswell.
the total *should* be 100%, but because of the rounding (all values are rounded to a max of 2 digits after the dot) there might be a little difference. the values are of type float.
should work with multi-processor systems aswell.
note: the method may take a while to return, because it has to wait until the file with the cpu information (/proc/stat) has to be updated. see param $maxWaitTime.
Tags:
Parameters:
returns information about the load average.
the returned vector has at least 3 elements. on the machine i tested it there were 5, like this: ELEMENT VALUE DESCRIPTION
- 1.79 load average of the last minute
- 1.21 load average of the last 5 minutes
- 1.12 load average of the last 15 minutes
- 2/130 don't know
- 28638 don't know
imo a load average of >5 is high. everything <2 is fine.
Tags: