Filename | /usr/local/share/perl/5.18.2/B/Hooks/EndOfScope/XS.pm |
Statements | Executed 27 statements in 617µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.11ms | 2.72ms | BEGIN@9 | B::Hooks::EndOfScope::XS::
2 | 2 | 2 | 31µs | 63µs | on_scope_end | B::Hooks::EndOfScope::XS::
1 | 1 | 1 | 22µs | 125µs | BEGIN@10 | B::Hooks::EndOfScope::XS::
2 | 2 | 2 | 22µs | 2.55ms | __ANON__[:17] | B::Hooks::EndOfScope::XS::
1 | 1 | 1 | 14µs | 32µs | BEGIN@4 | B::Hooks::EndOfScope::XS::
1 | 1 | 1 | 10µs | 16µs | BEGIN@5 | B::Hooks::EndOfScope::XS::
2 | 1 | 1 | 4µs | 4µs | __ANON__[:16] | B::Hooks::EndOfScope::XS::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package B::Hooks::EndOfScope::XS; | ||||
2 | # ABSTRACT: Execute code after a scope finished compilation - XS implementation | ||||
3 | |||||
4 | 2 | 31µs | 2 | 49µs | # spent 32µs (14+18) within B::Hooks::EndOfScope::XS::BEGIN@4 which was called:
# once (14µs+18µs) by Module::Runtime::require_module at line 4 # spent 32µs making 1 call to B::Hooks::EndOfScope::XS::BEGIN@4
# spent 18µs making 1 call to strict::import |
5 | 2 | 107µs | 2 | 22µs | # spent 16µs (10+6) within B::Hooks::EndOfScope::XS::BEGIN@5 which was called:
# once (10µs+6µs) by Module::Runtime::require_module at line 5 # spent 16µs making 1 call to B::Hooks::EndOfScope::XS::BEGIN@5
# spent 6µs making 1 call to warnings::import |
6 | |||||
7 | 1 | 900ns | our $VERSION = '0.15'; | ||
8 | |||||
9 | 3 | 159µs | 2 | 2.73ms | # spent 2.72ms (1.11+1.61) within B::Hooks::EndOfScope::XS::BEGIN@9 which was called:
# once (1.11ms+1.61ms) by Module::Runtime::require_module at line 9 # spent 2.72ms making 1 call to B::Hooks::EndOfScope::XS::BEGIN@9
# spent 13µs making 1 call to UNIVERSAL::VERSION |
10 | 1 | 8µs | 1 | 92µs | # spent 125µs (22+103) within B::Hooks::EndOfScope::XS::BEGIN@10 which was called:
# once (22µs+103µs) by Module::Runtime::require_module at line 13 # spent 92µs making 1 call to Sub::Exporter::Progressive::import |
11 | exports => ['on_scope_end'], | ||||
12 | groups => { default => ['on_scope_end'] }, | ||||
13 | 2 | 213µs | 2 | 136µs | }; # spent 125µs making 1 call to B::Hooks::EndOfScope::XS::BEGIN@10
# spent 11µs making 1 call to UNIVERSAL::VERSION |
14 | |||||
15 | my $wiz = Variable::Magic::wizard | ||||
16 | 2 | 9µs | # spent 4µs within B::Hooks::EndOfScope::XS::__ANON__[/usr/local/share/perl/5.18.2/B/Hooks/EndOfScope/XS.pm:16] which was called 2 times, avg 2µs/call:
# 2 times (4µs+0s) by Variable::Magic::cast at line 36, avg 2µs/call | ||
17 | 4 | 19µs | 2 | 2.52ms | # spent 2.55ms (22µs+2.52) within B::Hooks::EndOfScope::XS::__ANON__[/usr/local/share/perl/5.18.2/B/Hooks/EndOfScope/XS.pm:17] which was called 2 times, avg 1.27ms/call:
# once (12µs+2.38ms) by main::BEGIN@7 at line 198 of String/Markov.pm
# once (10µs+146µs) by String::Markov::BEGIN@9 at line 216 of namespace/autoclean.pm # spent 2.38ms making 1 call to namespace::autoclean::__ANON__[namespace/autoclean.pm:183]
# spent 146µs making 1 call to namespace::clean::__ANON__[namespace/clean.pm:178] |
18 | # When someone localise %^H, our magic doesn't want to be copied | ||||
19 | # down. We want it to be around only for the scope we've initially | ||||
20 | # attached ourselfs to. Merely having MGf_LOCAL and a noop svt_local | ||||
21 | # callback achieves this. If anything wants to attach more magic of our | ||||
22 | # kind to a localised %^H, things will continue to just work as we'll be | ||||
23 | # attached with a new and empty callback list. | ||||
24 | 1 | 7µs | 1 | 47µs | local => \undef # spent 47µs making 1 call to Variable::Magic::wizard |
25 | ; | ||||
26 | |||||
27 | # spent 63µs (31+31) within B::Hooks::EndOfScope::XS::on_scope_end which was called 2 times, avg 31µs/call:
# once (21µs+23µs) by namespace::clean::import at line 178 of namespace/clean.pm
# once (10µs+9µs) by namespace::autoclean::import at line 183 of namespace/autoclean.pm | ||||
28 | 2 | 1µs | my $cb = shift; | ||
29 | |||||
30 | 2 | 2µs | $^H |= 0x020000; | ||
31 | |||||
32 | 2 | 30µs | 2 | 6µs | if (my $stack = Variable::Magic::getdata %^H, $wiz) { # spent 6µs making 2 calls to Variable::Magic::getdata, avg 3µs/call |
33 | push @{ $stack }, $cb; | ||||
34 | } | ||||
35 | else { | ||||
36 | 2 | 24µs | 4 | 30µs | Variable::Magic::cast %^H, $wiz, $cb; # spent 26µs making 2 calls to Variable::Magic::cast, avg 13µs/call
# spent 4µs making 2 calls to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:16], avg 2µs/call |
37 | } | ||||
38 | } | ||||
39 | |||||
40 | |||||
41 | #pod =head1 DESCRIPTION | ||||
42 | #pod | ||||
43 | #pod This is the implementation of L<B::Hooks::EndOfScope> based on | ||||
44 | #pod L<Variable::Magic>, which is an XS module dependent on a compiler. It will | ||||
45 | #pod always be automatically preferred if L<Variable::Magic> is available. | ||||
46 | #pod | ||||
47 | #pod =func on_scope_end | ||||
48 | #pod | ||||
49 | #pod on_scope_end { ... }; | ||||
50 | #pod | ||||
51 | #pod on_scope_end $code; | ||||
52 | #pod | ||||
53 | #pod Registers C<$code> to be executed after the surrounding scope has been | ||||
54 | #pod compiled. | ||||
55 | #pod | ||||
56 | #pod This is exported by default. See L<Sub::Exporter> on how to customize it. | ||||
57 | #pod | ||||
58 | #pod =cut | ||||
59 | |||||
60 | 1 | 5µs | 1; | ||
61 | |||||
62 | __END__ |