gepebril69 has asked for the wisdom of the Perl Monks concerning the following question:
Which gave me following resultuse Win32::SystemInfo::CpuUsage; my $intvl = 1000; # in milliseconds my $usage = Win32::SystemInfo::CpuUsage::getCpuUsage($intvl); my $i = 0; while($i < 5) { #query 5 times $i++; $usage = Win32::SystemInfo::CpuUsage::getCpuUsage($intvl); print "$i: cpu usage $usage\n"; }
Then I found Sys::Info::Constants With following example:1: cpu usage -1 2: cpu usage -1 3: cpu usage -1 4: cpu usage -1 5: cpu usage -1
Wich provides me with output that is mostly 10% or more above what Window Task Manager provides me when I monitor CPU usage for a minute...use Sys::Info; use Sys::Info::Constants qw( :device_cpu ); my $Info = Sys::Info->new; my $Cpu = $Info->device( CPU =>%options ); printf "CPU Load: %s % (last minute)\n", ($Cpu->load(DCPU_LOAD_LAST_01 +)*100);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Windows 7 CPU usage
by BrowserUk (Patriarch) on Feb 02, 2012 at 13:40 UTC | |
|
Re: Windows 7 CPU usage
by gulden (Monk) on Feb 02, 2012 at 16:09 UTC | |
|
Re: Windows 7 CPU usage
by ww (Archbishop) on Feb 02, 2012 at 13:08 UTC |