Filename | /opt/perl-5.18.1/lib/site_perl/5.18.1/Devel/GlobalDestruction.pm |
Statements | Executed 12 statements in 456µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.15ms | 1.37ms | BEGIN@8 | Devel::GlobalDestruction::
1 | 1 | 1 | 14µs | 30µs | BEGIN@3 | Devel::GlobalDestruction::
1 | 1 | 1 | 11µs | 28µs | BEGIN@23 | Devel::GlobalDestruction::
1 | 1 | 1 | 9µs | 13µs | BEGIN@4 | Devel::GlobalDestruction::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Devel::GlobalDestruction; | ||||
2 | |||||
3 | 2 | 31µs | 2 | 46µs | # spent 30µs (14+16) within Devel::GlobalDestruction::BEGIN@3 which was called:
# once (14µs+16µs) by Class::MOP::Package::BEGIN@15 at line 3 # spent 30µs making 1 call to Devel::GlobalDestruction::BEGIN@3
# spent 16µs making 1 call to strict::import |
4 | 2 | 69µs | 2 | 18µs | # spent 13µs (9+4) within Devel::GlobalDestruction::BEGIN@4 which was called:
# once (9µs+4µs) by Class::MOP::Package::BEGIN@15 at line 4 # spent 13µs making 1 call to Devel::GlobalDestruction::BEGIN@4
# spent 4µs making 1 call to warnings::import |
5 | |||||
6 | 1 | 800ns | our $VERSION = '0.11'; | ||
7 | |||||
8 | 1 | 103µs | # spent 1.37ms (1.15+217µs) within Devel::GlobalDestruction::BEGIN@8 which was called:
# once (1.15ms+217µs) by Class::MOP::Package::BEGIN@15 at line 11 | ||
9 | exports => [ qw(in_global_destruction) ], | ||||
10 | groups => { default => [ -all ] }, | ||||
11 | 1 | 83µs | 2 | 1.49ms | }; # spent 1.37ms making 1 call to Devel::GlobalDestruction::BEGIN@8
# spent 116µs making 1 call to Sub::Exporter::Progressive::import |
12 | |||||
13 | # we run 5.14+ - everything is in core | ||||
14 | # | ||||
15 | 1 | 1µs | if (defined ${^GLOBAL_PHASE}) { | ||
16 | 1 | 36µs | eval 'sub in_global_destruction () { ${^GLOBAL_PHASE} eq q[DESTRUCT] }; 1' # spent 3µ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 | 122µs | 2 | 45µs | # spent 28µs (11+17) within Devel::GlobalDestruction::BEGIN@23 which was called:
# once (11µs+17µs) by Class::MOP::Package::BEGIN@15 at line 23 # spent 28µs making 1 call to Devel::GlobalDestruction::BEGIN@23
# spent 17µ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 | 10µs | 1; # keep require happy | ||
45 | |||||
46 | |||||
47 | __END__ |