This is the Unix::Processors Perl Package.
This package is Copyright 1999-2010 by Wilson Snyder <wsnyder@wsnyder.org>.
This program 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.
This code is provided with no warranty of any kind, and is used entirely at your own risk.
This package provides access to per-processor information from Perl.
my $procs = new Unix::Processors;
print $procs->max_online, " CPUs at ", $procs->max_clock, " MHz\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);
}
See `man Unix::Processors' after installation.
The latest version is available at `http://www.perl.org/CPAN/'
Download the latest package from that site, and decompress. `gunzip Unix-Processors_version.tar.gz ; tar xvf Unix-Processors_version.tar'
This version of Unix::Processors has been built and tested on:
Porting will definately be necessary for other operating systems.