| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTTP::Engine::Middleware::Profile::Runtime; |
|
2
|
1
|
|
|
1
|
|
522
|
use Any::Moose; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
|
|
with 'HTTP::Engine::Middleware::Profile::Role'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
465
|
use Time::HiRes qw(time); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'start_time' => ( is => 'rw' ); |
|
8
|
|
|
|
|
|
|
has 'end_time' => ( is => 'rw' ); |
|
9
|
|
|
|
|
|
|
has 'send_header' => ( |
|
10
|
|
|
|
|
|
|
is => 'rw', |
|
11
|
|
|
|
|
|
|
default => 0, |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
has 'header_name' => ( |
|
14
|
|
|
|
|
|
|
is => 'rw', |
|
15
|
|
|
|
|
|
|
default => 'X-Runtime', |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub start { |
|
20
|
1
|
|
|
1
|
0
|
48
|
shift->start_time( time() ); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub end { |
|
24
|
1
|
|
|
1
|
0
|
3
|
shift->end_time( time() ); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub report { |
|
28
|
1
|
|
|
1
|
0
|
1
|
my($self, $c, $profile, $req, $res) = @_; |
|
29
|
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
3
|
my $elapsed = $self->end_time - $self->start_time; |
|
31
|
1
|
|
|
|
|
12
|
my $message = "Request handling execution time: $elapsed secs\n"; |
|
32
|
1
|
|
|
|
|
4
|
$profile->log( $message ); |
|
33
|
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
5
|
return unless $self->send_header; |
|
35
|
1
|
|
|
|
|
10
|
$res->header( $self->header_name => $elapsed ); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable;1; |