line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::MtPolicyd::Profiler; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
449
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
168
|
|
4
|
7
|
|
|
7
|
|
2180
|
use MooseX::Singleton; |
|
7
|
|
|
|
|
709998
|
|
|
7
|
|
|
|
|
26
|
|
5
|
7
|
|
|
7
|
|
141961
|
use namespace::autoclean; |
|
7
|
|
|
|
|
16095
|
|
|
7
|
|
|
|
|
39
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
3225
|
use Mail::MtPolicyd::Profiler::Timer; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
234
|
|
8
|
7
|
|
|
7
|
|
3500
|
use JSON; |
|
7
|
|
|
|
|
40023
|
|
|
7
|
|
|
|
|
34
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '2.01'; # 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
|
346
|
my ( $self, $name ) = @_; |
34
|
1
|
|
|
|
|
37
|
my $timer = Mail::MtPolicyd::Profiler::Timer->new( name => 'main timer' ); |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
28
|
$self->root( $timer ); |
37
|
1
|
|
|
|
|
38
|
$self->current( $timer ); |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
13
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub new_timer { |
43
|
5
|
|
|
5
|
0
|
15
|
my ( $self, $name ) = @_; |
44
|
5
|
|
|
|
|
130
|
my $timer = $self->current->new_child( name => $name ); |
45
|
5
|
|
|
|
|
120
|
$self->current( $timer ); |
46
|
5
|
|
|
|
|
63
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub stop_current_timer { |
50
|
6
|
|
|
6
|
0
|
14
|
my ( $self, $name ) = @_; |
51
|
6
|
|
|
|
|
144
|
$self->current->stop; |
52
|
6
|
100
|
|
|
|
138
|
if( defined $self->current->parent ) { |
53
|
5
|
|
|
|
|
111
|
$self->current($self->current->parent); |
54
|
|
|
|
|
|
|
} |
55
|
6
|
|
|
|
|
66
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub to_string { |
59
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
60
|
1
|
|
|
|
|
29
|
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 2.01 |
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 |