line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::MtPolicyd::Profiler; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
399
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
160
|
|
4
|
7
|
|
|
7
|
|
23
|
use warnings; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
154
|
|
5
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
2252
|
use MooseX::Singleton; |
|
7
|
|
|
|
|
694920
|
|
|
7
|
|
|
|
|
28
|
|
7
|
7
|
|
|
7
|
|
137392
|
use namespace::autoclean; |
|
7
|
|
|
|
|
16099
|
|
|
7
|
|
|
|
|
43
|
|
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
4508
|
use Mail::MtPolicyd::Profiler::Timer; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
246
|
|
10
|
7
|
|
|
7
|
|
3548
|
use JSON; |
|
7
|
|
|
|
|
40359
|
|
|
7
|
|
|
|
|
55
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '2.02'; # VERSION |
13
|
|
|
|
|
|
|
# ABSTRACT: a application level profiler for mtpolicyd |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'root' => ( is => 'rw', isa => 'Mail::MtPolicyd::Profiler::Timer', |
16
|
|
|
|
|
|
|
lazy => 1, |
17
|
|
|
|
|
|
|
default => sub { |
18
|
|
|
|
|
|
|
Mail::MtPolicyd::Profiler::Timer->new( name => 'main timer' ); |
19
|
|
|
|
|
|
|
}, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'current' => ( |
23
|
|
|
|
|
|
|
is => 'rw', isa => 'Mail::MtPolicyd::Profiler::Timer', |
24
|
|
|
|
|
|
|
handles => { |
25
|
|
|
|
|
|
|
'tick' => 'tick', |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
lazy => 1, |
28
|
|
|
|
|
|
|
default => sub { |
29
|
|
|
|
|
|
|
my $self = shift; |
30
|
|
|
|
|
|
|
return $self->root; |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub reset { |
35
|
1
|
|
|
1
|
0
|
318
|
my ( $self, $name ) = @_; |
36
|
1
|
|
|
|
|
34
|
my $timer = Mail::MtPolicyd::Profiler::Timer->new( name => 'main timer' ); |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
23
|
$self->root( $timer ); |
39
|
1
|
|
|
|
|
34
|
$self->current( $timer ); |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
12
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new_timer { |
45
|
5
|
|
|
5
|
0
|
11
|
my ( $self, $name ) = @_; |
46
|
5
|
|
|
|
|
121
|
my $timer = $self->current->new_child( name => $name ); |
47
|
5
|
|
|
|
|
117
|
$self->current( $timer ); |
48
|
5
|
|
|
|
|
64
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub stop_current_timer { |
52
|
6
|
|
|
6
|
0
|
15
|
my ( $self, $name ) = @_; |
53
|
6
|
|
|
|
|
147
|
$self->current->stop; |
54
|
6
|
100
|
|
|
|
139
|
if( defined $self->current->parent ) { |
55
|
5
|
|
|
|
|
112
|
$self->current($self->current->parent); |
56
|
|
|
|
|
|
|
} |
57
|
6
|
|
|
|
|
64
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub to_string { |
61
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
62
|
1
|
|
|
|
|
24
|
return $self->root->to_string; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=pod |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=encoding UTF-8 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Mail::MtPolicyd::Profiler - a application level profiler for mtpolicyd |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
version 2.02 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Markus Benning <ich@markusbenning.de> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software, licensed under: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |