summaryrefslogtreecommitdiff
path: root/script/show_testsuite_time
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2014-10-12 17:56:10 -0700
committerMichael Adam <obnox@samba.org>2014-10-17 17:57:04 +0200
commit4055eb6b7dbd845cfc431a2cf7f1867240046fdf (patch)
tree4311a5251ec80ebcf634cdb242fe8aa8788e7836 /script/show_testsuite_time
parent14b5eb90d84f109f6a3ed8694acf13afe9b68f09 (diff)
downloadsamba-4055eb6b7dbd845cfc431a2cf7f1867240046fdf.tar.gz
scripts: Allow to specify a limit on the number of tests reported
This allows to report the 10 most slowest for instance. Change-Id: I987520dbc28f598221c47df314d823f916312aab Signed-off-by: Matthieu Patou <mat@matws.net> Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'script/show_testsuite_time')
-rwxr-xr-xscript/show_testsuite_time10
1 files changed, 8 insertions, 2 deletions
diff --git a/script/show_testsuite_time b/script/show_testsuite_time
index 40153218f5f..13ae0b66949 100755
--- a/script/show_testsuite_time
+++ b/script/show_testsuite_time
@@ -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: (.*)/) {
@@ -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";
}