The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Solaris::loadavg - get system load averages

SYNOPSIS

  use Solaris::loadavg;

  @avgs = loadavg();
  printf "load average: %f %f %f\n", @avgs;
  

DESCRIPTION The Solaris::loadavg module provides simple interface to Solaris getloadavg(3C) library function, which returns the number of processes in the system run queue averaged over various periods of time. Up to 3 (LOADAVG_NSTATS) samples are retrieved and returned to successive elements of the output array. The system imposes a maximum of 3 samples, representing averages over the last 1, 5, and 15 minutes, respectively. The LOADAVG_1MIN, LOADAVG_5MIN, and LOADAVG_15MIN indices, defined in <sys/loadavg.h>, can be used to extract the data from the appropriate element of the output array:

  # get the first two load averages

  @avgs = loadavg(2);
  printf "first load avg (1min): %f\n", @avgs[LOADAVG_1MIN];
  printf "second load avg (5min): %f\n", @avgs[LOADAVG_5MIN];

  When called without an argument, the loadavg() function returns all three 
  load averages.

EXPORT loadavg LOADAVG_1MIN LOADAVG_5MIN LOADAVG_15MIN

AUTHOR

Alexander Golomshtok, <golomshtok_alexander@jpmorgan.com>

SEE ALSO

perl,getloadavg(3C)