← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/dpath
  Run on Tue Jun 5 15:31:33 2012
Reported on Tue Jun 5 15:31:47 2012

Filename/home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/aliased.pm
StatementsExecuted 104 statements in 3.17ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
511931µs354msaliased::::_load_aliasaliased::_load_alias (recurses: max depth 1, inclusive time 2.13ms)
511338µs502µsaliased::::_make_aliasaliased::_make_alias
552202µs355msaliased::::importaliased::import (recurses: max depth 1, inclusive time 2.39ms)
51198µs164µsaliased::::_get_aliasaliased::_get_alias
51167µs67µsaliased::::CORE:substaliased::CORE:subst (opcode)
11156µs72µsaliased::::BEGIN@8aliased::BEGIN@8
11130µs86µsaliased::::BEGIN@35aliased::BEGIN@35
0000s0saliased::::__ANON__[:36]aliased::__ANON__[:36]
0000s0saliased::::aliasaliased::alias
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package aliased;
212µs$VERSION = '0.30';
3
412µsrequire Exporter;
5126µs@ISA = qw(Exporter);
613µs@EXPORT = qw(alias);
7
82696µs289µs
# spent 72µs (56+16) within aliased::BEGIN@8 which was called: # once (56µs+16µs) by Data::DPath::Path::BEGIN@14 at line 8
use strict;
# spent 72µs making 1 call to aliased::BEGIN@8 # spent 16µs making 1 call to strict::import
9
10
# spent 355ms (202µs+355) within aliased::import which was called 5 times, avg 70.9ms/call: # once (39µs+339ms) by Data::DPath::Path::BEGIN@16 at line 16 of Data/DPath/Path.pm # once (47µs+13.3ms) by Data::DPath::Path::BEGIN@14 at line 14 of Data/DPath/Path.pm # once (36µs+2.42ms) by Data::DPath::Path::BEGIN@15 at line 15 of Data/DPath/Path.pm # once (49µs+-49µs) by Data::DPath::Context::BEGIN@14 at line 14 of Data/DPath/Context.pm # once (31µs+-31µs) by Data::DPath::Context::BEGIN@15 at line 15 of Data/DPath/Context.pm
sub import {
11524µs my ( $class, $package, $alias, @import ) = @_;
12
13511µs if ( @_ <= 1 ) {
14 $class->export_to_level(1);
15 return;
16 }
17
18511µs my $callpack = caller(0);
19
20536µs5354ms _load_alias( $package, $callpack, @import );
# spent 356ms making 5 calls to aliased::_load_alias, avg 71.3ms/call, recursion: max depth 1, sum of overlapping time 2.13ms
215112µs5502µs _make_alias( $package, $callpack, $alias );
# spent 502µs making 5 calls to aliased::_make_alias, avg 100µs/call
22}
23
24
# spent 164µs (98+67) within aliased::_get_alias which was called 5 times, avg 33µs/call: # 5 times (98µs+67µs) by aliased::_make_alias at line 33, avg 33µs/call
sub _get_alias {
25510µs my $package = shift;
265112µs567µs $package =~ s/.*(?:::|')//;
# spent 67µs making 5 calls to aliased::CORE:subst, avg 13µs/call
27560µs return $package;
28}
29
30
# spent 502µs (338+164) within aliased::_make_alias which was called 5 times, avg 100µs/call: # 5 times (338µs+164µs) by aliased::import at line 21, avg 100µs/call
sub _make_alias {
31523µs my ( $package, $callpack, $alias ) = @_;
32
33537µs5164µs $alias ||= _get_alias($package);
# spent 164µs making 5 calls to aliased::_get_alias, avg 33µs/call
34
352815µs2143µs
# spent 86µs (30+56) within aliased::BEGIN@35 which was called: # once (30µs+56µs) by Data::DPath::Path::BEGIN@14 at line 35
no strict 'refs';
# spent 86µs making 1 call to aliased::BEGIN@35 # spent 56µs making 1 call to strict::unimport
365265µs *{ join q{::} => $callpack, $alias } = sub () { $package };
37}
38
39
# spent 354ms (931µs+353) within aliased::_load_alias which was called 5 times, avg 70.9ms/call: # 5 times (931µs+353ms) by aliased::import at line 20, avg 70.9ms/call
sub _load_alias {
40516µs my ( $package, $callpack, @import ) = @_;
41
42 # We don't localize $SIG{__DIE__} here because we need to be careful about
43 # restoring its value if there is a failure. Very, very tricky.
44511µs my $sigdie = $SIG{__DIE__};
45 {
461040µs my $code =
47 @import == 0
48 ? "package $callpack; use $package;"
49 : "package $callpack; use $package (\@import)";
505732µs eval $code;
# spent 442µs executing statements in string eval
# includes 12.8ms spent executing 1 call to 1 sub defined therein. # spent 436µs executing statements in string eval
# includes 1.06ms spent executing 1 call to 1 sub defined therein. # spent 399µs executing statements in string eval
# includes 962µs spent executing 1 call to 1 sub defined therein. # spent 368µs executing statements in string eval
# includes 869µs spent executing 1 call to 1 sub defined therein. # spent 46µs executing statements in string eval
# includes 39µs spent executing 1 call to 1 sub defined therein.
51511µs if ( my $error = $@ ) {
52 $SIG{__DIE__} = $sigdie;
53 die $error;
54 }
55526µs $sigdie = $SIG{__DIE__}
56 if defined $SIG{__DIE__};
57 }
58
59 # Make sure a global $SIG{__DIE__} makes it out of the localization.
60565µs $SIG{__DIE__} = $sigdie if defined $sigdie;
61}
62
63sub alias {
64 my ( $package, @import ) = @_;
65
66 my $callpack = scalar caller(0);
67 _load_alias( $package, $callpack, @import );
68
69 return $package;
70}
71
72118µs1;
73__END__
 
# spent 67µs within aliased::CORE:subst which was called 5 times, avg 13µs/call: # 5 times (67µs+0s) by aliased::_get_alias at line 26, avg 13µs/call
sub aliased::CORE:subst; # opcode