smbd: Remove a pointless variable
[Samba/vl.git] / script / show_testsuite_time
blob40153218f5f668a343a5ca8609cc3122cb71ddcc
1 #!/usr/bin/env perl
2 use Time::Local ('timegm');
3 my $in = STDIN;
4 use strict;
6 my $intest=0;
7 my $name;
8 my $start=0;
9 my $end=0;
10 my %hash;
11 my $fh;
12 if ($#ARGV >= 0) {
13 open($fh, "<", $ARGV[0]) || die "can't open ".$ARGV[0];
14 } else {
15 $fh = $in;
17 while(<$fh>)
19 if (m/^testsuite: (.*)/) {
20 $intest = 1;
21 $name = $1;
23 if (m/testsuite-\w+:/) {
24 $hash{"$name -> ".($end - $start)} = $end - $start;
25 $intest = 0;
26 $start = 0;
28 if (m/^time: (\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/ && $intest) {
29 my $ts=timegm($6,$5,$4,$3,$2 - 1,$1 - 1900);
30 if ($start == 0) {
31 $start = $ts;
32 } else {
33 $end = $ts;
37 my @sorted = sort { $hash{$a}<=>$hash{$b} } keys(%hash);
38 for my $l (@sorted) {
39 print $l."\n";