Processors(3pm)
π Processors(3pm) β the perl one, from User Contributed Perl Documentation π
okay bestie, gather round, because this is the page about poking at your CPUs from Perl and honestly it's giving main character energy for sysadmin girlies. it's Unix::Processors, and it's your little backstage pass to processor (CPU) info. π
β¨ NAME β¨
Unix::Processors β the interface to processor (CPU) information, no cap. π
πΈ SYNOPSIS πΈ
here's the whole vibe in one go, copied character for character because we do not freestyle code:
use Unix::Processors;
my $procs = new Unix::Processors;
print "There are ", $procs->max_online, " CPUs at ", $procs->max_clock, "\n";
if ($procs->max_online != $procs->max_physical) {
print "Hyperthreading between ",$procs->max_physical," physical CPUs.\n";
}
(my $FORMAT = "%2s %-8s %4s \n") =~ s/\s\s+/ /g;
printf($FORMAT, "#", "STATE", "CLOCK", "TYPE", );
foreach my $proc (@{$procs->processors}) {
printf ($FORMAT, $proc->id, $proc->state, $proc->clock, $proc->type);
}
like, it literally prints out how many CPUs you have and at what clock, then roasts your hyperthreading situation, then loops through every single processor and formats them into a little table. slay. π
π¦ DESCRIPTION π¦
so this package hands you accessors to per-processor (CPU) information. you get your object from the Unix::Processors::processors call. the operating system in a OS independent manner.
ngl that last sentence is a lil bit of a β¨ cliffhanger β¨ β the original says exactly that and then just... stops. we are respecting the source material, bestie. π
π the accessors π
max_onlineβ returns the number of threading processors currently online. on hyperthreaded Linux systems, this is the maximum number of simultaneous threads that may execute. need the real physical CPU count instead? that's whatmax_physicalis for. π§max_physicalβ returns the number of physical processor cores currently online. for example, a single chip quad-core processor returns four. four!! one chip, four cores, obsessed. π₯max_socketβ returns the number of populated CPU sockets if known, otherwise it just gives you the same number asmax_physical. for example, a single chip quad-core processor returns one. (one socket, four cores, one iconic lil package.) βmax_clockβ returns the maximum clock speed across all online processors. heads up though: not all OSes support this call. πprocessorsβ returns an array of processor references. go check theUnix::Processors::Infomanual page for the deets. and yeah, not all OSes support this call either. π
π DISTRIBUTION π
the latest version lives on CPAN and also at <http://www.veripool.org/>. go get her. π«Ά
Copyright 1999-2017 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0. iconic licensing behavior, honestly. π
π AUTHORS π
Wilson Snyder <wsnyder@wsnyder.org> β the legend himself. π
π SEE ALSO π
Unix::Processors::InfoSys::Sysconf
π the sign-off π
and that's the tea! this lil masterpiece shipped with perl v5.42.3 and the date stamp says 2026-08-19. go check your CPUs, bestie, and remember: max_online is threads, max_physical is cores, and confusing the two is not the vibe. periodt. π
β¨
π¦ where this page comes from
- ubuntu stonking: libunix-processors-perl 2.046-3build6 Β· Artistic-2.0 OR LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms