← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 13:50:58 2016
Reported on Fri Jan 8 13:51:28 2016

Filename/usr/share/perl5/Moo.pm
StatementsExecuted 264 statements in 2.30ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111437µs491µsMoo::::BEGIN@5Moo::BEGIN@5
222175µs738µsMoo::::importMoo::import
771138µs3.02msMoo::::hasMoo::has
822117µs1.55msMoo::::_constructor_maker_forMoo::_constructor_maker_for
124156µs199µsMoo::::_install_trackedMoo::_install_tracked
92146µs85µsMoo::::_accessor_maker_forMoo::_accessor_maker_for
11122µs76µsMoo::::BEGIN@3Moo::BEGIN@3
71112µs12µsMoo::::_maybe_reset_handlemooseMoo::_maybe_reset_handlemoose
11111µs26µsMoo::::BEGIN@108Moo::BEGIN@108
11110µs55µsMoo::::BEGIN@4Moo::BEGIN@4
11110µs17µsMoo::::BEGIN@73Moo::BEGIN@73
1116µs10µsMoo::::__ANON__[:183]Moo::__ANON__[:183]
0000s0sMoo::::__ANON__[:33]Moo::__ANON__[:33]
0000s0sMoo::::__ANON__[:38]Moo::__ANON__[:38]
0000s0sMoo::::__ANON__[:59]Moo::__ANON__[:59]
0000s0sMoo::::__ANON__[:65]Moo::__ANON__[:65]
0000s0sMoo::::_concrete_methods_ofMoo::_concrete_methods_of
0000s0sMoo::::_set_superclassesMoo::_set_superclasses
0000s0sMoo::::afterMoo::after
0000s0sMoo::::aroundMoo::around
0000s0sMoo::::beforeMoo::before
0000s0sMoo::::extendsMoo::extends
0000s0sMoo::::unimportMoo::unimport
0000s0sMoo::::withMoo::with
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moo;
2
3339µs3130µs
# spent 76µs (22+54) within Moo::BEGIN@3 which was called: # once (22µs+54µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 3
use strictures 1;
# spent 76µs making 1 call to Moo::BEGIN@3 # spent 28µs making 1 call to strictures::import # spent 26µs making 1 call to strictures::VERSION
4274µs2101µs
# spent 55µs (10+45) within Moo::BEGIN@4 which was called: # once (10µs+45µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 4
use Moo::_Utils;
# spent 55µs making 1 call to Moo::BEGIN@4 # spent 45µs making 1 call to Exporter::import
52597µs1491µs
# spent 491µs (437+54) within Moo::BEGIN@5 which was called: # once (437µs+54µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 5
use Import::Into;
# spent 491µs making 1 call to Moo::BEGIN@5
6
71400nsour $VERSION = '1.006001';
8115µs$VERSION = eval $VERSION;
# spent 2µs executing statements in string eval
9
101106µsrequire Moo::sification;
11
121200nsour %MAKERS;
13
14
# spent 199µs (56+144) within Moo::_install_tracked which was called 12 times, avg 17µs/call: # 6 times (19µs+60µs) by Moo::import at line 65, avg 13µs/call # 2 times (22µs+41µs) by Moo::import at line 33, avg 32µs/call # 2 times (7µs+22µs) by Moo::import at line 38, avg 15µs/call # 2 times (7µs+21µs) by Moo::import at line 59, avg 14µs/call
sub _install_tracked {
151213µs my ($target, $name, $code) = @_;
161211µs $MAKERS{$target}{exports}{$name} = $code;
171238µs12144µs _install_coderef "${target}::${name}" => "Moo::${name}" => $code;
# spent 144µs making 12 calls to Moo::_Utils::_install_coderef, avg 12µs/call
18}
19
20
# spent 738µs (175+563) within Moo::import which was called 2 times, avg 369µs/call: # once (106µs+268µs) by Method::Generate::Constructor::BEGIN@202 at line 202 of Method/Generate/Constructor.pm # once (69µs+295µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 29 of DBIx/Class/Storage/BlockRunner.pm
sub import {
2122µs my $target = caller;
222900ns my $class = shift;
2324µs242µs _set_loaded(caller);
# spent 42µs making 2 calls to Moo::_Utils::_set_loaded, avg 21µs/call
24213µs2318µs strictures->import::into(1);
# spent 318µs making 2 calls to import::into, avg 159µs/call
2522µs if ($INC{'Role/Tiny.pm'} and Role::Tiny->is_role($target)) {
26 die "Cannot import Moo into a role";
27 }
2822µs $MAKERS{$target} ||= {};
29 _install_tracked $target => extends => sub {
30 $class->_set_superclasses($target, @_);
31 $class->_maybe_reset_handlemoose($target);
32 return;
3328µs263µs };
# spent 63µs making 2 calls to Moo::_install_tracked, avg 32µs/call
34 _install_tracked $target => with => sub {
35 require Moo::Role;
36 Moo::Role->apply_roles_to_package($target, @_);
37 $class->_maybe_reset_handlemoose($target);
3826µs230µs };
# spent 30µs making 2 calls to Moo::_install_tracked, avg 15µs/call
39
# spent 3.02ms (138µs+2.88) within Moo::has which was called 7 times, avg 431µs/call: # once (30µs+1.52ms) by DBIx::Class::Storage::BEGIN@16 at line 46 of DBIx/Class/Storage/BlockRunner.pm # once (19µs+381µs) by DBIx::Class::Storage::BEGIN@16 at line 78 of DBIx/Class/Storage/BlockRunner.pm # once (17µs+324µs) by DBIx::Class::Storage::BEGIN@16 at line 66 of DBIx/Class/Storage/BlockRunner.pm # once (25µs+271µs) by DBIx::Class::Storage::BEGIN@16 at line 92 of DBIx/Class/Storage/BlockRunner.pm # once (16µs+134µs) by DBIx::Class::Storage::BEGIN@16 at line 51 of DBIx/Class/Storage/BlockRunner.pm # once (16µs+130µs) by DBIx::Class::Storage::BEGIN@16 at line 73 of DBIx/Class/Storage/BlockRunner.pm # once (15µs+120µs) by DBIx::Class::Storage::BEGIN@16 at line 57 of DBIx/Class/Storage/BlockRunner.pm
_install_tracked $target => has => sub {
4073µs my $name_proto = shift;
4177µs my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto;
4274µs if (@_ % 2 != 0) {
43 require Carp;
44 Carp::croak("Invalid options for " . join(', ', map "'$_'", @name_proto)
45 . " attribute(s): even number of arguments expected, got " . scalar @_)
46 }
47719µs my %spec = @_;
4875µs foreach my $name (@name_proto) {
49 # Note that when multiple attributes specified, each attribute
50 # needs a separate \%specs hashref
5175µs my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec;
52719µs141.43ms $class->_constructor_maker_for($target)
# spent 1.37ms making 7 calls to Moo::_constructor_maker_for, avg 196µs/call # spent 60µs making 7 calls to Method::Generate::Constructor::register_attribute_specs, avg 9µs/call
53 ->register_attribute_specs($name, $spec_ref);
54719µs141.44ms $class->_accessor_maker_for($target)
# spent 1.43ms making 7 calls to Method::Generate::Accessor::generate_method, avg 204µs/call # spent 14µs making 7 calls to Moo::_accessor_maker_for, avg 2µs/call
55 ->generate_method($target, $name, $spec_ref);
56718µs712µs $class->_maybe_reset_handlemoose($target);
# spent 12µs making 7 calls to Moo::_maybe_reset_handlemoose, avg 2µs/call
57 }
58722µs return;
5928µs228µs };
# spent 28µs making 2 calls to Moo::_install_tracked, avg 14µs/call
6022µs foreach my $type (qw(before after around)) {
61 _install_tracked $target => $type => sub {
62 require Class::Method::Modifiers;
63 _install_modifier($target, $type, @_);
64 return;
65616µs679µs };
# spent 79µs making 6 calls to Moo::_install_tracked, avg 13µs/call
66 }
6722µs return if $MAKERS{$target}{is_class}; # already exported into this package
6823µs24µs my $stash = _getstash($target);
# spent 4µs making 2 calls to Moo::_Utils::_getstash, avg 2µs/call
69224µs my @not_methods = map { *$_{CODE}||() } grep !ref($_), values %$stash;
70234µs @{$MAKERS{$target}{not_methods}={}}{@not_methods} = @not_methods;
7122µs $MAKERS{$target}{is_class} = 1;
72 {
734284µs224µs
# spent 17µs (10+7) within Moo::BEGIN@73 which was called: # once (10µs+7µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 73
no strict 'refs';
# spent 17µs making 1 call to Moo::BEGIN@73 # spent 7µs making 1 call to strict::unimport
74 @{"${target}::ISA"} = do {
7542µs require Moo::Object; ('Moo::Object');
76219µs } unless @{"${target}::ISA"};
77 }
78210µs if ($INC{'Moo/HandleMoose.pm'}) {
79 Moo::HandleMoose::inject_fake_metaclass_for($target);
80 }
81}
82
83sub unimport {
84 my $target = caller;
85 _unimport_coderefs($target, $MAKERS{$target});
86}
87
88sub _set_superclasses {
89 my $class = shift;
90 my $target = shift;
91 foreach my $superclass (@_) {
92 _load_module($superclass);
93 if ($INC{'Role/Tiny.pm'} && Role::Tiny->is_role($superclass)) {
94 require Carp;
95 Carp::croak("Can't extend role '$superclass'");
96 }
97 }
98 # Can't do *{...} = \@_ or 5.10.0's mro.pm stops seeing @ISA
99 @{*{_getglob("${target}::ISA")}{ARRAY}} = @_;
100 if (my $old = delete $Moo::MAKERS{$target}{constructor}) {
101 delete _getstash($target)->{new};
102 Moo->_constructor_maker_for($target)
103 ->register_attribute_specs(%{$old->all_attribute_specs});
104 }
105 elsif (!$target->isa('Moo::Object')) {
106 Moo->_constructor_maker_for($target);
107 }
1082650µs241µs
# spent 26µs (11+15) within Moo::BEGIN@108 which was called: # once (11µs+15µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 108
no warnings 'once'; # piss off. -- mst
# spent 26µs making 1 call to Moo::BEGIN@108 # spent 15µs making 1 call to warnings::unimport
109 $Moo::HandleMoose::MOUSE{$target} = [
110 grep defined, map Mouse::Util::find_meta($_), @_
111 ] if Mouse::Util->can('find_meta');
112}
113
114
# spent 12µs within Moo::_maybe_reset_handlemoose which was called 7 times, avg 2µs/call: # 7 times (12µs+0s) by Moo::has at line 56, avg 2µs/call
sub _maybe_reset_handlemoose {
11573µs my ($class, $target) = @_;
116713µs if ($INC{"Moo/HandleMoose.pm"}) {
117 Moo::HandleMoose::maybe_reinject_fake_metaclass_for($target);
118 }
119}
120
121
# spent 85µs (46+39) within Moo::_accessor_maker_for which was called 9 times, avg 9µs/call: # 7 times (14µs+0s) by Moo::has at line 54, avg 2µs/call # 2 times (32µs+39µs) by Moo::_constructor_maker_for at line 201, avg 36µs/call
sub _accessor_maker_for {
12293µs my ($class, $target) = @_;
12393µs return unless $MAKERS{$target};
124922µs $MAKERS{$target}{accessor} ||= do {
12521µs my $maker_class = do {
12621µs if (my $m = do {
1272800ns require Sub::Defer;
128212µs47µs if (my $defer_target =
# spent 5µs making 2 calls to Sub::Defer::defer_info, avg 2µs/call # spent 3µs making 2 calls to UNIVERSAL::can, avg 1µs/call
129 (Sub::Defer::defer_info($target->can('new'))||[])->[0]
130 ) {
131 my ($pkg) = ($defer_target =~ /^(.*)::[^:]+$/);
132 $MAKERS{$pkg} && $MAKERS{$pkg}{accessor};
133 } else {
1342600ns undef;
135 }
136 }) {
137 ref($m);
138 } else {
13921µs require Method::Generate::Accessor;
1402500ns 'Method::Generate::Accessor'
141 }
142 };
14326µs231µs $maker_class->new;
# spent 31µs making 2 calls to Moo::Object::new, avg 16µs/call
144 }
145}
146
147
# spent 1.55ms (117µs+1.43) within Moo::_constructor_maker_for which was called 8 times, avg 194µs/call: # 7 times (55µs+1.32ms) by Moo::has at line 52, avg 196µs/call # once (62µs+116µs) by DBIx::Class::Storage::BlockRunner::BEGIN@16 at line 208 of Method/Generate/Constructor.pm
sub _constructor_maker_for {
14883µs my ($class, $target) = @_;
14984µs return unless $MAKERS{$target};
150825µs $MAKERS{$target}{constructor} ||= do {
15122µs require Method::Generate::Constructor;
15221µs require Sub::Defer;
1532400ns my ($moo_constructor, $con);
154
155230µs25µs my $t_new = $target->can('new');
# spent 5µs making 2 calls to UNIVERSAL::can, avg 3µs/call
15621µs if ($t_new) {
157214µs36µs if ($t_new == Moo::Object->can('new')) {
# spent 4µs making 1 call to Sub::Defer::defer_info # spent 2µs making 2 calls to UNIVERSAL::can, avg 1µs/call
158 $moo_constructor = 1;
159 }
160 elsif (my $defer_target = (Sub::Defer::defer_info($t_new)||[])->[0]) {
161 my ($pkg) = ($defer_target =~ /^(.*)::[^:]+$/);
162 if ($MAKERS{$pkg}) {
163 $moo_constructor = 1;
164 $con = $MAKERS{$pkg}{constructor};
165 }
166 }
167 }
168 else {
169 $moo_constructor = 1; # no other constructor, make a Moo one
170 }
171 ($con ? ref($con) : 'Method::Generate::Constructor')
172 ->new(
173 package => $target,
174 accessor_generator => $class->_accessor_maker_for($target),
175 $moo_constructor ? (
176 $con ? (construction_string => $con->construction_string) : ()
177 ) : (
178
# spent 10µs (6+4) within Moo::__ANON__[/usr/share/perl5/Moo.pm:183] which was called: # once (6µs+4µs) by Method::Generate::Constructor::_build_construction_string at line 68 of Method/Generate/Constructor.pm
construction_builder => sub {
179112µs14µs '$class->next::method('
# spent 4µs making 1 call to UNIVERSAL::can
180 .($target->can('FOREIGNBUILDARGS') ?
181 '$class->FOREIGNBUILDARGS(@_)' : '@_')
182 .')'
183 },
184 ),
185 subconstructor_handler => (
186 ' if ($Moo::MAKERS{$class}) {'."\n"
187 .' if ($Moo::MAKERS{$class}{constructor}) {'."\n"
188 .' return $class->'.$target.'::SUPER::new(@_);'."\n"
189 .' }'."\n"
190 .' '.$class.'->_constructor_maker_for($class);'."\n"
191 .' return $class->new(@_)'.";\n"
192 .' } elsif ($INC{"Moose.pm"} and my $meta = Class::MOP::get_metaclass_by_name($class)) {'."\n"
193 .' return $meta->new_object('."\n"
194 .' $class->can("BUILDARGS") ? $class->BUILDARGS(@_)'."\n"
195 .' : $class->Moo::Object::BUILDARGS(@_)'."\n"
196 .' );'."\n"
197 .' }'."\n"
198 ),
199 )
200 ->install_delayed
201232µs81.37ms ->register_attribute_specs(%{$con?$con->all_attribute_specs:{}})
# spent 1.21ms making 2 calls to Method::Generate::Constructor::new, avg 603µs/call # spent 82µs making 2 calls to Method::Generate::Constructor::install_delayed, avg 41µs/call # spent 71µs making 2 calls to Moo::_accessor_maker_for, avg 36µs/call # spent 11µs making 2 calls to Method::Generate::Constructor::register_attribute_specs, avg 5µs/call
202 }
203}
204
205sub _concrete_methods_of {
206 my ($me, $role) = @_;
207 my $makers = $MAKERS{$role};
208 # grab role symbol table
209 my $stash = _getstash($role);
210 # reverse so our keys become the values (captured coderefs) in case
211 # they got copied or re-used since
212 my $not_methods = { reverse %{$makers->{not_methods}||{}} };
213 +{
214 # grab all code entries that aren't in the not_methods list
215 map {
216 my $code = *{$stash->{$_}}{CODE};
217 ( ! $code or exists $not_methods->{$code} ) ? () : ($_ => $code)
218 } grep !ref($stash->{$_}), keys %$stash
219 };
220}
221
22212µs1;
223__END__