← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:10 2010

File /usr/local/share/perl/5.10.0/B/Hooks/EndOfScope.pm
Statements Executed 84
Total Time 0.0007642 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
82296µs233µsB::Hooks::EndOfScope::::on_scope_endB::Hooks::EndOfScope::on_scope_end
0000s0sB::Hooks::EndOfScope::::BEGINB::Hooks::EndOfScope::BEGIN
0000s0sB::Hooks::EndOfScope::::__ANON__[:46]B::Hooks::EndOfScope::__ANON__[:46]
0000s0sB::Hooks::EndOfScope::::__ANON__[:47]B::Hooks::EndOfScope::__ANON__[:47]
LineStmts.Exclusive
Time
Avg.Code
1329µs10µsuse strict;
# spent 10µs making 1 call to strict::import
2335µs12µsuse warnings;
# spent 22µs making 1 call to warnings::import
3
4package B::Hooks::EndOfScope;
5
6339µs13µsuse 5.008000;
73124µs41µsuse Variable::Magic;
# spent 35µs making 1 call to Exporter::import
8
911µs1µsour $VERSION = '0.08';
10
11use Sub::Exporter -setup => {
12 exports => ['on_scope_end'],
13 groups => { default => ['on_scope_end'] },
143217µs72µs};
15
16=head1 NAME
17
18B::Hooks::EndOfScope - Execute code after a scope finished compilation
19
20=head1 SYNOPSIS
21
22 on_scope_end { ... };
23
24=head1 DESCRIPTION
25
26This module allows you to execute code when perl finished compiling the
27surrounding scope.
28
29=head1 FUNCTIONS
30
31=head2 on_scope_end
32
33 on_scope_end { ... };
34
35 on_scope_end $code;
36
37Registers C<$code> to be executed after the surrounding scope has been
38compiled.
39
40This is exported by default. See L<Sub::Exporter> on how to customize it.
41
42=cut
43
44{
451800ns800ns my $wiz = Variable::Magic::wizard
46811µs1µs data => sub { [$_[1]] },
4725113µs5µs free => sub { $_->() for @{ $_[1] }; () };
48
49
# spent 233µs (96+137) within B::Hooks::EndOfScope::on_scope_end which was called 8 times, avg 29µs/call: # 7 times (84µs+101µs) by namespace::autoclean::import or namespace::autoclean::__ANON__[/usr/local/share/perl/5.10.0/namespace/autoclean.pm:57] at line 57 of /usr/local/share/perl/5.10.0/namespace/autoclean.pm, avg 26µs/call # once (12µs+36µs) by namespace::clean::import or namespace::clean::__ANON__[/usr/local/share/perl/5.10.0/namespace/clean.pm:246] at line 246 of /usr/local/share/perl/5.10.0/namespace/clean.pm
sub on_scope_end (&) {
5024108µs4µs my $cb = shift;
51
52 $^H |= 0x020000;
53
54837µs5µs if (my $stack = Variable::Magic::getdata %^H, $wiz) {
# spent 59µs making 8 calls to Variable::Magic::getdata, avg 7µs/call
55 push @{ $stack }, $cb;
56 }
57 else {
58142µs42µs Variable::Magic::cast %^H, $wiz, $cb;
# spent 77µs making 8 calls to Variable::Magic::cast, avg 10µs/call
59 }
60 }
61}
62
63=head1 SEE ALSO
64
65L<Sub::Exporter>
66
67L<Variable::Magic>
68
69=head1 AUTHOR
70
71Florian Ragwitz E<lt>rafl@debian.orgE<gt>
72
73=head1 COPYRIGHT AND LICENSE
74
75Copyright (c) 2008 Florian Ragwitz
76
77This module is free software.
78
79You may distribute this code under the same terms as Perl itself.
80
81=cut
82
8319µs9µs1;