Filename | /usr/share/perl/5.18/vars.pm |
Statements | Executed 228 statements in 1.27ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
15 | 15 | 13 | 496µs | 618µs | import | vars::
1 | 1 | 1 | 212µs | 308µs | BEGIN@7 | vars::
120 | 3 | 1 | 121µs | 121µs | CORE:match (opcode) | vars::
1 | 1 | 1 | 16µs | 16µs | BEGIN@3 | vars::
1 | 1 | 1 | 7µs | 19µs | BEGIN@8 | vars::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package vars; | ||||
2 | |||||
3 | 2 | 60µs | 1 | 16µs | # spent 16µs within vars::BEGIN@3 which was called:
# once (16µs+0s) by File::Spec::BEGIN@4 at line 3 # spent 16µs making 1 call to vars::BEGIN@3 |
4 | |||||
5 | 1 | 800ns | our $VERSION = '1.03'; | ||
6 | |||||
7 | 2 | 237µs | 2 | 404µs | # spent 308µs (212+96) within vars::BEGIN@7 which was called:
# once (212µs+96µs) by File::Spec::BEGIN@4 at line 7 # spent 308µs making 1 call to vars::BEGIN@7
# spent 96µs making 1 call to warnings::register::import |
8 | 2 | 309µs | 2 | 31µs | # spent 19µs (7+12) within vars::BEGIN@8 which was called:
# once (7µs+12µs) by File::Spec::BEGIN@4 at line 8 # spent 19µs making 1 call to vars::BEGIN@8
# spent 12µs making 1 call to strict::import |
9 | |||||
10 | # spent 618µs (496+121) within vars::import which was called 15 times, avg 41µs/call:
# once (53µs+10µs) by URI::BEGIN@13 at line 13 of URI.pm
# once (50µs+11µs) by Math::Round::BEGIN@5 at line 5 of Math/Round.pm
# once (43µs+10µs) by Params::Util::BEGIN@65 at line 65 of /opt/flows/lib/lib/perl5/x86_64-linux-gnu-thread-multi/Params/Util.pm
# once (43µs+10µs) by File::Path::BEGIN@19 at line 19 of File/Path.pm
# once (42µs+10µs) by Cwd::BEGIN@5 at line 5 of Cwd.pm
# once (32µs+16µs) by Config::BEGIN@7 at line 7 of Config_heavy.pl
# once (35µs+9µs) by Storable::BEGIN@22 at line 22 of Storable.pm
# once (33µs+6µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm
# once (31µs+7µs) by URI::BEGIN@7 at line 7 of URI.pm
# once (28µs+6µs) by IO::Select::BEGIN@11 at line 11 of IO/Select.pm
# once (26µs+7µs) by constant::BEGIN@6 at line 6 of constant.pm
# once (24µs+6µs) by Config::BEGIN@11 at line 11 of Config.pm
# once (24µs+5µs) by URI::BEGIN@4 at line 4 of URI.pm
# once (17µs+4µs) by base::BEGIN@4 at line 4 of base.pm
# once (17µs+4µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm | ||||
11 | 15 | 13µs | my $callpack = caller; | ||
12 | 15 | 24µs | my (undef, @imports) = @_; | ||
13 | 15 | 3µs | my ($sym, $ch); | ||
14 | 15 | 78µs | foreach (@imports) { | ||
15 | 40 | 246µs | 40 | 85µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 85µs making 40 calls to vars::CORE:match, avg 2µs/call |
16 | 40 | 76µs | 40 | 21µs | if ($sym =~ /\W/) { # spent 21µs making 40 calls to vars::CORE:match, avg 515ns/call |
17 | # time for a more-detailed check-up | ||||
18 | if ($sym =~ /^\w+[[{].*[]}]$/) { | ||||
19 | require Carp; | ||||
20 | Carp::croak("Can't declare individual elements of hash or array"); | ||||
21 | } elsif (warnings::enabled() and length($sym) == 1 and $sym !~ tr/a-zA-Z//) { | ||||
22 | warnings::warn("No need to declare built-in vars"); | ||||
23 | } elsif (($^H &= strict::bits('vars'))) { | ||||
24 | require Carp; | ||||
25 | Carp::croak("'$_' is not a valid variable name under strict vars"); | ||||
26 | } | ||||
27 | } | ||||
28 | 40 | 88µs | 40 | 16µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 16µs making 40 calls to vars::CORE:match, avg 398ns/call |
29 | *$sym = | ||||
30 | ( $ch eq "\$" ? \$$sym | ||||
31 | : $ch eq "\@" ? \@$sym | ||||
32 | : $ch eq "\%" ? \%$sym | ||||
33 | : $ch eq "\*" ? \*$sym | ||||
34 | : $ch eq "\&" ? \&$sym | ||||
35 | 40 | 130µs | : do { | ||
36 | require Carp; | ||||
37 | Carp::croak("'$_' is not a valid variable name"); | ||||
38 | }); | ||||
39 | } else { | ||||
40 | require Carp; | ||||
41 | Carp::croak("'$_' is not a valid variable name"); | ||||
42 | } | ||||
43 | } | ||||
44 | }; | ||||
45 | |||||
46 | 1 | 3µs | 1; | ||
47 | __END__ | ||||
sub vars::CORE:match; # opcode |