Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Devel/GlobalDestruction.pm |
Statements | Executed 12 statements in 190µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 546µs | 641µs | BEGIN@8 | Devel::GlobalDestruction::
1 | 1 | 1 | 7µs | 20µs | BEGIN@23 | Devel::GlobalDestruction::
1 | 1 | 1 | 7µs | 8µs | BEGIN@3 | Devel::GlobalDestruction::
1 | 1 | 1 | 3µs | 5µs | BEGIN@4 | Devel::GlobalDestruction::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Devel::GlobalDestruction; | ||||
2 | |||||
3 | 2 | 12µs | 2 | 9µs | # spent 8µs (7+1) within Devel::GlobalDestruction::BEGIN@3 which was called:
# once (7µs+1µs) by Class::MOP::Package::BEGIN@8 at line 3 # spent 8µs making 1 call to Devel::GlobalDestruction::BEGIN@3
# spent 1µs making 1 call to strict::import |
4 | 2 | 31µs | 2 | 7µs | # spent 5µs (3+2) within Devel::GlobalDestruction::BEGIN@4 which was called:
# once (3µs+2µs) by Class::MOP::Package::BEGIN@8 at line 4 # spent 5µs making 1 call to Devel::GlobalDestruction::BEGIN@4
# spent 2µs making 1 call to warnings::import |
5 | |||||
6 | 1 | 300ns | our $VERSION = '0.13'; | ||
7 | |||||
8 | 1 | 5µs | 1 | 59µs | # spent 641µs (546+94) within Devel::GlobalDestruction::BEGIN@8 which was called:
# once (546µs+94µs) by Class::MOP::Package::BEGIN@8 at line 11 # spent 59µs making 1 call to Sub::Exporter::Progressive::import |
9 | exports => [ qw(in_global_destruction) ], | ||||
10 | groups => { default => [ -all ] }, | ||||
11 | 1 | 77µs | 1 | 641µs | }; # spent 641µs making 1 call to Devel::GlobalDestruction::BEGIN@8 |
12 | |||||
13 | # we run 5.14+ - everything is in core | ||||
14 | # | ||||
15 | 1 | 600ns | if (defined ${^GLOBAL_PHASE}) { | ||
16 | 1 | 21µ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 | 39µs | 2 | 34µs | # spent 20µs (7+14) within Devel::GlobalDestruction::BEGIN@23 which was called:
# once (7µs+14µs) by Class::MOP::Package::BEGIN@8 at line 23 # spent 20µs making 1 call to Devel::GlobalDestruction::BEGIN@23
# spent 14µ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 | 4µs | 1; # keep require happy | ||
39 | |||||
40 | |||||
41 | __END__ |