Filename | /usr/local/share/perl/5.14.2/Devel/GlobalDestruction.pm |
Statements | Executed 12 statements in 315µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 877µs | 1.05ms | BEGIN@8 | Devel::GlobalDestruction::
1 | 1 | 1 | 12µs | 15µs | BEGIN@3 | Devel::GlobalDestruction::
1 | 1 | 1 | 8µs | 20µs | BEGIN@23 | Devel::GlobalDestruction::
1 | 1 | 1 | 6µs | 10µs | BEGIN@4 | Devel::GlobalDestruction::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Devel::GlobalDestruction; | ||||
2 | |||||
3 | 2 | 22µs | 2 | 18µs | # spent 15µs (12+3) within Devel::GlobalDestruction::BEGIN@3 which was called:
# once (12µs+3µs) by Class::MOP::Package::BEGIN@15 at line 3 # spent 15µs making 1 call to Devel::GlobalDestruction::BEGIN@3
# spent 3µs making 1 call to strict::import |
4 | 2 | 48µs | 2 | 15µs | # spent 10µs (6+4) within Devel::GlobalDestruction::BEGIN@4 which was called:
# once (6µs+4µs) by Class::MOP::Package::BEGIN@15 at line 4 # spent 10µs making 1 call to Devel::GlobalDestruction::BEGIN@4
# spent 4µs making 1 call to warnings::import |
5 | |||||
6 | 1 | 700ns | our $VERSION = '0.12'; | ||
7 | |||||
8 | 1 | 99µs | # spent 1.05ms (877µs+173µs) within Devel::GlobalDestruction::BEGIN@8 which was called:
# once (877µs+173µs) by Class::MOP::Package::BEGIN@15 at line 11 # spent 99µs making 1 call to Sub::Exporter::Progressive::import | ||
9 | exports => [ qw(in_global_destruction) ], | ||||
10 | groups => { default => [ -all ] }, | ||||
11 | 2 | 154µs | 1 | 1.05ms | }; # spent 1.05ms making 1 call to Devel::GlobalDestruction::BEGIN@8 |
12 | |||||
13 | # we run 5.14+ - everything is in core | ||||
14 | # | ||||
15 | 1 | 1µs | if (defined ${^GLOBAL_PHASE}) { | ||
16 | 1 | 27µs | eval 'sub in_global_destruction () { ${^GLOBAL_PHASE} eq q[DESTRUCT] }; 1' # spent 18µs executing statements in string eval # includes 12µs spent executing 5 calls to 1 sub defined therein. | ||
17 | or die $@; | ||||
18 | } | ||||
19 | # try to load the xs version if it was compiled | ||||
20 | # | ||||
21 | elsif (eval { | ||||
22 | require Devel::GlobalDestruction::XS; | ||||
23 | 2 | 56µs | 2 | 31µs | # spent 20µs (8+11) within Devel::GlobalDestruction::BEGIN@23 which was called:
# once (8µs+11µs) by Class::MOP::Package::BEGIN@15 at line 23 # spent 20µs making 1 call to Devel::GlobalDestruction::BEGIN@23
# spent 11µs making 1 call to warnings::unimport |
24 | *in_global_destruction = \&Devel::GlobalDestruction::XS::in_global_destruction; | ||||
25 | 1; | ||||
26 | }) { | ||||
27 | # the eval already installed everything, nothing to do | ||||
28 | } | ||||
29 | else { | ||||
30 | # internally, PL_main_cv is set to Nullcv immediately before entering | ||||
31 | # global destruction and we can use B to detect that. B::main_cv will | ||||
32 | # only ever be a B::CV or a B::SPECIAL that is a reference to 0 | ||||
33 | require B; | ||||
34 | eval 'sub in_global_destruction () { ${B::main_cv()} == 0 }; 1' | ||||
35 | or die $@; | ||||
36 | } | ||||
37 | |||||
38 | 1 | 6µs | 1; # keep require happy | ||
39 | |||||
40 | |||||
41 | __END__ |