From eda2ffa22237643eacfcc5ac6bbc7179d1e6c50a Mon Sep 17 00:00:00 2001 From: Darold Gilles Date: Sat, 2 Mar 2013 18:23:58 +0100 Subject: [PATCH] Fix top slowest array size with binary format. --- pgbadger | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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}; -- 2.40.0