Getting Current CPU Usage
Posted: Sun Sep 03, 2006 9:19 pm
I am having some trouble using PHP to get the current CPU usage of my computer. This is what i have tried so far, but $Output never fills
Attempt 1 (Using linux command top)
Attempt 2 (Using linux command ps)
Any help or suggestions would be appreciated.
Attempt 1 (Using linux command top)
Code: Select all
exec('top -i -n 1', $Output);
echo 'Process Output:';
foreach($Output as $Key => $Value)
{
echo $Key;
}Code: Select all
exec('ps -ax', $Output);
echo 'Process Output:';
foreach($Output as $Key => $Value)
{
echo $Key;
}