This code incorporates johngg's idea, and adds code-file-name based "grep".
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 @wantedInfoTypes = qw{ Name WorkingSetSize UserModeTime KernelModeTime }; my @InterestingExecutables = qw{ VISIO.exe cmd.exe notepad.exe skype.exe GoogleDesktop.exe wmplayer.exe }; for my $pid (@pids) { @proc_info = $pio_2->GetProcInfo($pid); for my $info (@proc_info) { grep /$info->{Name}/i, @InterestingExecutables or next; for my $infoType ( @wantedInfoTypes ) { print qq{\n$infoType => \n}, q{-} x length $infoType, qq{$info->{$infoType}\n}; } } }
Output:
Name => ----GoogleDesktop.exe WorkingSetSize => --------------7118848 UserModeTime => ------------90.5117802 KernelModeTime => --------------149.3085571 Name => ----GoogleDesktop.exe WorkingSetSize => --------------3760128 UserModeTime => ------------62.3379996 KernelModeTime => --------------115.8931429 Name => ----wmplayer.exe WorkingSetSize => --------------45211648 UserModeTime => ------------87.5009609 KernelModeTime => --------------72.3532638 Name => ----GoogleDesktop.exe WorkingSetSize => --------------7290880 UserModeTime => ------------367.5071558 KernelModeTime => --------------239.1651331 Name => ----Skype.exe WorkingSetSize => --------------45948928 UserModeTime => ------------3.8376246 KernelModeTime => --------------2.7144174 Name => ----VISIO.EXE WorkingSetSize => --------------56135680 --snip---
Note - there ARE INDEED multiple instances of googledesktop running on my PC.

Update:Ignore my hack - BrowserUk (++) posted much better code while I was hacking.

     "An undefined problem has an infinite number of solutions." - Robert A. Humphrey         "If you're not part of the solution, you're part of the precipitate." - Henry J. Tillman


In reply to Re: Win32... CPU/RAM usage by NetWallah
in thread Win32... CPU/RAM usage by mikejones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.