It's not clear from the Win32::PerfLib docs, but if you execute the sample snippet,
use Win32::PerfLib; my $server = ""; Win32::PerfLib::GetCounterNames($server, \%counter); %r_counter = map { $counter{$_} => $_ } keys %counter; # retrieve the id for process object $process_obj = $r_counter{Process}; # retrieve the id for the process ID counter $process_id = $r_counter{'ID Process'}; # create connection to $server $perflib = new Win32::PerfLib($server); $proc_ref = {}; # get the performance data for the process object $perflib->GetObjectList($process_obj, $proc_ref); $perflib->Close(); $instance_ref = $proc_ref->{Objects}->{$process_obj}->{Instances +}; foreach $p (sort keys %{$instance_ref}) { $counter_ref = $instance_ref->{$p}->{Counters}; foreach $i (keys %{$counter_ref}) { if($counter_ref->{$i}->{CounterNameTitleIndex} == $proce +ss_id) { printf( "% 6d %s\n", $counter_ref->{$i}->{Counter}, $instance_ref->{$p}->{Name} ); } } }
it gives you a process list.
--
Mike

In reply to Re: Re: Windows - Find Process by Name by RMGir
in thread Windows - Find Process by Name by csotzing

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.