Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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.

HTH,

SSF

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://719606]
help
Chatterbox?
[choroba]: yeah, sounds like one of the strings is not flagged as UTF-8
[choroba]: which usually means its input wasn't handled correctly
[Corion]: choroba: Yeah, I think that would be the good solution
[LanX]: I suspect the first string which comes from the DB ...
[LanX]: ... but this part is already in production for a year now
[Corion]: LanX: The "good" approach here would be to use the appropriate DBI parameters to make the driver decode strings properly. But that will have a ripple-on effect of messing up all the places where manual decoding happens ;)
[LanX]: which means albeit being broken UTF8 it'll be handled correctly
[LanX]: and the problem only occurs since we changed the emails to base64
[LanX]: my main problem will be to cnvince my colleagues that our productive code is broken oO ... so in the end I will just make a workaround :-/
LanX hates UTF8 for causing knots in his brain and stomach

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-01-16 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (150 votes). Check out past polls.