|
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
|
|---|
| 2 | use Time::Local ('timegm');
|
|---|
| 3 | my $in = STDIN;
|
|---|
| 4 | use strict;
|
|---|
| 5 |
|
|---|
| 6 | my $intest=0;
|
|---|
| 7 | my $name;
|
|---|
| 8 | my $start=0;
|
|---|
| 9 | my $end=0;
|
|---|
| 10 | my %hash;
|
|---|
| 11 | my $fh;
|
|---|
| 12 | my $max=0;
|
|---|
| 13 | if ($#ARGV >= 0) {
|
|---|
| 14 | open($fh, "<", $ARGV[0]) || die "can't open ".$ARGV[0];
|
|---|
| 15 | } else {
|
|---|
| 16 | $fh = $in;
|
|---|
| 17 | }
|
|---|
| 18 | if ($#ARGV >= 1) {
|
|---|
| 19 | $max = $ARGV[1];
|
|---|
| 20 | if ($max =~ /\D/) {
|
|---|
| 21 | die "not a decimal number: '$max'";
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | print "TOP $max slowest tests\n";
|
|---|
| 26 |
|
|---|
| 27 | while(<$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 | }
|
|---|
| 47 | my @sorted = sort { $hash{$b}<=>$hash{$a} } keys(%hash);
|
|---|
| 48 | $max = @sorted if (($max <= 0) or ($max > @sorted));
|
|---|
| 49 | for my $l (@sorted[0..($max - 1)]) {
|
|---|
| 50 | print $l."\n";
|
|---|
| 51 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.