source: vendor/current/script/show_testsuite_time

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 937 bytes
Line 
1#!/usr/bin/env perl
2use Time::Local ('timegm');
3my $in = STDIN;
4use strict;
5
6my $intest=0;
7my $name;
8my $start=0;
9my $end=0;
10my %hash;
11my $fh;
12my $max=0;
13if ($#ARGV >= 0) {
14 open($fh, "<", $ARGV[0]) || die "can't open ".$ARGV[0];
15} else {
16 $fh = $in;
17}
18if ($#ARGV >= 1) {
19 $max = $ARGV[1];
20 if ($max =~ /\D/) {
21 die "not a decimal number: '$max'";
22 }
23}
24
25print "TOP $max slowest tests\n";
26
27while(<$fh>)
28{
29 if (m/^testsuite: (.*)/) {
30 $intest = 1;
31 $name = $1;
32 }
33 if (m/testsuite-\w+:/) {
34 $hash{"$name -> ".($end - $start)} = $end - $start;
35 $intest = 0;
36 $start = 0;
37 }
38 if (m/^time: (\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/ && $intest) {
39 my $ts=timegm($6,$5,$4,$3,$2 - 1,$1 - 1900);
40 if ($start == 0) {
41 $start = $ts;
42 } else {
43 $end = $ts;
44 }
45 }
46}
47my @sorted = sort { $hash{$b}<=>$hash{$a} } keys(%hash);
48$max = @sorted if (($max <= 0) or ($max > @sorted));
49for my $l (@sorted[0..($max - 1)]) {
50 print $l."\n";
51}
Note: See TracBrowser for help on using the repository browser.