Filename | /usr/share/perl5/Devel/GlobalDestruction.pm |
Statements | Executed 12 statements in 397µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 22µs | 110µs | BEGIN@8 | Devel::GlobalDestruction::
1 | 1 | 1 | 17µs | 23µs | BEGIN@3 | Devel::GlobalDestruction::
1 | 1 | 1 | 9µs | 18µs | BEGIN@23 | Devel::GlobalDestruction::
1 | 1 | 1 | 7µs | 12µs | BEGIN@4 | Devel::GlobalDestruction::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Devel::GlobalDestruction; | ||||
2 | |||||
3 | 2 | 38µs | 2 | 29µs | # spent 23µs (17+6) within Devel::GlobalDestruction::BEGIN@3 which was called:
# once (17µs+6µs) by Moo::_Utils::BEGIN@14 at line 3 # spent 23µs making 1 call to Devel::GlobalDestruction::BEGIN@3
# spent 6µs making 1 call to strict::import |
4 | 2 | 78µs | 2 | 16µs | # spent 12µs (7+4) within Devel::GlobalDestruction::BEGIN@4 which was called:
# once (7µs+4µs) by Moo::_Utils::BEGIN@14 at line 4 # spent 12µs making 1 call to Devel::GlobalDestruction::BEGIN@4
# spent 4µs making 1 call to warnings::import |
5 | |||||
6 | 1 | 400ns | our $VERSION = '0.13'; | ||
7 | |||||
8 | 1 | 107µs | 1 | 88µs | # spent 110µs (22+88) within Devel::GlobalDestruction::BEGIN@8 which was called:
# once (22µs+88µs) by Moo::_Utils::BEGIN@14 at line 11 # spent 88µs making 1 call to Sub::Exporter::Progressive::import |
9 | exports => [ qw(in_global_destruction) ], | ||||
10 | groups => { default => [ -all ] }, | ||||
11 | 1 | 56µs | 1 | 110µs | }; # spent 110µs making 1 call to Devel::GlobalDestruction::BEGIN@8 |
12 | |||||
13 | # we run 5.14+ - everything is in core | ||||
14 | # | ||||
15 | 1 | 2µs | if (defined ${^GLOBAL_PHASE}) { | ||
16 | 1 | 30µs | eval 'sub in_global_destruction () { ${^GLOBAL_PHASE} eq q[DESTRUCT] }; 1' # spent 433µs executing statements in string eval # includes 291µs spent executing 174 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 | 80µs | 2 | 26µs | # spent 18µs (9+9) within Devel::GlobalDestruction::BEGIN@23 which was called:
# once (9µs+9µs) by Moo::_Utils::BEGIN@14 at line 23 # spent 18µs making 1 call to Devel::GlobalDestruction::BEGIN@23
# spent 9µ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 | 5µs | 1; # keep require happy | ||
39 | |||||
40 | |||||
41 | __END__ |