Skip to content

Commit

Permalink
Tweaked CPU usage formula
Browse files Browse the repository at this point in the history
  • Loading branch information
hetrixtools authored Feb 13, 2018
1 parent 5295778 commit bfcdb0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hetrixtools_agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function get_cpu_usage($stat1,$stat2) {
$dif['idle'] = $stat2[$i]['idle'] - $stat1[$i]['idle'];
$dif['iowait'] = $stat2[$i]['iowait'] - $stat1[$i]['iowait'];
$total = array_sum($dif);
$total_idle += (1000*$dif['idle']/$total+5)/10;
$total_iowait += (1000*$dif['iowait']/$total+5)/10;
$total_idle += (1000*$dif['idle']/$total)/10;
$total_iowait += (1000*$dif['iowait']/$total)/10;
}
$cpu_usage = round(100 - $total_idle / count($stat1),2);
$cpu_iowait = round($total_iowait / count($stat1),2);
Expand Down

0 comments on commit bfcdb0e

Please sign in to comment.