Profile of vars.pm

← Index
NYTProf Performance Profile «line view»
For script/ponapi
Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:08 2016

Filename | /usr/share/perl/5.18/vars.pm
Statements | Executed 604 statements in 1.81ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
34 | 34 | 26 | 1.17ms | 1.44ms | vars::::importvars::import
345 | 3 | 1 | 268µs | 268µs | vars::::CORE:matchvars::CORE:match (opcode)
1 | 1 | 1 | 14µs | 14µs | vars::::BEGIN@3vars::BEGIN@3
1 | 1 | 1 | 6µs | 66µs | vars::::BEGIN@7vars::BEGIN@7
1 | 1 | 1 | 4µs | 12µs | vars::::BEGIN@8vars::BEGIN@8

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package vars;
2 |  |  |  |  |
3 | 2 | 48µs | 1 | 14µs | # spent 14µs within vars::BEGIN@3 which was called: # once (14µs+0s) by Cwd::BEGIN@5 at line 3 use 5.006; # spent 14µs making 1 call to vars::BEGIN@3
4 |  |  |  |  |
5 | 1 | 500ns |  |  | our $VERSION = '1.03';
6 |  |  |  |  |
7 | 2 | 23µs | 2 | 127µs | # spent 66µs (6+60) within vars::BEGIN@7 which was called: # once (6µs+60µs) by Cwd::BEGIN@5 at line 7 use warnings::register; # spent 66µs making 1 call to vars::BEGIN@7 # spent 60µs making 1 call to warnings::register::import
8 | 2 | 231µs | 2 | 20µs | # spent 12µs (4+8) within vars::BEGIN@8 which was called: # once (4µs+8µs) by Cwd::BEGIN@5 at line 8 use strict qw(vars subs); # spent 12µs making 1 call to vars::BEGIN@8 # spent 8µs making 1 call to strict::import
9 |  |  |  |  |
10 |  |  |  |  | # spent 1.44ms (1.17+268µs) within vars::import which was called 34 times, avg 42µs/call: # once (95µs+39µs) by Time::Seconds::BEGIN@3 at line 3 of Time/Seconds.pm # once (110µs+19µs) by File::stat::BEGIN@28 at line 28 of File/stat.pm # once (66µs+15µs) by Storable::BEGIN@22 at line 22 of Storable.pm # once (63µs+13µs) by Getopt::Long::BEGIN@45 at line 45 of Getopt/Long.pm # once (50µs+10µs) by Pod::Perldoc::BEGIN@12 at line 12 of Pod/Perldoc.pm # once (46µs+10µs) by Time::Local::BEGIN@8 at line 8 of Time/Local.pm # once (43µs+8µs) by List::MoreUtils::BEGIN@8 at line 8 of List/MoreUtils.pm # once (42µs+8µs) by URI::BEGIN@13 at line 13 of URI.pm # once (38µs+11µs) by Cwd::BEGIN@5 at line 5 of Cwd.pm # once (40µs+9µs) by File::Temp::BEGIN@170 at line 170 of File/Temp.pm # once (40µs+8µs) by Getopt::Long::BEGIN@51 at line 51 of Getopt/Long.pm # once (39µs+8µs) by File::Spec::Functions::BEGIN@6 at line 6 of File/Spec/Functions.pm # once (40µs+7µs) by Getopt::Long::BEGIN@48 at line 48 of Getopt/Long.pm # once (38µs+8µs) by File::Path::BEGIN@19 at line 19 of File/Path.pm # once (36µs+8µs) by Params::Util::BEGIN@65 at line 65 of Params/Util.pm # once (33µs+6µs) by Getopt::Long::BEGIN@46 at line 46 of Getopt/Long.pm # once (32µs+7µs) by URI::BEGIN@7 at line 7 of URI.pm # once (32µs+6µs) by HTTP::Date::BEGIN@13 at line 13 of HTTP/Date.pm # once (30µs+6µs) by Params::Validate::BEGIN@15 at line 15 of Params/Validate.pm # once (27µs+5µs) by Getopt::Long::BEGIN@26 at line 26 of Getopt/Long.pm # once (20µs+7µs) by URI::BEGIN@4 at line 4 of URI.pm # once (22µs+5µs) by constant::BEGIN@6 at line 6 of constant.pm # once (19µs+5µs) by Devel::InnerPackage::BEGIN@5 at line 5 of Devel/InnerPackage.pm # once (19µs+4µs) by File::Spec::BEGIN@4 at line 4 of File/Spec.pm # once (17µs+5µs) by Config::BEGIN@7 at line 7 of Config_heavy.pl # once (17µs+5µs) by Config::BEGIN@11 at line 11 of Config.pm # once (18µs+3µs) by B::Deparse::BEGIN@25 at line 25 of B/Deparse.pm # once (16µs+4µs) by parent::BEGIN@3 at line 3 of parent.pm # once (16µs+4µs) by Getopt::Long::BEGIN@19 at line 19 of Getopt/Long.pm # once (14µs+4µs) by base::BEGIN@4 at line 4 of base.pm # once (14µs+2µs) by Pod::Perldoc::GetOptsOO::BEGIN@4 at line 4 of Pod/Perldoc/GetOptsOO.pm # once (12µs+4µs) by Module::Pluggable::Object::BEGIN@9 at line 9 of Module/Pluggable/Object.pm # once (12µs+2µs) by Getopt::Long::BEGIN@22 at line 22 of Getopt/Long.pm # once (11µs+2µs) by File::Spec::Unix::BEGIN@4 at line 4 of File/Spec/Unix.pm sub import {
11 | 34 | 31µs |  |  | my $callpack = caller;
12 | 34 | 64µs |  |  | my (undef, @imports) = @_;
13 | 34 | 7µs |  |  | my ($sym, $ch);
14 | 34 | 143µs |  |  | foreach (@imports) {
15 | 115 | 525µs | 115 | 186µs | if (($ch, $sym) = /^([\$\@\%\*\&])(.+)/) { # spent 186µs making 115 calls to vars::CORE:match, avg 2µs/call
16 | 115 | 185µs | 115 | 46µs | if ($sym =~ /\W/) { # spent 46µs making 115 calls to vars::CORE:match, avg 404ns/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 | 115 | 215µs | 115 | 36µs | $sym = "${callpack}::$sym" unless $sym =~ /::/; # spent 36µs making 115 calls to vars::CORE:match, avg 311ns/call
29 |  |  |  |  | *$sym =
30 |  |  |  |  | ( $ch eq "\$" ? \$$sym
31 |  |  |  |  | : $ch eq "\@" ? \@$sym
32 |  |  |  |  | : $ch eq "\%" ? \%$sym
33 |  |  |  |  | : $ch eq "\*" ? \*$sym
34 |  |  |  |  | : $ch eq "\&" ? \&$sym
35 | 115 | 337µ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 | 2µs |  |  | 1;
47 |  |  |  |  | __END__
|  |  |  |  | # spent 268µs within vars::CORE:match which was called 345 times, avg 777ns/call: # 115 times (186µs+0s) by vars::import at line 15, avg 2µs/call # 115 times (46µs+0s) by vars::import at line 16, avg 404ns/call # 115 times (36µs+0s) by vars::import at line 28, avg 311ns/call sub vars::CORE:match; # opcode