Subroutine for collecting average wait times for wait events


sub collect_wait_event_timings {
 my $sth2;
 my $event;
 my @value = ();
 foreach $event (@$all_wait_events) {
 $sth2 = $dbh_client_db->prepare(" select total_waits,time_waited_micro from systemevent where event='$event->[0]' ")
;
 $sth2 -> execute;
 @value = $sth2 -> fetchrow_array;
 $sth2 -> finish;
 if (@value) { # if the wait event is in v$system_event
 $wait_event_counts{$event->[0]} = $value[0];
 $wait_event_timings{$event->[0]} = $value[1];
 } else {
 $wait_event_counts{$event->[0]} = -1;
 $wait_event_timings{$event->[0]} = -1;
 }
 }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: