Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Finding CPU stats on Win32?

by NateTut (Deacon)
on Apr 15, 2005 at 18:43 UTC ( [id://448308]=note: print w/replies, xml ) Need Help??


in reply to Finding CPU stats on Win32?

Check out Win32::SystemInfo. Here's a little code to get you started:
use Win32::SystemInfo; # Get Memory Information print("Memory Info:\n"); my %mHash; Win32::SystemInfo::MemoryStatus(%mHash,"MB"); foreach (sort(keys(%mHash))) { print("$_\[$mHash{$_}M\]\n"); } print("\n"); # Get Processor Information my %pHash; my $proc = Win32::SystemInfo::ProcessorInfo(%pHash); print("Number of Processors[$pHash{NumProcessors}]\n"); foreach my $Processor (keys(%pHash)) { if($Processor ne 'NumProcessors') { print("Processor[$Processor]\n"); foreach (sort(keys(%{$pHash{$Processor}}))) { print("$_\[" . $pHash{$Processor}->{$_} . "\]\n"); } print("\n"); } } }

Replies are listed 'Best First'.
Re^2: Finding CPU stats on Win32?
by sona (Initiate) on Apr 23, 2007 at 15:37 UTC
    hi, can u pls explain the code to me as i'm a beginner in perl. thanx.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://448308]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-03-28 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found