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