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 what max_physical is 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 as max_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 the Unix::Processors::Info manual 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::Info
  • Sys::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