line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Formatter::Elapsed; |
2
|
1
|
|
|
1
|
|
86123
|
use base 'TAP::Formatter::Console'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1772
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
50971
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
5
|
1
|
|
|
1
|
|
7
|
use Time::HiRes qw( gettimeofday tv_interval ); |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
11
|
|
6
|
1
|
|
|
1
|
|
611
|
use POSIX qw( strftime ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
1
|
14
|
my $class = shift; |
12
|
1
|
|
|
|
|
22
|
my $self = $class->SUPER::new(@_); |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
143
|
$self->{'_t0'} = [ gettimeofday() ]; |
15
|
1
|
|
|
|
|
8
|
$self->{'_t1'} = $self->{'_t0'}; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
5
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _output { |
21
|
6
|
|
|
6
|
|
8119
|
my ( $self, $line ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
6
|
50
|
|
|
|
19
|
return unless defined $line; |
24
|
|
|
|
|
|
|
|
25
|
6
|
100
|
|
|
|
34
|
if ( $line =~ /^(?:not )?ok \d/ ) { |
26
|
4
|
100
|
|
|
|
16
|
my $format = defined $ENV{'TAP_ELAPSED_FORMAT'} |
27
|
|
|
|
|
|
|
? $ENV{'TAP_ELAPSED_FORMAT'} |
28
|
|
|
|
|
|
|
: '[%Y-%m-%dT%H:%M:%S, %t0, %t1 elapsed]'; |
29
|
|
|
|
|
|
|
|
30
|
4
|
|
|
|
|
17
|
$format =~ s{%t0}{ sprintf '%.2f', tv_interval($self->{'_t0'}) }eg; |
|
4
|
|
|
|
|
19
|
|
31
|
4
|
|
|
|
|
104
|
$format =~ s{%t1}{ sprintf '%.2f', tv_interval($self->{'_t1'}) }eg; |
|
4
|
|
|
|
|
14
|
|
32
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
445
|
$line .= ' ' . strftime( $format, localtime ); |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
24
|
$self->{'_t1'} = [ gettimeofday() ]; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
6
|
|
|
|
|
12
|
print { $self->stdout } $line; |
|
6
|
|
|
|
|
17
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |