Filename | /usr/local/lib/perl5/site_perl/Mail/SpamAssassin/Util/ScopedTimer.pm |
Statements | Executed 10 statements in 510µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 47µs | 64µs | BEGIN@22 | Mail::SpamAssassin::Util::ScopedTimer::
1 | 1 | 1 | 31µs | 59µs | BEGIN@23 | Mail::SpamAssassin::Util::ScopedTimer::
1 | 1 | 1 | 30µs | 100µs | BEGIN@25 | Mail::SpamAssassin::Util::ScopedTimer::
1 | 1 | 1 | 22µs | 27µs | BEGIN@24 | Mail::SpamAssassin::Util::ScopedTimer::
0 | 0 | 0 | 0s | 0s | DESTROY | Mail::SpamAssassin::Util::ScopedTimer::
0 | 0 | 0 | 0s | 0s | new | Mail::SpamAssassin::Util::ScopedTimer::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # Helper code to debug dependencies and their versions. | ||||
2 | |||||
3 | # <@LICENSE> | ||||
4 | # Licensed to the Apache Software Foundation (ASF) under one or more | ||||
5 | # contributor license agreements. See the NOTICE file distributed with | ||||
6 | # this work for additional information regarding copyright ownership. | ||||
7 | # The ASF licenses this file to you under the Apache License, Version 2.0 | ||||
8 | # (the "License"); you may not use this file except in compliance with | ||||
9 | # the License. You may obtain a copy of the License at: | ||||
10 | # | ||||
11 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||
12 | # | ||||
13 | # Unless required by applicable law or agreed to in writing, software | ||||
14 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||
15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
16 | # See the License for the specific language governing permissions and | ||||
17 | # limitations under the License. | ||||
18 | # </@LICENSE> | ||||
19 | |||||
20 | package Mail::SpamAssassin::Util::ScopedTimer; | ||||
21 | |||||
22 | 2 | 61µs | 2 | 81µs | # spent 64µs (47+17) within Mail::SpamAssassin::Util::ScopedTimer::BEGIN@22 which was called:
# once (47µs+17µs) by Mail::SpamAssassin::BEGIN@80 at line 22 # spent 64µs making 1 call to Mail::SpamAssassin::Util::ScopedTimer::BEGIN@22
# spent 17µs making 1 call to strict::import |
23 | 2 | 60µs | 2 | 87µs | # spent 59µs (31+28) within Mail::SpamAssassin::Util::ScopedTimer::BEGIN@23 which was called:
# once (31µs+28µs) by Mail::SpamAssassin::BEGIN@80 at line 23 # spent 59µs making 1 call to Mail::SpamAssassin::Util::ScopedTimer::BEGIN@23
# spent 28µs making 1 call to warnings::import |
24 | 2 | 85µs | 2 | 32µs | # spent 27µs (22+5) within Mail::SpamAssassin::Util::ScopedTimer::BEGIN@24 which was called:
# once (22µs+5µs) by Mail::SpamAssassin::BEGIN@80 at line 24 # spent 27µs making 1 call to Mail::SpamAssassin::Util::ScopedTimer::BEGIN@24
# spent 5µs making 1 call to bytes::import |
25 | 2 | 277µs | 2 | 169µs | # spent 100µs (30+70) within Mail::SpamAssassin::Util::ScopedTimer::BEGIN@25 which was called:
# once (30µs+70µs) by Mail::SpamAssassin::BEGIN@80 at line 25 # spent 100µs making 1 call to Mail::SpamAssassin::Util::ScopedTimer::BEGIN@25
# spent 70µs making 1 call to re::import |
26 | |||||
27 | 1 | 14µs | our @ISA = qw(); | ||
28 | |||||
29 | sub new { | ||||
30 | my $class = shift; | ||||
31 | my $self = { | ||||
32 | main => shift, | ||||
33 | timer => shift, | ||||
34 | }; | ||||
35 | $self->{main}->timer_start($self->{timer}); | ||||
36 | return bless ($self, $class); | ||||
37 | } | ||||
38 | |||||
39 | # OO hack: when the object goes out of scope, the timer ends. neat! | ||||
40 | sub DESTROY { | ||||
41 | my $self = shift; | ||||
42 | # best practices: prevent potential calls to eval and to system routines | ||||
43 | # in code of a DESTROY method from clobbering global variables $@ and $! | ||||
44 | local($@,$!); # keep outer error handling unaffected by DESTROY | ||||
45 | $self->{main} && $self->{timer} && $self->{main}->timer_end($self->{timer}); | ||||
46 | } | ||||
47 | |||||
48 | 1 | 13µs | 1; |