Skip to content

Commit

Permalink
scripts: Allow to specify a limit on the number of tests reported
Browse files Browse the repository at this point in the history
This allows to report the 10 most slowest for instance.

Change-Id: I987520dbc28f598221c47df314d823f916312aab
Signed-off-by: Matthieu Patou <[email protected]>
Reviewed-by: Jelmer Vernooij <[email protected]>
Reviewed-by: Michael Adam <[email protected]>
  • Loading branch information
ekacnet authored and obnoxxx committed Oct 17, 2014
1 parent 14b5eb9 commit 4055eb6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions script/show_testsuite_time
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ my $start=0;
my $end=0;
my %hash;
my $fh;
my $max=0;
if ($#ARGV >= 0) {
open($fh, "<", $ARGV[0]) || die "can't open ".$ARGV[0];
} else {
$fh = $in;
}
if ($#ARGV >= 1) {
$max = $ARGV[1];
}

while(<$fh>)
{
if (m/^testsuite: (.*)/) {
Expand All @@ -34,7 +39,8 @@ while(<$fh>)
}
}
}
my @sorted = sort { $hash{$a}<=>$hash{$b} } keys(%hash);
for my $l (@sorted) {
my @sorted = sort { $hash{$b}<=>$hash{$a} } keys(%hash);
$max = $#sorted unless $max or ($max < $#sorted);
for my $l (@sorted[0..($max - 1)]) {
print $l."\n";
}

0 comments on commit 4055eb6

Please sign in to comment.