GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BSD::getloadavg(3) User Contributed Perl Documentation BSD::getloadavg(3)

BSD::getloadavg - Perl Interface to getloadavg (3)

  use BSD::getloadavg;
  my @loadavg = getloadavg();

This module allows you to access load average without invoking uptime(1). Instead of

  my @loadavg = (qx(uptime) =~ /([\.\d]+)\s+([\.\d]+)\s+([\.\d]+)/);

You can simply

  use BSD::getloadavg;
  my @loadavg = getloadavg();

Though named BSD::getloadavg, this module also works on Linux and other platforms that support getloadavg. To find if your platform supports this module, Just

  nm /usr/lib/libc.* | grep getloadavg

You can run benchmark with t/benchmark.pl. Here is the result in my platforms.
MacBook Pro 2GHz, Mac OS X 10.4.8
  Benchmark: running XS, command for at least 3 CPU seconds...
             Rate command      XS
  command  1061/s      --    -98%
  XS      69808/s   6482%      --
    
Dual Xeon 2.8GHz, FreeBSD 6-Stable
  Benchmark: running XS, command for at least 3 CPU seconds...
              Rate command      XS
  command    919/s      --    -99%
  XS      139023/s  15026%      --
    

getloadavg()

getloadavg(5)
Also available as <http://www.freebsd.org/cgi/man.cgi?query=getloadavg&sektion=3>. Since getloadavg is in libc in most platform, Makefile.PL needed no tweaking. If you find a platform that does not have getloadavg in libc, please report.
Sys::CpuLoad
This module accesses load average via /proc or uptime command. Therefore the performance is analogous to the benchmark above.
BSD::Sysctl
Seems like the most versatile module in this arena. Unfortunately most platform-dependent also. Works only on FreeBSD as of Version 0.06.

Dan Kogai, <dankogai@dan.co.jp>

Copyright (C) 2006-2007 by Dan Kogai

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

2007-04-18 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.