← 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:22:40 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/overload.pm
StatementsExecuted 1511 statements in 2.30ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
114521.08ms1.25msoverload::::AddrRefoverload::AddrRef
1711610µs622µsoverload::::OVERLOADoverload::OVERLOAD
171716169µs791µsoverload::::importoverload::import
11113µs74µsoverload::::BEGIN@145overload::BEGIN@145
171112µs12µsoverload::::CORE:matchoverload::CORE:match (opcode)
0000s0soverload::::Methodoverload::Method
0000s0soverload::::Overloadedoverload::Overloaded
0000s0soverload::::OverloadedStringifyoverload::OverloadedStringify
0000s0soverload::::constantoverload::constant
0000s0soverload::::mycanoverload::mycan
0000s0soverload::::niloverload::nil
0000s0soverload::::ov_methodoverload::ov_method
0000s0soverload::::remove_constantoverload::remove_constant
0000s0soverload::::unimportoverload::unimport
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package overload;
2
31400nsour $VERSION = '1.10';
4
5sub nil {}
6
7
# spent 622µs (610+12) within overload::OVERLOAD which was called 17 times, avg 37µs/call: # 17 times (610µs+12µs) by overload::import at line 34, avg 37µs/call
sub OVERLOAD {
8136398µs $package = shift;
9 my %arg = @_;
10 my ($sub, $fb);
11 $ {$package . "::OVERLOAD"}{dummy}++; # Register with magic by touching.
12 $fb = ${$package . "::()"}; # preserve old fallback value RT#68196
13 *{$package . "::()"} = \&nil; # Make it findable via fetchmethod.
14 for (keys %arg) {
15142198µs if ($_ eq 'fallback') {
16 $fb = $arg{$_};
17 } else {
18 $sub = $arg{$_};
193451µs1712µs if (not ref $sub and $sub !~ /::/) {
# spent 12µs making 17 calls to overload::CORE:match, avg 706ns/call
20 $ {$package . "::(" . $_} = $sub;
21 $sub = \&nil;
22 }
23 #print STDERR "Setting `$ {'package'}::\cO$_' to \\&`$sub'.\n";
24 *{$package . "::(" . $_} = \&{ $sub };
25 }
26 }
27 ${$package . "::()"} = $fb; # Make it findable too (fallback only).
28}
29
30
# spent 791µs (169+622) within overload::import which was called 17 times, avg 47µs/call: # once (10µs+76µs) by DateTime::BEGIN@59 at line 60 of DateTime.pm # once (10µs+69µs) by DateTime::Duration::BEGIN@14 at line 15 of DateTime/Duration.pm # once (11µs+45µs) by DBIx::Class::ResultSet::BEGIN@25 at line 25 of DBIx/Class/ResultSet.pm # once (11µs+42µs) by Moose::Meta::TypeConstraint::BEGIN@14 at line 17 of Moose/Meta/TypeConstraint.pm # once (11µs+41µs) by SQL::Translator::Schema::Table::BEGIN@58 at line 60 of SQL/Translator/Schema/Table.pm # once (11µs+37µs) by File::Temp::Dir::BEGIN@2407 at line 2407 of File/Temp.pm # once (8µs+35µs) by Object::Enum::BEGIN@27 at line 28 of Object/Enum.pm # once (9µs+34µs) by File::Temp::BEGIN@163 at line 163 of File/Temp.pm # once (10µs+32µs) by SQL::Translator::Schema::Field::BEGIN@57 at line 59 of SQL/Translator/Schema/Field.pm # once (10µs+32µs) by DBIx::Class::ResultSourceHandle::BEGIN@14 at line 15 of DBIx/Class/ResultSourceHandle.pm # once (11µs+29µs) by Moose::Meta::Role::Method::Required::BEGIN@14 at line 15 of Moose/Meta/Role/Method/Required.pm # once (10µs+27µs) by YAML::Tag::BEGIN@7 at line 7 of YAML/Tag.pm # once (10µs+27µs) by Class::MOP::Method::BEGIN@21 at line 21 of Class/MOP/Method.pm # once (11µs+26µs) by DBIx::Class::Exception::BEGIN@9 at line 10 of DBIx/Class/Exception.pm # once (10µs+25µs) by File::stat::BEGIN@148 at line 169 of File/stat.pm # once (9µs+26µs) by Devel::Backtrace::Point::BEGIN@26 at line 26 of Devel/Backtrace/Point.pm # once (8µs+20µs) by Devel::Backtrace::BEGIN@7 at line 7 of Devel/Backtrace.pm
sub import {
3151174µs $package = (caller())[0];
32 # *{$package . "::OVERLOAD"} = \&OVERLOAD;
33 shift;
3417622µs $package->overload::OVERLOAD(@_);
# spent 622µs making 17 calls to overload::OVERLOAD, avg 37µs/call
35}
36
37sub unimport {
38 $package = (caller())[0];
39 ${$package . "::OVERLOAD"}{dummy}++; # Upgrade the table
40 shift;
41 for (@_) {
42 if ($_ eq 'fallback') {
43 undef $ {$package . "::()"};
44 } else {
45 delete $ {$package . "::"}{"(" . $_};
46 }
47 }
48}
49
50sub Overloaded {
51 my $package = shift;
52 $package = ref $package if ref $package;
53 $package->can('()');
54}
55
56sub ov_method {
57 my $globref = shift;
58 return undef unless $globref;
59 my $sub = \&{*$globref};
60 return $sub if $sub ne \&nil;
61 return shift->can($ {*$globref});
62}
63
64sub OverloadedStringify {
65 my $package = shift;
66 $package = ref $package if ref $package;
67 #$package->can('(""')
68 ov_method mycan($package, '(""'), $package
69 or ov_method mycan($package, '(0+'), $package
70 or ov_method mycan($package, '(bool'), $package
71 or ov_method mycan($package, '(nomethod'), $package;
72}
73
74sub Method {
75 my $package = shift;
76 if(ref $package) {
77 local $@;
78 local $!;
79 require Scalar::Util;
80 $package = Scalar::Util::blessed($package);
81 return undef if !defined $package;
82 }
83 #my $meth = $package->can('(' . shift);
84 ov_method mycan($package, '(' . shift), $package;
85 #return $meth if $meth ne \&nil;
86 #return $ {*{$meth}};
87}
88
89
# spent 1.25ms (1.08+168µs) within overload::AddrRef which was called 114 times, avg 11µs/call: # 44 times (344µs+59µs) by Kwalify::Validator::validate_map at line 323 of Kwalify.pm, avg 9µs/call # 44 times (319µs+57µs) by Kwalify::Validator::validate_map at line 324 of Kwalify.pm, avg 9µs/call # 22 times (372µs+44µs) by SQL::Translator::Schema::Object::equals at line 198 of SQL/Translator/Schema/Object.pm, avg 19µs/call # 2 times (31µs+5µs) by Kwalify::Validator::validate_seq at line 279 of Kwalify.pm, avg 18µs/call # 2 times (15µs+2µs) by Kwalify::Validator::validate_seq at line 280 of Kwalify.pm, avg 9µs/call
sub AddrRef {
9011401.28ms my $package = ref $_[0];
91 return "$_[0]" unless $package;
92
93 local $@;
94 local $!;
95 require Scalar::Util;
9611453µs my $class = Scalar::Util::blessed($_[0]);
# spent 53µs making 114 calls to Scalar::Util::blessed, avg 465ns/call
97 my $class_prefix = defined($class) ? "$class=" : "";
9811458µs my $type = Scalar::Util::reftype($_[0]);
# spent 58µs making 114 calls to Scalar::Util::reftype, avg 508ns/call
9911457µs my $addr = Scalar::Util::refaddr($_[0]);
# spent 57µs making 114 calls to Scalar::Util::refaddr, avg 498ns/call
100 return sprintf("$class_prefix$type(0x%x)", $addr);
101}
102
10311µs*StrVal = *AddrRef;
104
105sub mycan { # Real can would leave stubs.
106 my ($package, $meth) = @_;
107
108 local $@;
109 local $!;
110 require mro;
111
112 my $mro = mro::get_linear_isa($package);
113 foreach my $p (@$mro) {
114 my $fqmeth = $p . q{::} . $meth;
115 return \*{$fqmeth} if defined &{$fqmeth};
116 }
117
118 return undef;
119}
120
12112µs%constants = (
122 'integer' => 0x1000, # HINT_NEW_INTEGER
123 'float' => 0x2000, # HINT_NEW_FLOAT
124 'binary' => 0x4000, # HINT_NEW_BINARY
125 'q' => 0x8000, # HINT_NEW_STRING
126 'qr' => 0x10000, # HINT_NEW_RE
127 );
128
12917µs%ops = ( with_assign => "+ - * / % ** << >> x .",
130 assign => "+= -= *= /= %= **= <<= >>= x= .=",
131 num_comparison => "< <= > >= == !=",
132 '3way_comparison'=> "<=> cmp",
133 str_comparison => "lt le gt ge eq ne",
134 binary => '& &= | |= ^ ^=',
135 unary => "neg ! ~",
136 mutators => '++ --',
137 func => "atan2 cos sin exp abs log sqrt int",
138 conversion => 'bool "" 0+ qr',
139 iterators => '<>',
140 filetest => "-X",
141 dereferencing => '${} @{} %{} &{} *{}',
142 matching => '~~',
143 special => 'nomethod fallback =');
144
1453182µs2134µs
# spent 74µs (13+61) within overload::BEGIN@145 which was called: # once (13µs+61µs) by Data::OptList::BEGIN@10 at line 145
use warnings::register;
# spent 74µs making 1 call to overload::BEGIN@145 # spent 61µs making 1 call to warnings::register::import
146sub constant {
147 # Arguments: what, sub
148 while (@_) {
149 if (@_ == 1) {
150 warnings::warnif ("Odd number of arguments for overload::constant");
151 last;
152 }
153 elsif (!exists $constants {$_ [0]}) {
154 warnings::warnif ("`$_[0]' is not an overloadable type");
155 }
156 elsif (!ref $_ [1] || "$_[1]" !~ /(^|=)CODE\(0x[0-9a-f]+\)$/) {
157 # Can't use C<ref $_[1] eq "CODE"> above as code references can be
158 # blessed, and C<ref> would return the package the ref is blessed into.
159 if (warnings::enabled) {
160 $_ [1] = "undef" unless defined $_ [1];
161 warnings::warn ("`$_[1]' is not a code reference");
162 }
163 }
164 else {
165 $^H{$_[0]} = $_[1];
166 $^H |= $constants{$_[0]};
167 }
168 shift, shift;
169 }
170}
171
172sub remove_constant {
173 # Arguments: what, sub
174 while (@_) {
175 delete $^H{$_[0]};
176 $^H &= ~ $constants{$_[0]};
177 shift, shift;
178 }
179}
180
18117µs1;
182
183__END__
 
# spent 12µs within overload::CORE:match which was called 17 times, avg 706ns/call: # 17 times (12µs+0s) by overload::OVERLOAD at line 19, avg 706ns/call
sub overload::CORE:match; # opcode