]> granicus.if.org Git - pgbadger/commitdiff
Fix top slowest array size with binary format.
authorDarold Gilles <gilles@darold.net>
Sat, 2 Mar 2013 17:23:58 +0000 (18:23 +0100)
committerDarold Gilles <gilles@darold.net>
Sat, 2 Mar 2013 17:23:58 +0000 (18:23 +0100)
pgbadger

index e6ae92e32eec93e8e263c160c885f97cc44aba72..ec865ea8fbb3c219110612725b17e285c847647b 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -4354,7 +4354,12 @@ sub load_stats
        }
 
        ### top_slowest ###
-       @top_slowest = (sort {$b->[0] <=> $a->[0]} (@top_slowest, @_top_slowest))[0 .. $end_top];
+       my @tmp_top_slowest = sort {$b->[0] <=> $a->[0]} (@top_slowest, @_top_slowest);
+       @top_slowest = ();
+       for (my $i = 0; $i <= $#tmp_top_slowest; $i++) {
+               last if ($i == $end_top);
+               push(@top_slowest, $tmp_top_slowest[$i]);
+       }
 
        ### checkpoint_info ###
        $checkpoint_info{file_removed} += $_checkpoint_info{file_removed};