Something like this?
See the { no_user_info => 1 } parmeter on the GetProcInfo() call. If you don't need user information, gathering it slows things down horribly. (Also, notice the lc inside the grep.)
#! perl -slw use strict; use warnings; use Win32::Process::Info; use Data::Dumper; my $pio_2 = Win32::Process::Info->new (); my @pids = $pio_2->ListPids (); my @proc_info; my %ofInterest = map { $_ => 1 } qw[ perl.exe cmd.exe textpad.exe ]; my @fields = qw[ Name WorkingSetSize UserModeTime KernelModeTime ]; printf "%-25s %-14s %-12s %-14s\n", @fields; for my $pid (@pids) { @proc_info = $pio_2->GetProcInfo( { no_user_info => 1 }, $pid); for my $info ( grep{ exists $ofInterest{ lc $_->{ Name } } } @proc_info ) { printf "%-25s %14d %12.6f %14.7f\n", @{ $info }{ @fields }; } } __END__ C:\test>junk4 Name WorkingSetSize UserModeTime KernelModeTime CMD.EXE 1605632 2.328125 5.5156250 CMD.EXE 36864 0.015625 0.4218750 TextPad.exe 6189056 215.453125 108.9843750 CMD.EXE 65536 0.015625 0.2812500 perl.exe 7122944 0.375000 0.2187500
In reply to Re: Win32... CPU/RAM usage
by BrowserUk
in thread Win32... CPU/RAM usage
by mikejones
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |