Next I tried the example in the POD:
The result was#!/usr/bin/perl -w # use strict; { 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} == $process_id) { printf( "% 6d %s\n", $counter_ref->{$i}->{Counter}, $instance_ref->{$p}->{Name} ); } } } }
Without wanting to spend too much time debugging the wheel, amd I doing anything obviouisly wrong here? If not, I'll hack away at it.Use of uninitialized value in subroutine entry at C:/Perl/site/lib/Win +32/PerfLib.pm line 199. Use of uninitialized value in hash element at winps2.pl line 21. Use of uninitialized value in hash element at winps2.pl line 21. (in cleanup) Error closing handle!
--t. alex
but my friends call me T.
In reply to Has anyone here used PerfLib.pm successfully? by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |