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

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Meta/Role/Attribute.pm
StatementsExecuted 51 statements in 852µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
21194µs94µsMoose::Meta::Role::Attribute::::newMoose::Meta::Role::Attribute::new
21182µs2.72msMoose::Meta::Role::Attribute::::attribute_for_classMoose::Meta::Role::Attribute::attribute_for_class
21138µs49µsMoose::Meta::Role::Attribute::::attach_to_roleMoose::Meta::Role::Attribute::attach_to_role
21126µs43µsMoose::Meta::Role::Attribute::::original_roleMoose::Meta::Role::Attribute::original_role
11111µs25µsMoose::Meta::Role::Attribute::::BEGIN@10Moose::Meta::Role::Attribute::BEGIN@10
1119µs9µsMoose::Meta::Role::Attribute::::BEGIN@2Moose::Meta::Role::Attribute::BEGIN@2
1118µs131µsMoose::Meta::Role::Attribute::::BEGIN@16Moose::Meta::Role::Attribute::BEGIN@16
1117µs27µsMoose::Meta::Role::Attribute::::BEGIN@13Moose::Meta::Role::Attribute::BEGIN@13
1117µs11µsMoose::Meta::Role::Attribute::::BEGIN@9Moose::Meta::Role::Attribute::BEGIN@9
1116µs28µsMoose::Meta::Role::Attribute::::BEGIN@14Moose::Meta::Role::Attribute::BEGIN@14
1116µs26µsMoose::Meta::Role::Attribute::::BEGIN@12Moose::Meta::Role::Attribute::BEGIN@12
0000s0sMoose::Meta::Role::Attribute::::__ANON__[:120]Moose::Meta::Role::Attribute::__ANON__[:120]
0000s0sMoose::Meta::Role::Attribute::::cloneMoose::Meta::Role::Attribute::clone
0000s0sMoose::Meta::Role::Attribute::::is_same_asMoose::Meta::Role::Attribute::is_same_as
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::Attribute;
2
# spent 9µs within Moose::Meta::Role::Attribute::BEGIN@2 which was called: # once (9µs+0s) by Moose::Meta::Role::BEGIN@19 at line 4
BEGIN {
314µs $Moose::Meta::Role::Attribute::AUTHORITY = 'cpan:STEVAN';
4122µs19µs}
# spent 9µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@2
5{
621µs $Moose::Meta::Role::Attribute::VERSION = '2.0602';
7}
8
9319µs215µs
# spent 11µs (7+4) within Moose::Meta::Role::Attribute::BEGIN@9 which was called: # once (7µs+4µs) by Moose::Meta::Role::BEGIN@19 at line 9
use strict;
# spent 11µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@9 # spent 4µs making 1 call to strict::import
10319µs239µs
# spent 25µs (11+14) within Moose::Meta::Role::Attribute::BEGIN@10 which was called: # once (11µs+14µs) by Moose::Meta::Role::BEGIN@19 at line 10
use warnings;
# spent 25µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@10 # spent 14µs making 1 call to warnings::import
11
12318µs247µs
# spent 26µs (6+21) within Moose::Meta::Role::Attribute::BEGIN@12 which was called: # once (6µs+21µs) by Moose::Meta::Role::BEGIN@19 at line 12
use Carp 'confess';
# spent 26µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@12 # spent 21µs making 1 call to Exporter::import
13319µs246µs
# spent 27µs (7+20) within Moose::Meta::Role::Attribute::BEGIN@13 which was called: # once (7µs+20µs) by Moose::Meta::Role::BEGIN@19 at line 13
use List::MoreUtils 'all';
# spent 27µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@13 # spent 20µs making 1 call to Exporter::import
14322µs251µs
# spent 28µs (6+22) within Moose::Meta::Role::Attribute::BEGIN@14 which was called: # once (6µs+22µs) by Moose::Meta::Role::BEGIN@19 at line 14
use Scalar::Util 'blessed', 'weaken';
# spent 28µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@14 # spent 22µs making 1 call to Exporter::import
15
163432µs2253µs
# spent 131µs (8+123) within Moose::Meta::Role::Attribute::BEGIN@16 which was called: # once (8µs+123µs) by Moose::Meta::Role::BEGIN@19 at line 16
use base 'Moose::Meta::Mixin::AttributeCore', 'Class::MOP::Object';
# spent 131µs making 1 call to Moose::Meta::Role::Attribute::BEGIN@16 # spent 123µs making 1 call to base::import
17
18113µs31.03ms__PACKAGE__->meta->add_attribute(
# spent 569µs making 1 call to Class::MOP::Mixin::meta # spent 451µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 9µs making 1 call to Class::MOP::_definition_context
19 'metaclass' => (
20 reader => 'metaclass',
21 Class::MOP::_definition_context(),
22 )
23);
24
2514µs3332µs__PACKAGE__->meta->add_attribute(
# spent 296µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 31µs making 1 call to Class::MOP::Mixin::meta # spent 6µs making 1 call to Class::MOP::_definition_context
26 'associated_role' => (
27 reader => 'associated_role',
28 Class::MOP::_definition_context(),
29 )
30);
31
3214µs3279µs__PACKAGE__->meta->add_attribute(
# spent 264µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 10µs making 1 call to Class::MOP::Mixin::meta # spent 5µs making 1 call to Class::MOP::_definition_context
33 '_original_role' => (
34 reader => '_original_role',
35 Class::MOP::_definition_context(),
36 )
37);
38
3914µs3281µs__PACKAGE__->meta->add_attribute(
# spent 266µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 10µs making 1 call to Class::MOP::Mixin::meta # spent 4µs making 1 call to Class::MOP::_definition_context
40 'is' => (
41 reader => 'is',
42 Class::MOP::_definition_context(),
43 )
44);
45
4614µs3280µs__PACKAGE__->meta->add_attribute(
# spent 266µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 10µs making 1 call to Class::MOP::Mixin::meta # spent 5µs making 1 call to Class::MOP::_definition_context
47 'original_options' => (
48 reader => 'original_options',
49 Class::MOP::_definition_context(),
50 )
51);
52
53
# spent 94µs within Moose::Meta::Role::Attribute::new which was called 2 times, avg 47µs/call: # 2 times (94µs+0s) by Class::MOP::Mixin::HasAttributes::add_attribute at line 20 of Class/MOP/Mixin/HasAttributes.pm, avg 47µs/call
sub new {
548100µs my ( $class, $name, %options ) = @_;
55
56 (defined $name)
57 || confess "You must provide a name for the attribute";
58
59 my $role = delete $options{_original_role};
60
61 return bless {
62 name => $name,
63 original_options => \%options,
64 _original_role => $role,
65 %options,
66 }, $class;
67}
68
69
# spent 49µs (38+11) within Moose::Meta::Role::Attribute::attach_to_role which was called 2 times, avg 24µs/call: # 2 times (38µs+11µs) by Moose::Meta::Role::_attach_attribute at line 259 of Moose/Meta/Role.pm, avg 24µs/call
sub attach_to_role {
70653µs my ( $self, $role ) = @_;
71
7246µs ( blessed($role) && $role->isa('Moose::Meta::Role') )
# spent 4µs making 2 calls to Scalar::Util::blessed, avg 2µs/call # spent 3µs making 2 calls to UNIVERSAL::isa, avg 1µs/call
73 || confess
74 "You must pass a Moose::Meta::Role instance (or a subclass)";
75
7625µs weaken( $self->{'associated_role'} = $role );
# spent 5µs making 2 calls to Scalar::Util::weaken, avg 2µs/call
77}
78
79
# spent 43µs (26+17) within Moose::Meta::Role::Attribute::original_role which was called 2 times, avg 21µs/call: # 2 times (26µs+17µs) by Moose::Meta::Role::Attribute::attribute_for_class at line 88, avg 21µs/call
sub original_role {
80436µs my $self = shift;
81
82416µs return $self->_original_role || $self->associated_role;
# spent 9µs making 2 calls to Moose::Meta::Role::Attribute::_original_role, avg 4µs/call # spent 8µs making 2 calls to Moose::Meta::Role::Attribute::associated_role, avg 4µs/call
83}
84
85
# spent 2.72ms (82µs+2.64) within Moose::Meta::Role::Attribute::attribute_for_class which was called 2 times, avg 1.36ms/call: # 2 times (82µs+2.64ms) by Moose::Meta::Role::Application::ToClass::apply_attributes at line 152 of Moose/Meta/Role/Application/ToClass.pm, avg 1.36ms/call
sub attribute_for_class {
86664µs my $self = shift;
87
88452µs my $metaclass = $self->original_role->applied_attribute_metaclass;
# spent 43µs making 2 calls to Moose::Meta::Role::Attribute::original_role, avg 21µs/call # spent 10µs making 2 calls to Moose::Meta::Role::applied_attribute_metaclass, avg 5µs/call
89
90 return $metaclass->interpolate_class_and_new(
9162.58ms $self->name => %{ $self->original_options } );
# spent 2.57ms making 2 calls to Moose::Meta::Attribute::interpolate_class_and_new, avg 1.29ms/call # spent 8µs making 2 calls to Moose::Meta::Role::Attribute::original_options, avg 4µs/call # spent 3µs making 2 calls to Class::MOP::Mixin::AttributeCore::name, avg 2µs/call
92}
93
94sub clone {
95 my $self = shift;
96
97 my $role = $self->original_role;
98
99 return ( ref $self )->new(
100 $self->name,
101 %{ $self->original_options },
102 _original_role => $role,
103 );
104}
105
106sub is_same_as {
107 my $self = shift;
108 my $attr = shift;
109
110 my $self_options = $self->original_options;
111 my $other_options = $attr->original_options;
112
113 return 0
114 unless ( join q{|}, sort keys %{$self_options} ) eq ( join q{|}, sort keys %{$other_options} );
115
116 for my $key ( keys %{$self_options} ) {
117 return 0 if defined $self_options->{$key} && ! defined $other_options->{$key};
118 return 0 if ! defined $self_options->{$key} && defined $other_options->{$key};
119
120 next if all { ! defined } $self_options->{$key}, $other_options->{$key};
121
122 return 0 unless $self_options->{$key} eq $other_options->{$key};
123 }
124
125 return 1;
126}
127
128113µs1;
129
130# ABSTRACT: The Moose attribute metaclass for Roles
131
- -
134=pod
135
136=head1 NAME
137
138Moose::Meta::Role::Attribute - The Moose attribute metaclass for Roles
139
140=head1 VERSION
141
142version 2.0602
143
144=head1 DESCRIPTION
145
146This class implements the API for attributes in roles. Attributes in roles are
147more like attribute prototypes than full blown attributes. While they are
148introspectable, they have very little behavior.
149
150=head1 METHODS
151
152This class provides the following methods:
153
154=over 4
155
156=item B<< Moose::Meta::Role::Attribute->new(...) >>
157
158This method accepts all the options that would be passed to the constructor
159for L<Moose::Meta::Attribute>.
160
161=item B<< $attr->metaclass >>
162
163=item B<< $attr->is >>
164
165Returns the option as passed to the constructor.
166
167=item B<< $attr->associated_role >>
168
169Returns the L<Moose::Meta::Role> to which this attribute belongs, if any.
170
171=item B<< $attr->original_role >>
172
173Returns the L<Moose::Meta::Role> in which this attribute was first
174defined. This may not be the same as the value C<associated_role()> in the
175case of composite role, or the case where one role consumes other roles.
176
177=item B<< $attr->original_options >>
178
179Returns a hash reference of options passed to the constructor. This is used
180when creating a L<Moose::Meta::Attribute> object from this object.
181
182=item B<< $attr->attach_to_role($role) >>
183
184Attaches the attribute to the given L<Moose::Meta::Role>.
185
186=item B<< $attr->attribute_for_class($metaclass) >>
187
188Given an attribute metaclass name, this method calls C<<
189$metaclass->interpolate_class_and_new >> to construct an attribute object
190which can be added to a L<Moose::Meta::Class>.
191
192=item B<< $attr->clone >>
193
194Creates a new object identical to the object on which the method is called.
195
196=item B<< $attr->is_same_as($other_attr) >>
197
198Compares two role attributes and returns true if they are identical.
199
200=back
201
202In addition, this class implements all informational predicates implements by
203L<Moose::Meta::Attribute> (and L<Class::MOP::Attribute>).
204
205=head1 BUGS
206
207See L<Moose/BUGS> for details on reporting bugs.
208
209=head1 AUTHOR
210
211Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
212
213=head1 COPYRIGHT AND LICENSE
214
215This software is copyright (c) 2012 by Infinity Interactive, Inc..
216
217This is free software; you can redistribute it and/or modify it under
218the same terms as the Perl 5 programming language system itself.
219
220=cut
221
222
223__END__