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