Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: How to Monitor System Resources

by sflitman (Hermit)
on Oct 26, 2008 at 04:07 UTC ( #719606=note: print w/replies, xml ) Need Help??

in reply to How to Monitor System Resources

Check out Sys::Info, it's a great little module and it is cross-platform. This code is directly from the POD documentation, except the call to $info->device requires just 'CPU', not CPU => %options.
use strict; use Sys::Info; use Sys::Info::Constants qw( :device_cpu ); my $info = Sys::Info->new; my $cpu = $info->device('CPU'); printf "CPU: %s\n", scalar($cpu->identify) || 'N/A'; printf "CPU speed is %s MHz\n", $cpu->speed || 'N/A'; printf "There are %d CPUs\n" , $cpu->count || 1; printf "CPU load: %s\n" , $cpu->load || 0; exit;
This prints on my linux box:
CPU: 2 x Intel(R) Pentium(R) 4 CPU 2.80GHz CPU speed is 2801.015 MHz There are 2 CPUs CPU load: 0.21
It should run on my windows box, but I found out with ActivePerl 5,the latest version was 0.51 as PPMs tend to lag, and I'm not sure how to install a module with XS code from CPAN on Windows.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://719606]
and the monastery is silent...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2017-08-22 19:30 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (340 votes). Check out past polls.