]> granicus.if.org Git - pgbadger/commitdiff
Fix broken counting of queries/sec after last changes about log_duration. Thanks...
authorDarold Gilles <gilles@darold.net>
Thu, 26 Feb 2015 17:01:22 +0000 (18:01 +0100)
committerDarold Gilles <gilles@darold.net>
Thu, 26 Feb 2015 17:01:22 +0000 (18:01 +0100)
pgbadger

index 09d1c82b111d53f6caaf1437f51ca39aa42ab013..486daa450721ac371e8913b3b54753e2f76c5ae0 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -4019,7 +4019,8 @@ sub print_general_activity
                        foreach my $lp (@LATENCY_PERCENTILE) {
                                $cur_period_info{$lp}{percentileindex} = int(@{$all_query_duration{'query'}} * $lp / 100) ;
                                @{$all_query_duration{'query'}}= sort{ $a <=> $b } @{$all_query_duration{'query'}};
-                               $cur_period_info{$lp}{percentile} = $all_query_duration{'query'}[$cur_period_info{$lp}{percentileindex}];                                                                            $percentile{$lp} =  &convert_time($cur_period_info{$lp}{percentile});
+                               $cur_period_info{$lp}{percentile} = $all_query_duration{'query'}[$cur_period_info{$lp}{percentileindex}];
+                               $percentile{$lp} =  &convert_time($cur_period_info{$lp}{percentile});
 
                                $cur_period_info{'SELECT'}{$lp}{percentileindex} = int(@{$all_query_duration{'SELECT'}} * $lp / 100) ;
                                @{$all_query_duration{'SELECT'}}= sort{ $a <=> $b } @{$all_query_duration{'SELECT'}};
@@ -9552,25 +9553,47 @@ sub set_current_infos
 
        my $t_pid = shift;
 
-       $cur_info{$t_pid}{year}      = $prefix_vars{'t_year'} if (! $cur_info{$t_pid}{year});
-       $cur_info{$t_pid}{month}     = $prefix_vars{'t_month'} if (! $cur_info{$t_pid}{month});
-       $cur_info{$t_pid}{day}       = $prefix_vars{'t_day'} if (! $cur_info{$t_pid}{day});
-       $cur_info{$t_pid}{hour}      = $prefix_vars{'t_hour'} if ($cur_info{$t_pid}{hour} ne '');
-       $cur_info{$t_pid}{min}       = $prefix_vars{'t_min'} if (! $cur_info{$t_pid}{min} ne '');
-       $cur_info{$t_pid}{sec}       = $prefix_vars{'t_sec'} if (! $cur_info{$t_pid}{sec} ne '');
-       $cur_info{$t_pid}{timestamp} = $prefix_vars{'t_timestamp'} if (! $cur_info{$t_pid}{timestamp});
-       $cur_info{$t_pid}{ident}     = $prefix_vars{'t_ident'} if (! $cur_info{$t_pid}{ident});
-       $cur_info{$t_pid}{query}     = $prefix_vars{'t_query'} if (! $cur_info{$t_pid}{query});
-       $cur_info{$t_pid}{duration}  = $prefix_vars{'t_duration'} if (! $cur_info{$t_pid}{duration});
-       $cur_info{$t_pid}{pid}       = $prefix_vars{'t_pid'} if (! $cur_info{$t_pid}{pid});
-       $cur_info{$t_pid}{session}   = $prefix_vars{'t_session_line'} if (! $cur_info{$t_pid}{session});
-       $cur_info{$t_pid}{loglevel}  = $prefix_vars{'t_loglevel'} if (! $cur_info{$t_pid}{loglevel});
-       $cur_info{$t_pid}{dbname}    = $prefix_vars{'t_dbname'} if (! $cur_info{$t_pid}{dbname});
-       $cur_info{$t_pid}{dbuser}    = $prefix_vars{'t_dbuser'} if (! $cur_info{$t_pid}{dbuser});
-       $cur_info{$t_pid}{dbclient}  = $prefix_vars{'t_client'} || $prefix_vars{'t_dbclient'} if (! $cur_info{$t_pid}{dbclient});
-       $cur_info{$t_pid}{dbappname} = $prefix_vars{'t_appname'} if (! $cur_info{$t_pid}{dbappname});
-       $cur_info{$t_pid}{date}      = $prefix_vars{'t_date'} if (! $cur_info{$t_pid}{date});
-       $cur_info{$t_pid}{bind}      = $prefix_vars{'t_bind'} if (! $cur_info{$t_pid}{bind});
+       if (!$log_duration) {
+               $cur_info{$t_pid}{year}      = $prefix_vars{'t_year'};
+               $cur_info{$t_pid}{month}     = $prefix_vars{'t_month'};
+               $cur_info{$t_pid}{day}       = $prefix_vars{'t_day'};
+               $cur_info{$t_pid}{hour}      = $prefix_vars{'t_hour'};
+               $cur_info{$t_pid}{min}       = $prefix_vars{'t_min'};
+               $cur_info{$t_pid}{sec}       = $prefix_vars{'t_sec'};
+               $cur_info{$t_pid}{timestamp} = $prefix_vars{'t_timestamp'};
+               $cur_info{$t_pid}{ident}     = $prefix_vars{'t_ident'};
+               $cur_info{$t_pid}{query}     = $prefix_vars{'t_query'};
+               $cur_info{$t_pid}{duration}  = $prefix_vars{'t_duration'};
+               $cur_info{$t_pid}{pid}       = $prefix_vars{'t_pid'};
+               $cur_info{$t_pid}{session}   = $prefix_vars{'t_session_line'};
+               $cur_info{$t_pid}{loglevel}  = $prefix_vars{'t_loglevel'};
+               $cur_info{$t_pid}{dbname}    = $prefix_vars{'t_dbname'};
+               $cur_info{$t_pid}{dbuser}    = $prefix_vars{'t_dbuser'};
+               $cur_info{$t_pid}{dbclient}  = $prefix_vars{'t_client'};
+               $cur_info{$t_pid}{dbappname} = $prefix_vars{'t_appname'};
+               $cur_info{$t_pid}{date}      = $prefix_vars{'t_date'};
+               $cur_info{$t_pid}{bind}      = $prefix_vars{'t_bind'};
+       } else {
+               $cur_info{$t_pid}{year}      = $prefix_vars{'t_year'} if (! $cur_info{$t_pid}{year});
+               $cur_info{$t_pid}{month}     = $prefix_vars{'t_month'} if (! $cur_info{$t_pid}{month});
+               $cur_info{$t_pid}{day}       = $prefix_vars{'t_day'} if (! $cur_info{$t_pid}{day});
+               $cur_info{$t_pid}{hour}      = $prefix_vars{'t_hour'} if ($cur_info{$t_pid}{hour} eq '');
+               $cur_info{$t_pid}{min}       = $prefix_vars{'t_min'} if (! $cur_info{$t_pid}{min} eq '');
+               $cur_info{$t_pid}{sec}       = $prefix_vars{'t_sec'} if (! $cur_info{$t_pid}{sec} eq '');
+               $cur_info{$t_pid}{timestamp} = $prefix_vars{'t_timestamp'} if (! $cur_info{$t_pid}{timestamp});
+               $cur_info{$t_pid}{ident}     = $prefix_vars{'t_ident'} if (! $cur_info{$t_pid}{ident});
+               $cur_info{$t_pid}{query}     = $prefix_vars{'t_query'} if (! $cur_info{$t_pid}{query});
+               $cur_info{$t_pid}{duration}  = $prefix_vars{'t_duration'} if (! $cur_info{$t_pid}{duration});
+               $cur_info{$t_pid}{pid}       = $prefix_vars{'t_pid'} if (! $cur_info{$t_pid}{pid});
+               $cur_info{$t_pid}{session}   = $prefix_vars{'t_session_line'} if (! $cur_info{$t_pid}{session});
+               $cur_info{$t_pid}{loglevel}  = $prefix_vars{'t_loglevel'} if (! $cur_info{$t_pid}{loglevel});
+               $cur_info{$t_pid}{dbname}    = $prefix_vars{'t_dbname'} if (! $cur_info{$t_pid}{dbname});
+               $cur_info{$t_pid}{dbuser}    = $prefix_vars{'t_dbuser'} if (! $cur_info{$t_pid}{dbuser});
+               $cur_info{$t_pid}{dbclient}  = $prefix_vars{'t_client'} || $prefix_vars{'t_dbclient'} if (! $cur_info{$t_pid}{dbclient});
+               $cur_info{$t_pid}{dbappname} = $prefix_vars{'t_appname'} if (! $cur_info{$t_pid}{dbappname});
+               $cur_info{$t_pid}{date}      = $prefix_vars{'t_date'} if (! $cur_info{$t_pid}{date});
+               $cur_info{$t_pid}{bind}      = $prefix_vars{'t_bind'} if (! $cur_info{$t_pid}{bind});
+       }
 
 }