← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 10:04:38 2014
Reported on Tue Jun 24 10:05:20 2014

Filename/usr/local/lib/site_perl/Log/Filter/Module.pm
StatementsExecuted 23 statements in 463µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11112µs15µsLog::Filter::Module::::BEGIN@2Log::Filter::Module::BEGIN@2
11110µs35µsLog::Filter::Module::::BEGIN@105Log::Filter::Module::BEGIN@105
1117µs32µsLog::Filter::Module::::BEGIN@101Log::Filter::Module::BEGIN@101
1117µs39µsLog::Filter::Module::::BEGIN@73Log::Filter::Module::BEGIN@73
1117µs25µsLog::Filter::Module::::BEGIN@81Log::Filter::Module::BEGIN@81
1117µs33µsLog::Filter::Module::::BEGIN@99Log::Filter::Module::BEGIN@99
1116µs11µsLog::Filter::Module::::BEGIN@3Log::Filter::Module::BEGIN@3
1116µs35µsLog::Filter::Module::::BEGIN@98Log::Filter::Module::BEGIN@98
1116µs30µsLog::Filter::Module::::BEGIN@102Log::Filter::Module::BEGIN@102
1115µs29µsLog::Filter::Module::::BEGIN@104Log::Filter::Module::BEGIN@104
1113µs3µsLog::Filter::Module::::BEGIN@80Log::Filter::Module::BEGIN@80
1112µs2µsLog::Filter::Module::::ENDLog::Filter::Module::END
0000s0sLog::Filter::Module::::_initLog::Filter::Module::_init
0000s0sLog::Filter::Module::::acceptLog::Filter::Module::accept
0000s0sLog::Filter::Module::::newLog::Filter::Module::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Log::Filter::Module;
2222µs218µs
# spent 15µs (12+3) within Log::Filter::Module::BEGIN@2 which was called: # once (12µs+3µs) by Log::Filter::All::BEGIN@71 at line 2
use strict;
# spent 15µs making 1 call to Log::Filter::Module::BEGIN@2 # spent 3µs making 1 call to strict::import
3254µs216µs
# spent 11µs (6+5) within Log::Filter::Module::BEGIN@3 which was called: # once (6µs+5µs) by Log::Filter::All::BEGIN@71 at line 3
use warnings;
# spent 11µs making 1 call to Log::Filter::Module::BEGIN@3 # spent 5µs making 1 call to warnings::import
4
5################################################################################
6#
7# DOCUMENTATION SECTION
8#
9################################################################################
10
11=head1 NAME
12
13Log::Filter::Module - Base module defining mandatory interface for all log filtering modules
14
15=head1 SYNOPSIS
16
17 use Log::Filter::Module;
18
19 BEGIN {
20 @ISA = ('Log::Filter::Module');
21 }
22
23=head1 DESCRIPTION
24
25Classes extending this base class may be used as FILTERS in loging framework.
26Filters are used in channels for restricting messages, that will be passed
27to the writers.
28
29Filters are intended to be used in chains. Most important is the accept()
30method, which returns array containing the result of the filtering (message
31is ACCEPTed or REJECTed) and flag determining, if the evaluation should
32CONTINUE, or FINISH. The caller is responsible for appropriate reaction.
33
34=head1 USAGE
35
36=head1 BUGS
37
38=head1 SUPPORT
39
40=head1 AUTHOR
41
42Jan Mach
43Cesnet, z.s.p.o
44jan.mach@cesnet.cz
45http://www.cesnet.cz
46
47=head1 COPYRIGHT
48
49This program is free software; you can redistribute
50it and/or modify it under the same terms as Perl itself.
51
52The full text of the license can be found in the
53LICENSE file included with this module.
54
55
56=head1 SEE ALSO
57
58perl(1).
59
60=head1 FUNCTION REFERENCE
61
62=over 4
63
64=cut
65
66################################################################################
67#
68# INITIALIZATION AND CLEANUP SECTION
69#
70################################################################################
71
72#-- Perl core modules ---------------------------------------------------------#
73241µs271µs
# spent 39µs (7+32) within Log::Filter::Module::BEGIN@73 which was called: # once (7µs+32µs) by Log::Filter::All::BEGIN@71 at line 73
use Carp;
# spent 39µs making 1 call to Log::Filter::Module::BEGIN@73 # spent 32µs making 1 call to Exporter::import
74
75#-- Perl CPAN modules ---------------------------------------------------------#
76
77#-- Custom application modules ------------------------------------------------#
78
79#-- Module initializations ----------------------------------------------------#
80
# spent 3µs within Log::Filter::Module::BEGIN@80 which was called: # once (3µs+0s) by Log::Filter::All::BEGIN@71 at line 83
BEGIN {
81224µs242µs
# spent 25µs (7+18) within Log::Filter::Module::BEGIN@81 which was called: # once (7µs+18µs) by Log::Filter::All::BEGIN@71 at line 81
use vars qw($VERSION);
# spent 25µs making 1 call to Log::Filter::Module::BEGIN@81 # spent 18µs making 1 call to vars::import
8213µs $VERSION = '0.01';
83133µs13µs}
# spent 3µs making 1 call to Log::Filter::Module::BEGIN@80
84
85
86#-- Module clean-up code (global destructor) ----------------------------------#
8712µs
# spent 2µs within Log::Filter::Module::END which was called: # once (2µs+0s) by main::RUNTIME at line 0 of mentat.storage.mongo.pl
END {
88
89}
90
91################################################################################
92#
93# CONSTANTS AND GLOBAL VARIABLES DEFINITION SECTION
94#
95################################################################################
96
97#-- Constants -----------------------------------------------------------------#
98228µs263µs
# spent 35µs (6+28) within Log::Filter::Module::BEGIN@98 which was called: # once (6µs+28µs) by Log::Filter::All::BEGIN@71 at line 98
use constant ACCEPT => 1; # Message passed the filter
# spent 35µs making 1 call to Log::Filter::Module::BEGIN@98 # spent 28µs making 1 call to constant::import
99225µs259µs
# spent 33µs (7+26) within Log::Filter::Module::BEGIN@99 which was called: # once (7µs+26µs) by Log::Filter::All::BEGIN@71 at line 99
use constant REJECT => 0; # Message did not pass the filter
# spent 33µs making 1 call to Log::Filter::Module::BEGIN@99 # spent 26µs making 1 call to constant::import
100
101223µs258µs
# spent 32µs (7+25) within Log::Filter::Module::BEGIN@101 which was called: # once (7µs+25µs) by Log::Filter::All::BEGIN@71 at line 101
use constant REQUIRED => 'req'; # Filter is required
# spent 32µs making 1 call to Log::Filter::Module::BEGIN@101 # spent 25µs making 1 call to constant::import
102222µs254µs
# spent 30µs (6+24) within Log::Filter::Module::BEGIN@102 which was called: # once (6µs+24µs) by Log::Filter::All::BEGIN@71 at line 102
use constant SUFFICIENT => 'suf'; # Filter is sufficient
# spent 30µs making 1 call to Log::Filter::Module::BEGIN@102 # spent 24µs making 1 call to constant::import
103
104225µs253µs
# spent 29µs (5+24) within Log::Filter::Module::BEGIN@104 which was called: # once (5µs+24µs) by Log::Filter::All::BEGIN@71 at line 104
use constant CONTINUE => 1; # Evaluation must continue with next filter in chain
# spent 29µs making 1 call to Log::Filter::Module::BEGIN@104 # spent 24µs making 1 call to constant::import
1052158µs259µs
# spent 35µs (10+25) within Log::Filter::Module::BEGIN@105 which was called: # once (10µs+25µs) by Log::Filter::All::BEGIN@71 at line 105
use constant FINISH => 0; # Evaluation is completed
# spent 35µs making 1 call to Log::Filter::Module::BEGIN@105 # spent 25µs making 1 call to constant::import
106
107#-- Static public class variables (our) ---------------------------------------#
108
109#-- Static protected class variables (my) -------------------------------------#
110
111################################################################################
112#
113# IMPLEMENTATION SECTION
114#
115################################################################################
116
117=item new() [PUBLIC,STATIC]
118
119 Usage : my $filter = Log::Filter::(module)->new(... arguments);
120 Purpose : Create new instance of log filter
121 Returns : Reference to the new instance
122 Arguments : All arguments are passed to the _init() method
123 Throws : Croaks, if invoked on object
124 Comments : This method should not be overloaded, descendants should implement their version of _init() method instead
125 See Also : _init() method
126
127=cut
128
129sub new
130{
131 my $class = shift;
132 croak ((caller(0))[3] . ": class method invoked on object") if ref $class;
133 my $self = bless ({}, $class);
134 return $self->_init(@_);
135}
136
137=item accept($$$) [ABSTRACT,PUBLIC]
138
139 Usage : my ($result, $continue) = $filter->accept($source, $severity, $message);
140 Purpose : Check, if the filter will accept the given message
141 Returns : Array (ACCEPT|REJECT,CONTINUE|FINISH)
142 Arguments : string $source - Name of the source of the message
143 enum $severity - Severity in integer or string format (see Log::Core::Essentials for permited values)
144 string $message - Message
145 Throws : Croaks, if not implemented in descendant classes
146 Comments : ABSTRACT method, must be implemented in descendant classes
147 See Also :
148
149=cut
150
151sub accept($$$) {
152 my $self = shift;
153 croak ((caller(0))[3] . ": method needs implementation");
154}
155
156=item _init() [ABSTRACT,PROTECTED]
157
158 Usage : Used from constructor as follows: return $self->_init(@_);
159 Purpose : Initialize newly created filter instance
160 Returns : Must return $self
161 Arguments : Unknown, depend on the implementation
162 Throws : Croaks, if not implemented in descendant classes
163 Comments : ABSTRACT method, must be implemented in descendant classes
164 See Also : new() method
165
166=cut
167
168sub _init {
169 my $self = shift;
170 croak ((caller(0))[3] . ": method needs implementation");
171}
172
173=pod
174
175=back
176
177=cut
178
17912µs1;