Sys::CpuLoad(3pm)
β¨ Sys::CpuLoad β the manual page, but make it cute β¨
okay bestie, so this is a User Contributed Perl Documentation page for Sys::CpuLoad (that's the 3pm one, iykyk) and it's literally just here to tell you how to grab your machine's load averages. no cap. let's go π
πΈ NAME πΈ
Sys::CpuLoad β retrieve system load averages π«Ά
like, it gets them. for you. the whole vibe is "what's the machine going through rn".
π VERSION π
version 0.32 β¨
π SYNOPSIS π
the main character moment, fr:
use Sys::CpuLoad 'load';
print '1 min, 5 min, 15 min load average: ',
join(',', load()), "\n";
that's it. that's the whole thing. slay.
π¦ DESCRIPTION π¦
so basically this module retrieves the 1 minute, 5 minute, and 15 minute load average of a machine. three numbers, three time windows, one very nosy little module. iconic behavior honestly.
π EXPORTS π
π load
this method returns the load average for 1 minute, 5 minutes and 15 minutes as an array. three values, in order, no drama.
here's the tea on how it actually gets them, depending on where you are:
- On Linux, Solaris, FreeBSD, NetBSD and OpenBSD systems, it will make a call to
getloadavg. very direct of it. - If
/proc/loadavgis available on non-Cygwin systems, it will callproc_loadavg. (note the "non-Cygwin" part, bestie β Cygwin doesn't get this route.) - Otherwise, it will attempt to parse the output of
uptime. old school but it works.
on error, it will return an array ofundefvalues. so if you seeundefs, that's not a vibe, that's a failure. π
As of v0.29, you can override the default function by changing $Sys::CpuLoad::LOAD:
use Sys::CpuLoad 'load';
no warnings 'once';
$Sys::CpuLoad::LOAD = 'uptimr';
@load = load();
(and yes, 'uptimr' is spelled exactly like that in the docs. not me proofreading, just copying the lore fr π)
If you are writing code to work on multiple systems, you should use the load function. But if your code is intended for specific systems, then you should use the appropriate function. pick your fighter π«Ά
β getloadavg
this is a wrapper around the system call to getloadavg. little glow-up, little wrapper, you know how it is.
If this call is unavailable, or it is fails, it will return undef. (yes the original says "or it is fails", we love a grammatically chaotic icon π)
Added in v0.22. β¨
π proc_loadavg
If /proc/loadavg is available, it will be used. simple as that.
If the data cannot be parsed, it will return undef. sad, but honest.
Added in v0.22. π
π§ uptime
Parse the output of uptime. that's the job. that's the whole job.
If the uptime executable cannot be found, or the output cannot be parsed, it will return undef.
Added in v0.22.
As of v0.24, you can override the executable path by setting $Sys::CpuLoad::UPTIME, e.g.
use Sys::CpuLoad 'uptime';
no warnings 'once';
$Sys::CpuLoad::UPTIME = '/usr/bin/w';
@load = uptime();
okay customize your path, periodt π
π₯ SEE ALSO π₯
Sys::CpuLoadX β the sequel. the remix. go look at it.
π SOURCE π
The development version is on github at <https://github.com/robrwo/Sys-CpuLoad> and may be cloned from <git://github.com/robrwo/Sys-CpuLoad.git> π«Ά
go clone it. it's right there. it's giving open source.
π BUGS π
Please report any bugs or feature requests on the bugtracker website <https://github.com/robrwo/Sys-CpuLoad/issues>
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. no "it's broken trust me" β show us the receipts bestie, include the test file or patch π
π AUTHORS π
- Robert Rothenberg
<rrwo@cpan.org> - Clinton Wong
<clintdw@cpan.org>
π CONTRIBUTORS π
- Slaven ReziΔ
<slaven@rezic.de> - Victor Wagner
- Dmitry Dorofeev
<dima@yasp.com> - Vincent Lefèvre
<vincent@vinc17.net>
look at this little group chat of legends. obsessed. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 1999-2002, 2020, 2025 by Clinton Wong <clintdw@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free as in go wild, just follow the Perl 5 terms, mwah π
and that's the whole page bestie! this was rendered with perl v5.40.1, dated 2025-05-06, and it was Sys::CpuLoad(3pm) the entire time. main character energy from start to finish. bye ily π¦β¨
π¦ where this page comes from
- debian trixie: libsys-cpuload-perl 0.32-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsys-cpuload-perl 0.32-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms