From: Darold Gilles Date: Sat, 2 Mar 2013 17:23:58 +0000 (+0100) Subject: Fix top slowest array size with binary format. X-Git-Tag: v3.2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eda2ffa22237643eacfcc5ac6bbc7179d1e6c50a;p=pgbadger Fix top slowest array size with binary format. --- diff --git a/pgbadger b/pgbadger index e6ae92e..ec865ea 100755 --- 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};