| Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/Devel/GlobalDestruction.pm |
| Statements | Executed 12 statements in 312µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 819µs | 1.06ms | Devel::GlobalDestruction::BEGIN@8 |
| 1 | 1 | 1 | 10µs | 21µs | Devel::GlobalDestruction::BEGIN@3 |
| 1 | 1 | 1 | 7µs | 18µs | Devel::GlobalDestruction::BEGIN@23 |
| 1 | 1 | 1 | 6µs | 9µs | Devel::GlobalDestruction::BEGIN@4 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Devel::GlobalDestruction; | ||||
| 2 | |||||
| 3 | 2 | 20µs | 2 | 31µs | # spent 21µs (10+11) within Devel::GlobalDestruction::BEGIN@3 which was called:
# once (10µs+11µs) by Class::MOP::Package::BEGIN@15 at line 3 # spent 21µs making 1 call to Devel::GlobalDestruction::BEGIN@3
# spent 11µs making 1 call to strict::import |
| 4 | 2 | 48µs | 2 | 12µs | # spent 9µs (6+3) within Devel::GlobalDestruction::BEGIN@4 which was called:
# once (6µs+3µs) by Class::MOP::Package::BEGIN@15 at line 4 # spent 9µs making 1 call to Devel::GlobalDestruction::BEGIN@4
# spent 3µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 500ns | our $VERSION = '0.11'; | ||
| 7 | |||||
| 8 | 1 | 68µs | # spent 1.06ms (819µs+238µs) within Devel::GlobalDestruction::BEGIN@8 which was called:
# once (819µs+238µs) by Class::MOP::Package::BEGIN@15 at line 11 | ||
| 9 | exports => [ qw(in_global_destruction) ], | ||||
| 10 | groups => { default => [ -all ] }, | ||||
| 11 | 1 | 54µs | 2 | 1.16ms | }; # spent 1.06ms making 1 call to Devel::GlobalDestruction::BEGIN@8
# spent 99µs making 1 call to Sub::Exporter::Progressive::import |
| 12 | |||||
| 13 | # we run 5.14+ - everything is in core | ||||
| 14 | # | ||||
| 15 | 1 | 700ns | if (defined ${^GLOBAL_PHASE}) { | ||
| 16 | 1 | 27µs | eval 'sub in_global_destruction () { ${^GLOBAL_PHASE} eq q[DESTRUCT] }; 1' # spent 2µs executing statements in string eval | ||
| 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 | 87µs | 2 | 28µs | # spent 18µs (7+11) within Devel::GlobalDestruction::BEGIN@23 which was called:
# once (7µs+11µs) by Class::MOP::Package::BEGIN@15 at line 23 # spent 18µ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_start is nulled immediately before entering global destruction | ||||
| 31 | # and we can use B to detect that. It will also be null before the main runloop starts, | ||||
| 32 | # so we check install a CHECK if needed to detect that. | ||||
| 33 | require B; | ||||
| 34 | my $started = !B::main_start()->isa(q[B::NULL]); | ||||
| 35 | unless ($started) { | ||||
| 36 | # work around 5.6 eval bug | ||||
| 37 | eval '0 && $started; CHECK { $started = 1 }; 1' | ||||
| 38 | or die $@; | ||||
| 39 | } | ||||
| 40 | eval '0 && $started; sub in_global_destruction () { $started && B::main_start()->isa(q[B::NULL]) }; 1' | ||||
| 41 | or die $@; | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | 1 | 7µs | 1; # keep require happy | ||
| 45 | |||||
| 46 | |||||
| 47 | __END__ |