$vmstat_VERSION=~/^2\.0\./ && do { $out=~s|\n$||; $out=~s|.*\n||s; ($env{r}, $env{b}, $env{w}, $env{swpd}, $env{free}, $env{buff}, $env{cache}, $env{si}, $env{so}, $env{bi}, $env{bo}, $env{in}, $env{cs}, $env{us}, $env{sy}, $env{id}) = ($out=~/^\W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+) \W+(\d+)/x); return %env; };

$vmstat_VERSION=~/^3\.1\./ && do
{
 $out=~s|\n$||;
 $out=~s|.*\n||s;
 ($env{r},
  $env{b},
  $env{swpd},
  $env{free},
  $env{buff},
  $env{cache},
  $env{si},
  $env{so},
  $env{bi},
  $env{bo},
  $env{in},
  $env{cs},
  $env{us},
  $env{sy},
  $env{id},
  $env{wa})
 =
 ($out=~/^\W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)
               \W+(\d+)/x);
 return %env;
};

 die "not supported version ($vmstat_VERSION) of vmstat"; 
=cut
}











#our $proc; #$proc=1 if -e '/proc/loadavg';

sub getLoad {

my @env; $proc && do { @env=(`cat /proc/loadavg`=~/^(.*?) (.*?) (.*?) /); return @env; }; @env=(`uptime`=~/.* (.*?), (.*?), (.*?)$/); return @env; =cut my @env; @env=(`/sbin/sysctl -n vm.loadavg`=~/(\d+\.\d+) (\d+\.\d+) (\d+\.\d+)/);

}


1;


If published informations are not helpfull, something is missing or wrong, please report. Thanx for contribution.
This content is generated from file 'http://svn.cyclone3.org/trunk/frame/.core/.libs/System/meter.pm'

AddThis Social Bookmark Button RSS

User Comments