Win32::Process::Info The following lists all processes, but you can pass a list of pids to only get info on those ids.
#! perl -slw
use strict;
use Win32::Process::Info;
my @fields = qw[
ProcessId
Name
ExecutablePath
UserModeTime
KernelModeTime
MaximumWorkingSetSize
MinimumWorkingSetSize
];
my $i = new Win32::Process::Info;
printf "%10.10s %-22.22s %-40.40s %12.12s %14.14s %7.7s %7.7s\n", @fie
+lds;
printf "%10.10s %-22.22s %-40.40s %12.12s %14.14s %7.7s %7.7s\n",
map{ defined() ? $_ : 'n/a' } @{ $_ }{ @fields }
for $i->GetProcInfo();
__END__
P:\test>ProcInfo.pl
ProcessId Name ExecutablePath
+ UserModeTime KernelModeTime Maximum Minimum
0 System Idle Process n/a
+ 0 183399.78125 n/a n/a
4 System n/a
+ 0 77.71875 1413120 0
572 SMSS.EXE C:\WINDOWS\System32\smss.exe
+ 0.015625 0.015625 1413120 204800
660 CSRSS.EXE n/a
+ 9.59375 49.78125 n/a n/a
684 WINLOGON.EXE C:\WINDOWS\system32\winlogon.exe
+ 0.640625 0.734375 1413120 204800
728 SERVICES.EXE C:\WINDOWS\system32\services.exe
+ 0.96875 2.625 1413120 204800
740 LSASS.EXE C:\WINDOWS\system32\lsass.exe
+ 1.671875 2.171875 1413120 204800
912 SVCHOST.EXE C:\WINDOWS\system32\svchost.exe
+ 0.21875 0.25 1413120 204800
968 SVCHOST.EXE C:\WINDOWS\System32\svchost.exe
+ 25.734375 21.984375 1413120 204800
Caution: The Max/MinWorkingSet (memory) sizes coming up on my machine are very suspect?
The script below used to produce good numbers on my old NT box, so it's probably something broken with my installation.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
|