line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aspect::Library::Timer; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4137
|
use 5.008002; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
86
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
5
|
2
|
|
|
2
|
|
20
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
6
|
2
|
|
|
2
|
|
1706
|
use Aspect::Modular 1.00 (); |
|
2
|
|
|
|
|
9470
|
|
|
2
|
|
|
|
|
53
|
|
7
|
2
|
|
|
2
|
|
1236
|
use Time::HiRes 1.9718 (); |
|
2
|
|
|
|
|
2093
|
|
|
2
|
|
|
|
|
53
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
140
|
use vars qw{$VERSION @ISA}; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
145
|
|
10
|
|
|
|
|
|
|
BEGIN { |
11
|
2
|
|
|
2
|
|
4
|
$VERSION = '1.10'; |
12
|
2
|
|
|
|
|
639
|
@ISA = 'Aspect::Modular'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_advice { |
16
|
1
|
|
|
1
|
0
|
45
|
my $self = shift; |
17
|
1
|
|
|
|
|
2
|
my $pointcut = shift; |
18
|
1
|
50
|
|
|
|
4
|
my $handler = @_ ? shift : \&handler; |
19
|
1
|
|
|
|
|
2
|
my $DISABLE = 0; |
20
|
|
|
|
|
|
|
Aspect::Advice::Around->new( |
21
|
|
|
|
|
|
|
lexical => $self->lexical, |
22
|
|
|
|
|
|
|
pointcut => $pointcut, |
23
|
|
|
|
|
|
|
code => sub { |
24
|
|
|
|
|
|
|
# Prevent recursion in the report handler |
25
|
6
|
100
|
|
6
|
|
95652
|
if ( $DISABLE ) { |
26
|
3
|
|
|
|
|
15
|
$_->proceed; |
27
|
3
|
|
|
|
|
3301024
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Capture the time |
31
|
3
|
|
|
|
|
8
|
my $error = ''; |
32
|
3
|
|
|
|
|
5
|
SCOPE: { |
33
|
3
|
|
|
|
|
5
|
local $@; |
34
|
3
|
|
|
|
|
23
|
my @start = Time::HiRes::gettimeofday(); |
35
|
3
|
|
|
|
|
6
|
eval { |
36
|
3
|
|
|
|
|
15
|
$_->proceed; |
37
|
|
|
|
|
|
|
}; |
38
|
3
|
|
|
|
|
2200570
|
$error = $@; |
39
|
3
|
|
|
|
|
22
|
my @stop = Time::HiRes::gettimeofday(); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Process the time |
42
|
3
|
|
|
|
|
7
|
$DISABLE++; |
43
|
3
|
|
|
|
|
7
|
eval { |
44
|
3
|
|
|
|
|
41
|
$handler->( |
45
|
|
|
|
|
|
|
$_->sub_name, |
46
|
|
|
|
|
|
|
\@start, |
47
|
|
|
|
|
|
|
\@stop, |
48
|
|
|
|
|
|
|
Time::HiRes::tv_interval( |
49
|
|
|
|
|
|
|
\@start, |
50
|
|
|
|
|
|
|
\@stop, |
51
|
|
|
|
|
|
|
) |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
}; |
54
|
3
|
|
|
|
|
73
|
$DISABLE--; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
3
|
100
|
|
|
|
38
|
die $error if $error; |
58
|
2
|
|
|
|
|
57
|
return; |
59
|
|
|
|
|
|
|
}, |
60
|
1
|
|
|
|
|
20
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub handler { |
64
|
0
|
|
|
0
|
0
|
|
my ( $name, $start, $stop, $interval ) = @_; |
65
|
0
|
|
|
|
|
|
printf STDERR "%s - %s\n", $interval, $name; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |