← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:23:27 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/constant.pm
StatementsExecuted 2057 statements in 3.77ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
7373292.02ms2.59msconstant::::importconstant::import
9311202µs202µsconstant::::CORE:matchconstant::CORE:match (opcode)
9641146µs146µsconstant::::CORE:regcompconstant::CORE:regcomp (opcode)
11129µs29µsconstant::::BEGIN@2constant::BEGIN@2
11115µs15µsconstant::::BEGIN@25constant::BEGIN@25
11110µs48µsconstant::::BEGIN@6constant::BEGIN@6
1118µs10µsconstant::::BEGIN@3constant::BEGIN@3
1116µs16µsconstant::::BEGIN@114constant::BEGIN@114
1116µs70µsconstant::::BEGIN@4constant::BEGIN@4
1116µs20µsconstant::::BEGIN@29constant::BEGIN@29
1115µs16µsconstant::::BEGIN@52constant::BEGIN@52
3315µs5µsconstant::::CORE:qrconstant::CORE:qr (opcode)
1114µs4µsconstant::::__ANON__[:141]constant::__ANON__[:141]
0000s0sconstant::::__ANON__[:137]constant::__ANON__[:137]
0000s0sconstant::::__ANON__[:143]constant::__ANON__[:143]
0000s0sconstant::::__ANON__[:31]constant::__ANON__[:31]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package constant;
2335µs129µs
# spent 29µs within constant::BEGIN@2 which was called: # once (29µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 2
use 5.005;
# spent 29µs making 1 call to constant::BEGIN@2
3316µs212µs
# spent 10µs (8+2) within constant::BEGIN@3 which was called: # once (8µs+2µs) by Class::MOP::Method::Meta::BEGIN@16 at line 3
use strict;
# spent 10µs making 1 call to constant::BEGIN@3 # spent 2µs making 1 call to strict::import
4321µs2134µs
# spent 70µs (6+64) within constant::BEGIN@4 which was called: # once (6µs+64µs) by Class::MOP::Method::Meta::BEGIN@16 at line 4
use warnings::register;
# spent 70µs making 1 call to constant::BEGIN@4 # spent 64µs making 1 call to warnings::register::import
5
63110µs287µs
# spent 48µs (10+39) within constant::BEGIN@6 which was called: # once (10µs+39µs) by Class::MOP::Method::Meta::BEGIN@16 at line 6
use vars qw($VERSION %declared);
# spent 48µs making 1 call to constant::BEGIN@6 # spent 39µs making 1 call to vars::import
71500ns$VERSION = '1.21';
8
9#=======================================================================
10
11# Some names are evil choices.
12112µsmy %keywords = map +($_, 1), qw{ BEGIN INIT CHECK END DESTROY AUTOLOAD };
1312µs$keywords{UNITCHECK}++ if $] > 5.009;
14
1516µsmy %forced_into_main = map +($_, 1),
16 qw{ STDIN STDOUT STDERR ARGV ARGVOUT ENV INC SIG };
17
1815µsmy %forbidden = (%keywords, %forced_into_main);
19
2011µsmy $str_end = $] >= 5.006 ? "\\z" : "\\Z";
21129µs221µsmy $normal_constant_name = qr/^_?[^\W_0-9]\w*$str_end/;
# spent 18µs making 1 call to constant::CORE:regcomp # spent 3µs making 1 call to constant::CORE:qr
2219µs25µsmy $tolerable = qr/^[A-Za-z_]\w*$str_end/;
# spent 4µs making 1 call to constant::CORE:regcomp # spent 1µs making 1 call to constant::CORE:qr
23113µs29µsmy $boolean = qr/^[01]?$str_end/;
# spent 8µs making 1 call to constant::CORE:regcomp # spent 1µs making 1 call to constant::CORE:qr
24
25
# spent 15µs within constant::BEGIN@25 which was called: # once (15µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 32
BEGIN {
26 # We'd like to do use constant _CAN_PCS => $] > 5.009002
27 # but that's a bit tricky before we load the constant module :-)
28 # By doing this, we save 1 run time check for *every* call to import.
29341µs234µs
# spent 20µs (6+14) within constant::BEGIN@29 which was called: # once (6µs+14µs) by Class::MOP::Method::Meta::BEGIN@16 at line 29
no strict 'refs';
# spent 20µs making 1 call to constant::BEGIN@29 # spent 14µs making 1 call to strict::unimport
3012µs my $const = $] > 5.009002;
31114µs *_CAN_PCS = sub () {$const};
32150µs115µs}
# spent 15µs making 1 call to constant::BEGIN@25
33
34#=======================================================================
35# import() - import symbols into user's namespace
36#
37# What we actually do is define a function in the caller's namespace
38# which returns the value. The function we create will normally
39# be inlined as a constant, thereby avoiding further sub calling
40# overhead.
41#=======================================================================
42
# spent 2.59ms (2.02+568µs) within constant::import which was called 73 times, avg 35µs/call: # once (94µs+24µs) by Compress::Bzip2::BEGIN@146 at line 146 of Compress/Bzip2.pm # once (67µs+17µs) by Compress::Bzip2::BEGIN@143 at line 143 of Compress/Bzip2.pm # once (60µs+12µs) by Compress::Bzip2::BEGIN@153 at line 153 of Compress/Bzip2.pm # once (43µs+18µs) by Log::Log4perl::BEGIN@69 at line 69 of Log/Log4perl.pm # once (42µs+16µs) by DateTime::TimeZone::BEGIN@18 at line 18 of DateTime/TimeZone.pm # once (39µs+19µs) by Log::Log4perl::Config::BaseConfigurator::BEGIN@5 at line 5 of Log/Log4perl/Config/BaseConfigurator.pm # once (43µs+13µs) by File::stat::BEGIN@144 at line 144 of File/stat.pm # once (42µs+12µs) by Compress::Bzip2::BEGIN@150 at line 150 of Compress/Bzip2.pm # once (40µs+14µs) by IPC::Open3::BEGIN@184 at line 184 of IPC/Open3.pm # once (42µs+12µs) by File::ShareDir::BEGIN@133 at line 133 of File/ShareDir.pm # once (42µs+12µs) by SQL::Translator::Schema::Constants::BEGIN@81 at line 81 of SQL/Translator/Schema/Constants.pm # once (41µs+12µs) by YAML::Syck::BEGIN@36 at line 53 of YAML/Syck.pm # once (38µs+14µs) by YAML::BEGIN@15 at line 15 of YAML.pm # once (40µs+12µs) by DBD::SQLite::BEGIN@30 at line 30 of DBD/SQLite.pm # once (38µs+14µs) by Log::Log4perl::Appender::BEGIN@12 at line 12 of Log/Log4perl/Appender.pm # once (38µs+14µs) by Log::Log4perl::Level::BEGIN@13 at line 13 of Log/Log4perl/Level.pm # once (40µs+11µs) by Compress::Bzip2::BEGIN@141 at line 141 of Compress/Bzip2.pm # once (38µs+13µs) by DateTime::Duration::BEGIN@23 at line 23 of DateTime/Duration.pm # once (35µs+15µs) by Class::MOP::Method::Meta::BEGIN@16 at line 16 of Class/MOP/Method/Meta.pm # once (37µs+12µs) by namespace::clean::BEGIN@168 at line 168 of namespace/clean.pm # once (35µs+12µs) by File::Temp::BEGIN@217 at line 217 of File/Temp.pm # once (35µs+12µs) by Compress::Bzip2::BEGIN@156 at line 156 of Compress/Bzip2.pm # once (35µs+11µs) by Devel::Backtrace::Point::BEGIN@29 at line 48 of Devel/Backtrace/Point.pm # once (35µs+10µs) by SQL::Translator::Utils::BEGIN@33 at line 33 of SQL/Translator/Utils.pm # once (34µs+9µs) by Time::Local::BEGIN@27 at line 27 of Time/Local.pm # once (31µs+11µs) by Log::Log4perl::Layout::PatternLayout::BEGIN@9 at line 9 of Log/Log4perl/Layout/PatternLayout.pm # once (25µs+7µs) by Log::Log4perl::Logger::BEGIN@20 at line 20 of Log/Log4perl/Logger.pm # once (25µs+5µs) by DateTime::TimeZone::BEGIN@24 at line 24 of DateTime/TimeZone.pm # once (24µs+5µs) by Log::Log4perl::Config::Watch::BEGIN@3 at line 3 of Log/Log4perl/Config/Watch.pm # once (23µs+6µs) by DateTime::BEGIN@74 at line 74 of DateTime.pm # once (23µs+5µs) by Log::Log4perl::Config::PropertyConfigurator::BEGIN@17 at line 17 of Log/Log4perl/Config/PropertyConfigurator.pm # once (22µs+6µs) by Log::Log4perl::Filter::Boolean::BEGIN@13 at line 13 of Log/Log4perl/Filter/Boolean.pm # once (20µs+8µs) by Log::Log4perl::Level::BEGIN@16 at line 16 of Log/Log4perl/Level.pm # once (21µs+6µs) by Log::Log4perl::JavaMap::BEGIN@6 at line 6 of Log/Log4perl/JavaMap.pm # once (19µs+8µs) by SQL::Translator::Schema::Constants::BEGIN@93 at line 93 of SQL/Translator/Schema/Constants.pm # once (22µs+5µs) by Log::Log4perl::Config::BEGIN@16 at line 16 of Log/Log4perl/Config.pm # once (20µs+5µs) by Log::Log4perl::Filter::BEGIN@12 at line 12 of Log/Log4perl/Filter.pm # once (19µs+6µs) by DateTime::TimeZone::BEGIN@19 at line 19 of DateTime/TimeZone.pm # once (19µs+6µs) by DateTime::TimeZone::BEGIN@22 at line 22 of DateTime/TimeZone.pm # once (20µs+5µs) by File::Temp::BEGIN@220 at line 220 of File/Temp.pm # once (22µs+3µs) by DateTime::BEGIN@76 at line 76 of DateTime.pm # once (20µs+5µs) by SQL::Translator::Schema::Constants::BEGIN@91 at line 91 of SQL/Translator/Schema/Constants.pm # once (20µs+4µs) by SQL::Translator::Schema::Constants::BEGIN@87 at line 87 of SQL/Translator/Schema/Constants.pm # once (19µs+5µs) by DateTime::TimeZone::BEGIN@25 at line 25 of DateTime/TimeZone.pm # once (20µs+5µs) by namespace::clean::BEGIN@169 at line 169 of namespace/clean.pm # once (19µs+5µs) by DateTime::TimeZone::BEGIN@26 at line 26 of DateTime/TimeZone.pm # once (19µs+5µs) by SQL::Translator::Schema::Constants::BEGIN@83 at line 83 of SQL/Translator/Schema/Constants.pm # once (18µs+5µs) by DateTime::TimeZone::BEGIN@28 at line 28 of DateTime/TimeZone.pm # once (19µs+5µs) by DateTime::TimeZone::BEGIN@23 at line 23 of DateTime/TimeZone.pm # once (19µs+5µs) by Log::Log4perl::Level::BEGIN@14 at line 14 of Log/Log4perl/Level.pm # once (20µs+4µs) by File::Temp::BEGIN@228 at line 228 of File/Temp.pm # once (19µs+4µs) by SQL::Translator::Schema::Constants::BEGIN@89 at line 89 of SQL/Translator/Schema/Constants.pm # once (18µs+5µs) by DateTime::TimeZone::BEGIN@27 at line 27 of DateTime/TimeZone.pm # once (19µs+4µs) by SQL::Translator::Schema::Constants::BEGIN@95 at line 95 of SQL/Translator/Schema/Constants.pm # once (19µs+4µs) by Time::Local::BEGIN@28 at line 28 of Time/Local.pm # once (19µs+4µs) by Time::Local::BEGIN@29 at line 29 of Time/Local.pm # once (19µs+4µs) by SQL::Translator::Schema::Constants::BEGIN@97 at line 97 of SQL/Translator/Schema/Constants.pm # once (19µs+4µs) by Log::Log4perl::Level::BEGIN@15 at line 15 of Log/Log4perl/Level.pm # once (19µs+4µs) by File::Temp::BEGIN@230 at line 230 of File/Temp.pm # once (19µs+4µs) by File::Temp::BEGIN@224 at line 224 of File/Temp.pm # once (18µs+4µs) by Log::Log4perl::Level::BEGIN@17 at line 17 of Log/Log4perl/Level.pm # once (18µs+5µs) by SQL::Translator::Schema::Constants::BEGIN@85 at line 85 of SQL/Translator/Schema/Constants.pm # once (18µs+4µs) by DateTime::BEGIN@80 at line 80 of DateTime.pm # once (19µs+4µs) by Compress::Bzip2::BEGIN@158 at line 158 of Compress/Bzip2.pm # once (20µs+3µs) by DateTime::BEGIN@78 at line 78 of DateTime.pm # once (18µs+4µs) by Log::Log4perl::Level::BEGIN@20 at line 20 of Log/Log4perl/Level.pm # once (18µs+4µs) by Compress::Bzip2::BEGIN@160 at line 160 of Compress/Bzip2.pm # once (19µs+4µs) by DateTime::BEGIN@82 at line 82 of DateTime.pm # once (18µs+4µs) by File::Temp::BEGIN@229 at line 229 of File/Temp.pm # once (18µs+4µs) by Log::Log4perl::Level::BEGIN@19 at line 19 of Log/Log4perl/Level.pm # once (18µs+4µs) by Log::Log4perl::Level::BEGIN@18 at line 18 of Log/Log4perl/Level.pm # once (19µs+3µs) by DateTime::BEGIN@77 at line 77 of DateTime.pm # once (3µs+0s) by Devel::Backtrace::Point::BEGIN@27 at line 27 of Devel/Backtrace/Point.pm
sub import {
437344µs my $class = shift;
447327µs return unless @_; # Ignore 'use constant;'
457214µs my $constants;
467235µs my $multiple = ref $_[0];
477235µs my $pkg = caller;
487212µs my $flush_mro;
497211µs my $symtab;
50
517229µs if (_CAN_PCS) {
523438µs226µs
# spent 16µs (5+10) within constant::BEGIN@52 which was called: # once (5µs+10µs) by Class::MOP::Method::Meta::BEGIN@16 at line 52
no strict 'refs';
# spent 16µs making 1 call to constant::BEGIN@52 # spent 10µs making 1 call to strict::unimport
537289µs $symtab = \%{$pkg . '::'};
54 };
55
567232µs if ( $multiple ) {
5752µs if (ref $_[0] ne 'HASH') {
58 require Carp;
59 Carp::croak("Invalid reference type '".ref(shift)."' not 'HASH'");
60 }
6151µs $constants = shift;
62 } else {
636722µs unless (defined $_[0]) {
64 require Carp;
65 Carp::croak("Can't use undef as constant name");
66 }
676789µs $constants->{+shift} = undef;
68 }
69
7072112µs foreach my $name ( keys %$constants ) {
71 # Normal constant name
7293671µs186319µs if ($name =~ $normal_constant_name and !$forbidden{$name}) {
# spent 202µs making 93 calls to constant::CORE:match, avg 2µs/call # spent 117µs making 93 calls to constant::CORE:regcomp, avg 1µs/call
73 # Everything is okay
74
75 # Name forced into main, but we're not in main. Fatal.
76 } elsif ($forced_into_main{$name} and $pkg ne 'main') {
77 require Carp;
78 Carp::croak("Constant name '$name' is forced into main::");
79
80 # Starts with double underscore. Fatal.
81 } elsif ($name =~ /^__/) {
82 require Carp;
83 Carp::croak("Constant name '$name' begins with '__'");
84
85 # Maybe the name is tolerable
86 } elsif ($name =~ $tolerable) {
87 # Then we'll warn only if you've asked for warnings
88 if (warnings::enabled()) {
89 if ($keywords{$name}) {
90 warnings::warn("Constant name '$name' is a Perl keyword");
91 } elsif ($forced_into_main{$name}) {
92 warnings::warn("Constant name '$name' is " .
93 "forced into package main::");
94 }
95 }
96
97 # Looks like a boolean
98 # use constant FRED == fred;
99 } elsif ($name =~ $boolean) {
100 require Carp;
101 if (@_) {
102 Carp::croak("Constant name '$name' is invalid");
103 } else {
104 Carp::croak("Constant name looks like boolean value");
105 }
106
107 } else {
108 # Must have bad characters
109 require Carp;
110 Carp::croak("Constant name '$name' has invalid characters");
111 }
112
113 {
11496297µs225µs
# spent 16µs (6+9) within constant::BEGIN@114 which was called: # once (6µs+9µs) by Class::MOP::Method::Meta::BEGIN@16 at line 114
no strict 'refs';
# spent 16µs making 1 call to constant::BEGIN@114 # spent 9µs making 1 call to strict::unimport
1159365µs my $full_name = "${pkg}::$name";
11693124µs $declared{$full_name}++;
1179370µs if ($multiple || @_ == 1) {
1189240µs my $scalar = $multiple ? $constants->{$name} : $_[0];
119
120 # Work around perl bug #xxxxx: Sub names (actually glob
121 # names in general) ignore the UTF8 flag. So we have to
122 # turn it off to get the "right" symbol table entry.
12392250µs9267µs utf8::is_utf8 $name and utf8::encode $name
# spent 67µs making 92 calls to utf8::is_utf8, avg 726ns/call
124 if defined &utf8::is_utf8;
125
126 # The constant serves to optimise this entire block out on
127 # 5.8 and earlier.
1289266µs if (_CAN_PCS && $symtab && !exists $symtab->{$name}) {
129 # No typeglob yet, so we can use a reference as space-
130 # efficient proxy for a constant subroutine
131 # The check in Perl_ck_rvconst knows that inlinable
132 # constants from cv_const_sv are read only. So we have to:
13389205µs8969µs Internals::SvREADONLY($scalar, 1);
# spent 69µs making 89 calls to Internals::SvREADONLY, avg 771ns/call
1348956µs $symtab->{$name} = \$scalar;
1358928µs ++$flush_mro;
136 } else {
137315µs *$full_name = sub () { $scalar };
138 }
139 } elsif (@_) {
14016µs my @list = @_;
141211µs
# spent 4µs within constant::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/constant.pm:141] which was called: # once (4µs+0s) by Devel::Backtrace::BEGIN@4 at line 68 of Devel/Backtrace/Point.pm
*$full_name = sub () { @list };
142 } else {
143 *$full_name = sub () { };
144 }
145 }
146 }
147 # Flush the cache exactly once if we make any direct symbol table changes.
14872496µs68113µs mro::method_changed_in($pkg) if _CAN_PCS && $flush_mro;
# spent 113µs making 68 calls to mro::method_changed_in, avg 2µs/call
149}
150
151111µs1;
152
153__END__
 
# spent 202µs within constant::CORE:match which was called 93 times, avg 2µs/call: # 93 times (202µs+0s) by constant::import at line 72, avg 2µs/call
sub constant::CORE:match; # opcode
# spent 5µs within constant::CORE:qr which was called 3 times, avg 2µs/call: # once (3µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 21 # once (1µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 22 # once (1µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 23
sub constant::CORE:qr; # opcode
# spent 146µs within constant::CORE:regcomp which was called 96 times, avg 2µs/call: # 93 times (117µs+0s) by constant::import at line 72, avg 1µs/call # once (18µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 21 # once (8µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 23 # once (4µs+0s) by Class::MOP::Method::Meta::BEGIN@16 at line 22
sub constant::CORE:regcomp; # opcode