Skip to content

Commit

Permalink
Plugin::LoadAvg: normalize with CPU count
Browse files Browse the repository at this point in the history
Divide loadavg by nproc. GitHub #21.
  • Loading branch information
dolmen committed Jun 7, 2016
1 parent 3103d6d commit 4cc6799
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/AngelPS1/Plugin/LoadAvg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ sub LoadAvgPercent
AngelPS1::_str_allowed($SYMBOL_LOADAVG) or return;

my $loadavg_func = $loadavg_gen->();
my $nproc = AngelPS1::System->nproc();

return sub {
my $loadavg = $loadavg_func->();
return if !defined($loadavg) || $loadavg < $LOAD_THRESHOLD;
return if !defined($loadavg);
$loadavg /= $nproc;
return if $loadavg < $LOAD_THRESHOLD;
(
(
$loadavg < 0.80
Expand Down

0 comments on commit 4cc6799

Please sign in to comment.