in reply to Re: Getting Total Object Handles in Windows
in thread Getting Total Object Handles in Windows

I have looked in Win32::PerfLib and cannot seem to get this particular item back...
  • Comment on Re^2: Getting Total Object Handles in Windows

Replies are listed 'Best First'.
Re^3: Getting Total Object Handles in Windows
by ikegami (Patriarch) on Dec 17, 2004 at 18:29 UTC

    Works for me...

    use strict; use warnings; use Win32::PerfLib (); my $server = ""; { my %counters; my $process_group_id; my $handle_count_counter_id; my %perf_data; my $perflib; my $process_instances; my $total_instance; my $total_counters; my $total_handle_count_counter; my $total_handle_count; Win32::PerfLib::GetCounterNames($server, \%counters); foreach (keys(%counters)) { if ($counters{$_} eq 'Process') { $process_group_id = $_; } if ($counters{$_} eq 'Handle Count') { $handle_count_counter_id = $_; } } $perflib = new Win32::PerfLib($server); $perflib->GetObjectList($process_group_id, \%perf_data); $perflib->Close(); $process_instances = $perf_data{'Objects'}->{$process_group_id}->{' +Instances'}; foreach (keys(%$process_instances)) { if ($process_instances->{$_}->{'Name'} eq '_Total') { $total_instance = $process_instances->{$_}; last; } } $total_counters = $total_instance->{'Counters'}; foreach (keys(%$total_counters)) { if ($total_counters->{$_}->{'CounterNameTitleIndex'} == $handle_ +count_counter_id) { $total_handle_count_counter = $total_counters->{$_}; last; } } $total_handle_count = $total_handle_count_counter->{'Counter'}; print($total_handle_count, $/); }

    OT rant: