|
BSD::getloadavg - Perl Interface to getloadavg |
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.
Benchmark: running XS, command for at least 3 CPU seconds...
Rate command XS
command 1061/s -- -98%
XS 69808/s 6482% --
Benchmark: running XS, command for at least 3 CPU seconds...
Rate command XS
command 919/s -- -99%
XS 139023/s 15026% --
getloadavg(5)
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.
|
BSD::getloadavg - Perl Interface to getloadavg |