← 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:51 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Meta/Role/Application/ToClass.pm
StatementsExecuted 288 statements in 2.11ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
411473µs5.80msMoose::Meta::Role::Application::ToClass::::apply_methodsMoose::Meta::Role::Application::ToClass::apply_methods
411181µs15.3msMoose::Meta::Role::Application::ToClass::::applyMoose::Meta::Role::Application::ToClass::apply
411130µs6.56msMoose::Meta::Role::Application::ToClass::::apply_attributesMoose::Meta::Role::Application::ToClass::apply_attributes
123198µs250µsMoose::Meta::Role::Application::ToClass::::apply_method_modifiersMoose::Meta::Role::Application::ToClass::apply_method_modifiers
41185µs1.42msMoose::Meta::Role::Application::ToClass::::check_role_exclusionsMoose::Meta::Role::Application::ToClass::check_role_exclusions
41172µs530µsMoose::Meta::Role::Application::ToClass::::check_required_methodsMoose::Meta::Role::Application::ToClass::check_required_methods
41138µs102µsMoose::Meta::Role::Application::ToClass::::apply_override_method_modifiersMoose::Meta::Role::Application::ToClass::apply_override_method_modifiers
11110µs10µsMoose::Meta::Role::Application::ToClass::::BEGIN@2Moose::Meta::Role::Application::ToClass::BEGIN@2
11110µs53µsMoose::Meta::Role::Application::ToClass::::BEGIN@13Moose::Meta::Role::Application::ToClass::BEGIN@13
1119µs14µsMoose::Meta::Role::Application::ToClass::::BEGIN@9Moose::Meta::Role::Application::ToClass::BEGIN@9
1119µs220µsMoose::Meta::Role::Application::ToClass::::BEGIN@14Moose::Meta::Role::Application::ToClass::BEGIN@14
1119µs25µsMoose::Meta::Role::Application::ToClass::::BEGIN@10Moose::Meta::Role::Application::ToClass::BEGIN@10
1119µs84µsMoose::Meta::Role::Application::ToClass::::BEGIN@17Moose::Meta::Role::Application::ToClass::BEGIN@17
1118µs577µsMoose::Meta::Role::Application::ToClass::::BEGIN@11Moose::Meta::Role::Application::ToClass::BEGIN@11
1118µs37µsMoose::Meta::Role::Application::ToClass::::BEGIN@15Moose::Meta::Role::Application::ToClass::BEGIN@15
4117µs7µsMoose::Meta::Role::Application::ToClass::::check_required_attributesMoose::Meta::Role::Application::ToClass::check_required_attributes
0000s0sMoose::Meta::Role::Application::ToClass::::__ANON__[:127]Moose::Meta::Role::Application::ToClass::__ANON__[:127]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Meta::Role::Application::ToClass;
2
# spent 10µs within Moose::Meta::Role::Application::ToClass::BEGIN@2 which was called: # once (10µs+0s) by Moose::BEGIN@40 at line 4
BEGIN {
314µs $Moose::Meta::Role::Application::ToClass::AUTHORITY = 'cpan:STEVAN';
4127µs110µs}
5{
622µs $Moose::Meta::Role::Application::ToClass::VERSION = '2.0602';
7}
8
9319µs219µs
# spent 14µs (9+5) within Moose::Meta::Role::Application::ToClass::BEGIN@9 which was called: # once (9µs+5µs) by Moose::BEGIN@40 at line 9
use strict;
# spent 14µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@9 # spent 5µs making 1 call to strict::import
10319µs241µs
# spent 25µs (9+16) within Moose::Meta::Role::Application::ToClass::BEGIN@10 which was called: # once (9µs+16µs) by Moose::BEGIN@40 at line 10
use warnings;
# spent 25µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@10 # spent 16µs making 1 call to warnings::import
11328µs21.15ms
# spent 577µs (8+569) within Moose::Meta::Role::Application::ToClass::BEGIN@11 which was called: # once (8µs+569µs) by Moose::BEGIN@40 at line 11
use metaclass;
# spent 577µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@11 # spent 568µs making 1 call to metaclass::import
12
13323µs296µs
# spent 53µs (10+43) within Moose::Meta::Role::Application::ToClass::BEGIN@13 which was called: # once (10µs+43µs) by Moose::BEGIN@40 at line 13
use List::MoreUtils 'firstval';
# spent 53µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@13 # spent 43µs making 1 call to Exporter::import
14327µs2432µs
# spent 220µs (9+211) within Moose::Meta::Role::Application::ToClass::BEGIN@14 which was called: # once (9µs+211µs) by Moose::BEGIN@40 at line 14
use Moose::Util 'english_list';
# spent 220µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@14 # spent 211µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:756]
15327µs267µs
# spent 37µs (8+30) within Moose::Meta::Role::Application::ToClass::BEGIN@15 which was called: # once (8µs+30µs) by Moose::BEGIN@40 at line 15
use Scalar::Util 'weaken', 'blessed';
# spent 37µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@15 # spent 30µs making 1 call to Exporter::import
16
173825µs2159µs
# spent 84µs (9+75) within Moose::Meta::Role::Application::ToClass::BEGIN@17 which was called: # once (9µs+75µs) by Moose::BEGIN@40 at line 17
use base 'Moose::Meta::Role::Application';
# spent 84µs making 1 call to Moose::Meta::Role::Application::ToClass::BEGIN@17 # spent 75µs making 1 call to base::import
18
1917µs3508µs__PACKAGE__->meta->add_attribute('role' => (
# spent 473µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 25µs making 1 call to Moose::Meta::Role::Application::ToClass::meta # spent 10µs making 1 call to Class::MOP::_definition_context
20 reader => 'role',
21 Class::MOP::_definition_context(),
22));
23
2414µs3300µs__PACKAGE__->meta->add_attribute('class' => (
# spent 283µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 12µs making 1 call to Moose::Meta::Role::Application::ToClass::meta # spent 5µs making 1 call to Class::MOP::_definition_context
25 accessor => 'class',
26 Class::MOP::_definition_context(),
27));
28
29
# spent 15.3ms (181µs+15.1) within Moose::Meta::Role::Application::ToClass::apply which was called 4 times, avg 3.82ms/call: # 4 times (181µs+15.1ms) by Moose::Meta::Role::apply at line 470 of Moose/Meta/Role.pm, avg 3.82ms/call
sub apply {
3024186µs my ($self, $role, $class) = @_;
31
32 # We need weak_ref in CMOP :(
3348µs weaken($self->{role} = $role);
# spent 8µs making 4 calls to Scalar::Util::weaken, avg 2µs/call
3447µs weaken($self->{class} = $class);
# spent 7µs making 4 calls to Scalar::Util::weaken, avg 2µs/call
35
36414.9ms $self->SUPER::apply($role, $class);
# spent 14.9ms making 4 calls to Moose::Meta::Role::Application::apply, avg 3.73ms/call
37
38484µs $class->add_role($role);
# spent 84µs making 4 calls to Moose::Meta::Class::add_role, avg 21µs/call
39485µs $class->add_role_application($self);
# spent 85µs making 4 calls to Moose::Meta::Class::add_role_application, avg 21µs/call
40}
41
42
# spent 1.42ms (85µs+1.34) within Moose::Meta::Role::Application::ToClass::check_role_exclusions which was called 4 times, avg 355µs/call: # 4 times (85µs+1.34ms) by Moose::Meta::Role::Application::apply at line 54 of Moose/Meta/Role/Application.pm, avg 355µs/call
sub check_role_exclusions {
4312135µs my ($self, $role, $class) = @_;
4481.29ms if ($class->excludes_role($role->name)) {
# spent 1.28ms making 4 calls to Moose::Meta::Class::excludes_role, avg 320µs/call # spent 10µs making 4 calls to Class::MOP::Package::name, avg 2µs/call
45 $class->throw_error("Conflict detected: " . $class->name . " excludes role '" . $role->name . "'");
46 }
47447µs foreach my $excluded_role_name ($role->get_excluded_roles_list) {
# spent 47µs making 4 calls to Moose::Meta::Role::get_excluded_roles_list, avg 12µs/call
48 if ($class->does_role($excluded_role_name)) {
49 $class->throw_error("The class " . $class->name . " does the excluded role '$excluded_role_name'");
50 }
51 }
52}
53
54
# spent 530µs (72+457) within Moose::Meta::Role::Application::ToClass::check_required_methods which was called 4 times, avg 132µs/call: # 4 times (72µs+457µs) by Moose::Meta::Role::Application::apply at line 55 of Moose/Meta/Role/Application.pm, avg 132µs/call
sub check_required_methods {
552042µs my ($self, $role, $class) = @_;
56
57 my @missing;
58 my @is_attr;
59
60 # NOTE:
61 # we might need to move this down below the
62 # the attributes so that we can require any
63 # attribute accessors. However I am thinking
64 # that maybe those are somehow exempt from
65 # the require methods stuff.
66451µs foreach my $required_method ($role->get_required_method_list) {
# spent 51µs making 4 calls to Moose::Meta::Role::get_required_method_list, avg 13µs/call
67819µs49µs my $required_method_name = $required_method->name;
# spent 9µs making 4 calls to Moose::Meta::Role::Method::Required::name, avg 2µs/call
68
694398µs if (!$class->find_method_by_name($required_method_name)) {
# spent 398µs making 4 calls to Class::MOP::Class::find_method_by_name, avg 99µs/call
70
71 next if $self->is_aliased_method($required_method_name);
72
73 push @missing, $required_method;
74 }
75 }
76
77 return unless @missing;
78
79 my $error = '';
80
81 @missing = sort { $a->name cmp $b->name } @missing;
82 my @conflicts = grep { $_->isa('Moose::Meta::Role::Method::Conflicting') } @missing;
83
84 if (@conflicts) {
85 my $conflict = $conflicts[0];
86 my $roles = $conflict->roles_as_english_list;
87
88 my @same_role_conflicts = grep { $_->roles_as_english_list eq $roles } @conflicts;
89
90 if (@same_role_conflicts == 1) {
91 $error
92 .= "Due to a method name conflict in roles "
93 . $roles
94 . ", the method '"
95 . $conflict->name
96 . "' must be implemented or excluded by '"
97 . $class->name
98 . q{'};
99 }
100 else {
101 my $methods
102 = Moose::Util::english_list( map { q{'} . $_->name . q{'} } @same_role_conflicts );
103
104 $error
105 .= "Due to method name conflicts in roles "
106 . $roles
107 . ", the methods "
108 . $methods
109 . " must be implemented or excluded by '"
110 . $class->name
111 . q{'};
112 }
113 }
114 elsif (@missing) {
115 my $noun = @missing == 1 ? 'method' : 'methods';
116
117 my $list
118 = Moose::Util::english_list( map { q{'} . $_ . q{'} } @missing );
119
120 $error
121 .= q{'}
122 . $role->name
123 . "' requires the $noun $list "
124 . "to be implemented by '"
125 . $class->name . q{'};
126
127 if (my $meth = firstval { $class->name->can($_) } @missing) {
128 $error .= ". If you imported functions intending to use them as "
129 . "methods, you need to explicitly mark them as such, via "
130 . $class->name . "->meta->add_method($meth => \\\&$meth)";
131 }
132 }
133
134 $class->throw_error($error);
135}
136
137413µs
# spent 7µs within Moose::Meta::Role::Application::ToClass::check_required_attributes which was called 4 times, avg 2µs/call: # 4 times (7µs+0s) by Moose::Meta::Role::Application::apply at line 56 of Moose/Meta/Role/Application.pm, avg 2µs/call
sub check_required_attributes {
138
139}
140
141
# spent 6.56ms (130µs+6.43) within Moose::Meta::Role::Application::ToClass::apply_attributes which was called 4 times, avg 1.64ms/call: # 4 times (130µs+6.43ms) by Moose::Meta::Role::Application::apply at line 58 of Moose/Meta/Role/Application.pm, avg 1.64ms/call
sub apply_attributes {
142852µs my ($self, $role, $class) = @_;
143
144437µs foreach my $attribute_name ($role->get_attribute_list) {
# spent 37µs making 4 calls to Class::MOP::Mixin::HasAttributes::get_attribute_list, avg 9µs/call
145 # it if it has one already
146460µs224µs if ($class->has_attribute($attribute_name) &&
# spent 24µs making 2 calls to Class::MOP::Mixin::HasAttributes::has_attribute, avg 12µs/call
147 # make sure we haven't seen this one already too
148 $class->get_attribute($attribute_name) != $role->get_attribute($attribute_name)) {
149 next;
150 }
151 else {
15266.37ms $class->add_attribute(
# spent 3.63ms making 2 calls to Moose::Meta::Class::add_attribute, avg 1.81ms/call # spent 2.72ms making 2 calls to Moose::Meta::Role::Attribute::attribute_for_class, avg 1.36ms/call # spent 21µs making 2 calls to Class::MOP::Mixin::HasAttributes::get_attribute, avg 11µs/call
153 $role->get_attribute($attribute_name)->attribute_for_class
154 );
155 }
156 }
157}
158
159
# spent 5.80ms (473µs+5.32) within Moose::Meta::Role::Application::ToClass::apply_methods which was called 4 times, avg 1.45ms/call: # 4 times (473µs+5.32ms) by Moose::Meta::Role::Application::apply at line 59 of Moose/Meta/Role/Application.pm, avg 1.45ms/call
sub apply_methods {
1601294µs my ( $self, $role, $class ) = @_;
161
16242.99ms foreach my $method ( $role->_get_local_methods ) {
# spent 2.99ms making 4 calls to Class::MOP::Mixin::HasMethods::_get_local_methods, avg 748µs/call
16368295µs1918µs my $method_name = $method->name;
# spent 18µs making 19 calls to Class::MOP::Method::name, avg 942ns/call
164
1651940µs next if $method->isa('Class::MOP::Method::Meta');
# spent 40µs making 19 calls to UNIVERSAL::isa, avg 2µs/call
166
1674560µs15140µs unless ( $self->is_method_excluded($method_name) ) {
# spent 140µs making 15 calls to Moose::Meta::Role::Application::is_method_excluded, avg 9µs/call
168
16915491µs my $class_method = $class->get_method($method_name);
# spent 491µs making 15 calls to Class::MOP::Mixin::HasMethods::get_method, avg 33µs/call
170
171 next if $class_method && $class_method->body != $method->body;
172
173151.51ms $class->add_method(
# spent 1.51ms making 15 calls to Class::MOP::Mixin::HasMethods::add_method, avg 100µs/call
174 $method_name,
175 $method,
176 );
177 }
178
17915125µs next unless $self->is_method_aliased($method_name);
# spent 125µs making 15 calls to Moose::Meta::Role::Application::is_method_aliased, avg 8µs/call
180
181 my $aliased_method_name = $self->get_method_aliases->{$method_name};
182
183 my $class_method = $class->get_method($aliased_method_name);
184
185 if ( $class_method && $class_method->body != $method->body ) {
186 $class->throw_error(
187 "Cannot create a method alias if a local method of the same name exists"
188 );
189 }
190
191 $class->add_method(
192 $aliased_method_name,
193 $method,
194 );
195 }
196
197 # we must reset the cache here since
198 # we are just aliasing methods, otherwise
199 # the modifiers go wonky.
200411µs $class->reset_package_cache_flag;
# spent 11µs making 4 calls to Class::MOP::Mixin::HasMethods::reset_package_cache_flag, avg 3µs/call
201}
202
203
# spent 102µs (38+64) within Moose::Meta::Role::Application::ToClass::apply_override_method_modifiers which was called 4 times, avg 26µs/call: # 4 times (38µs+64µs) by Moose::Meta::Role::Application::apply at line 61 of Moose/Meta/Role/Application.pm, avg 26µs/call
sub apply_override_method_modifiers {
204836µs my ($self, $role, $class) = @_;
205464µs foreach my $method_name ($role->get_method_modifier_list('override')) {
# spent 64µs making 4 calls to Moose::Meta::Role::get_method_modifier_list, avg 16µs/call
206 # it if it has one already then ...
207 if ($class->has_method($method_name)) {
208 next;
209 }
210 else {
211 # if this is not a role, then we need to
212 # find the original package of the method
213 # so that we can tell the class were to
214 # find the right super() method
215 my $method = $role->get_override_method_modifier($method_name);
216 my ($package) = Class::MOP::get_code_info($method);
217 # if it is a class, we just add it
218 $class->add_override_method_modifier($method_name, $method, $package);
219 }
220 }
221}
222
223
# spent 250µs (98+152) within Moose::Meta::Role::Application::ToClass::apply_method_modifiers which was called 12 times, avg 21µs/call: # 4 times (44µs+65µs) by Moose::Meta::Role::Application::apply_before_method_modifiers at line 77 of Moose/Meta/Role/Application.pm, avg 27µs/call # 4 times (27µs+43µs) by Moose::Meta::Role::Application::apply_around_method_modifiers at line 78 of Moose/Meta/Role/Application.pm, avg 18µs/call # 4 times (27µs+44µs) by Moose::Meta::Role::Application::apply_after_method_modifiers at line 79 of Moose/Meta/Role/Application.pm, avg 18µs/call
sub apply_method_modifiers {
22448100µs my ($self, $modifier_type, $role, $class) = @_;
225 my $add = "add_${modifier_type}_method_modifier";
226 my $get = "get_${modifier_type}_method_modifiers";
22712152µs foreach my $method_name ($role->get_method_modifier_list($modifier_type)) {
# spent 152µs making 12 calls to Moose::Meta::Role::get_method_modifier_list, avg 13µs/call
228 $class->$add(
229 $method_name,
230 $_
231 ) foreach $role->$get($method_name);
232 }
233}
234
23519µs1;
236
237# ABSTRACT: Compose a role into a class
238
- -
241=pod
242
243=head1 NAME
244
245Moose::Meta::Role::Application::ToClass - Compose a role into a class
246
247=head1 VERSION
248
249version 2.0602
250
251=head1 DESCRIPTION
252
253=head2 METHODS
254
255=over 4
256
257=item B<new>
258
259=item B<meta>
260
261=item B<apply>
262
263=item B<check_role_exclusions>
264
265=item B<check_required_methods>
266
267=item B<check_required_attributes>
268
269=item B<apply_attributes>
270
271=item B<apply_methods>
272
273=item B<apply_method_modifiers>
274
275=item B<apply_override_method_modifiers>
276
277=back
278
279=head1 BUGS
280
281See L<Moose/BUGS> for details on reporting bugs.
282
283=head1 AUTHOR
284
285Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
286
287=head1 COPYRIGHT AND LICENSE
288
289This software is copyright (c) 2012 by Infinity Interactive, Inc..
290
291This is free software; you can redistribute it and/or modify it under
292the same terms as the Perl 5 programming language system itself.
293
294=cut
295
296
297__END__