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

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Object.pm
StatementsExecuted 99 statements in 1.63ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111208µs248µsMoose::Object::::BEGIN@19Moose::Object::BEGIN@19
311172µs1.40msMoose::Object::::doesMoose::Object::does
311108µs434µsMoose::Object::::DESTROYMoose::Object::DESTROY
31198µs186µsMoose::Object::::__ANON__[:99]Moose::Object::__ANON__[:99]
11156µs57µsMoose::Object::::BEGIN@108Moose::Object::BEGIN@108
33352µs4.13msMoose::Object::::newMoose::Object::new (recurses: max depth 1, inclusive time 237µs)
11151µs67µsMoose::Object::::BEGIN@85Moose::Object::BEGIN@85
31139µs73µsMoose::Object::::DEMOLISHALLMoose::Object::DEMOLISHALL
11114µs2.46msMoose::Object::::BEGIN@20Moose::Object::BEGIN@20
31111µs11µsMoose::Object::::BUILDARGSMoose::Object::BUILDARGS
11110µs10µsMoose::Object::::BEGIN@3Moose::Object::BEGIN@3
3119µs27µsMoose::Object::::BUILDALLMoose::Object::BUILDALL
1119µs14µsMoose::Object::::BEGIN@10Moose::Object::BEGIN@10
1118µs24µsMoose::Object::::BEGIN@11Moose::Object::BEGIN@11
1116µs6µsMoose::Object::::BEGIN@15Moose::Object::BEGIN@15
1114µs4µsMoose::Object::::BEGIN@16Moose::Object::BEGIN@16
1113µs3µsMoose::Object::::BEGIN@14Moose::Object::BEGIN@14
1113µs3µsMoose::Object::::BEGIN@13Moose::Object::BEGIN@13
1113µs3µsMoose::Object::::BEGIN@17Moose::Object::BEGIN@17
0000s0sMoose::Object::::__ANON__[:102]Moose::Object::__ANON__[:102]
0000s0sMoose::Object::::dumpMoose::Object::dump
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Moose::Object;
3
# spent 10µs within Moose::Object::BEGIN@3 which was called: # once (10µs+0s) by Moose::BEGIN@34 at line 5
BEGIN {
415µs $Moose::Object::AUTHORITY = 'cpan:STEVAN';
5124µs110µs}
# spent 10µs making 1 call to Moose::Object::BEGIN@3
6{
721µs $Moose::Object::VERSION = '2.0602';
8}
9
10319µs219µs
# spent 14µs (9+5) within Moose::Object::BEGIN@10 which was called: # once (9µs+5µs) by Moose::BEGIN@34 at line 10
use strict;
# spent 14µs making 1 call to Moose::Object::BEGIN@10 # spent 5µs making 1 call to strict::import
11318µs240µs
# spent 24µs (8+16) within Moose::Object::BEGIN@11 which was called: # once (8µs+16µs) by Moose::BEGIN@34 at line 11
use warnings;
# spent 24µs making 1 call to Moose::Object::BEGIN@11 # spent 16µs making 1 call to warnings::import
12
13315µs13µs
# spent 3µs within Moose::Object::BEGIN@13 which was called: # once (3µs+0s) by Moose::BEGIN@34 at line 13
use Carp ();
# spent 3µs making 1 call to Moose::Object::BEGIN@13
14317µs13µs
# spent 3µs within Moose::Object::BEGIN@14 which was called: # once (3µs+0s) by Moose::BEGIN@34 at line 14
use Devel::GlobalDestruction ();
# spent 3µs making 1 call to Moose::Object::BEGIN@14
15314µs16µs
# spent 6µs within Moose::Object::BEGIN@15 which was called: # once (6µs+0s) by Moose::BEGIN@34 at line 15
use MRO::Compat ();
# spent 6µs making 1 call to Moose::Object::BEGIN@15
16318µs14µs
# spent 4µs within Moose::Object::BEGIN@16 which was called: # once (4µs+0s) by Moose::BEGIN@34 at line 16
use Scalar::Util ();
# spent 4µs making 1 call to Moose::Object::BEGIN@16
17327µs13µs
# spent 3µs within Moose::Object::BEGIN@17 which was called: # once (3µs+0s) by Moose::BEGIN@34 at line 17
use Try::Tiny ();
# spent 3µs making 1 call to Moose::Object::BEGIN@17
18
193223µs2252µs
# spent 248µs (208+40) within Moose::Object::BEGIN@19 which was called: # once (208µs+40µs) by Moose::BEGIN@34 at line 19
use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class';
# spent 248µs making 1 call to Moose::Object::BEGIN@19 # spent 4µs making 1 call to if::import
203326µs22.46ms
# spent 2.46ms (14µs+2.45) within Moose::Object::BEGIN@20 which was called: # once (14µs+2.45ms) by Moose::BEGIN@34 at line 20
use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class';
# spent 2.46ms making 1 call to Moose::Object::BEGIN@20 # spent 2µs making 1 call to if::import
21
22
# spent 4.13ms (52µs+4.07) within Moose::Object::new which was called 3 times, avg 1.38ms/call: # once (22µs+3.26ms) by MooseX::Traits::new_with_traits at line 52 of MooseX/Traits.pm # once (17µs+823µs) by main::RUNTIME at line 46 of xt/tapper-mcp-scheduler-with-db-longrun.t # once (13µs+-13µs) by Tapper::MCP::Scheduler::Controller::__ANON__[lib/Tapper/MCP/Scheduler/Controller.pm:14] at line 14 of lib/Tapper/MCP/Scheduler/Controller.pm
sub new {
2332µs my $class = shift;
24312µs32µs my $real_class = Scalar::Util::blessed($class) || $class;
# spent 2µs making 3 calls to Scalar::Util::blessed, avg 800ns/call
25
26313µs311µs my $params = $real_class->BUILDARGS(@_);
# spent 11µs making 3 calls to Moose::Object::BUILDARGS, avg 4µs/call
27
28331µs64.08ms return Class::MOP::Class->initialize($real_class)->new_object($params);
# spent 4.28ms making 3 calls to Moose::Meta::Class::new_object, avg 1.43ms/call, recursion: max depth 1, sum of overlapping time 216µs # spent 15µs making 3 calls to Class::MOP::Class::initialize, avg 5µs/call
29}
30
31
# spent 11µs within Moose::Object::BUILDARGS which was called 3 times, avg 4µs/call: # 3 times (11µs+0s) by Moose::Object::new at line 26, avg 4µs/call
sub BUILDARGS {
3232µs my $class = shift;
3333µs if ( scalar @_ == 1 ) {
34 unless ( defined $_[0] && ref $_[0] eq 'HASH' ) {
35 Class::MOP::class_of($class)->throw_error(
36 "Single parameters to new() must be a HASH ref",
37 data => $_[0] );
38 }
39 return { %{ $_[0] } };
40 }
41 elsif ( @_ % 2 ) {
42 Carp::carp(
43 "The new() method for $class expects a hash reference or a key/value list."
44 . " You passed an odd number of arguments" );
45 return { @_, undef };
46 }
47 else {
4839µs return {@_};
49 }
50}
51
52
# spent 27µs (9+18) within Moose::Object::BUILDALL which was called 3 times, avg 9µs/call: # 3 times (9µs+18µs) by Moose::Meta::Class::new_object at line 278 of Moose/Meta/Class.pm, avg 9µs/call
sub BUILDALL {
53 # NOTE: we ask Perl if we even
54 # need to do this first, to avoid
55 # extra meta level calls
56330µs318µs return unless $_[0]->can('BUILD');
# spent 18µs making 3 calls to UNIVERSAL::can, avg 6µs/call
57 my ($self, $params) = @_;
58 foreach my $method (reverse Class::MOP::class_of($self)->find_all_methods_by_name('BUILD')) {
59 $method->{code}->execute($self, $params);
60 }
61}
62
63
# spent 73µs (39+35) within Moose::Object::DEMOLISHALL which was called 3 times, avg 24µs/call: # 3 times (39µs+35µs) by Moose::Object::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Object.pm:99] at line 98, avg 24µs/call
sub DEMOLISHALL {
6433µs my $self = shift;
6533µs my ($in_global_destruction) = @_;
66
67 # NOTE: we ask Perl if we even
68 # need to do this first, to avoid
69 # extra meta level calls
70380µs335µs return unless $self->can('DEMOLISH');
# spent 35µs making 3 calls to UNIVERSAL::can, avg 12µs/call
71
72 my @isa;
73 if ( my $meta = Class::MOP::class_of($self ) ) {
74 @isa = $meta->linearized_isa;
75 } else {
76 # We cannot count on being able to retrieve a previously made
77 # metaclass, _or_ being able to make a new one during global
78 # destruction. However, we should still be able to use mro at
79 # that time (at least tests suggest so ;)
80 my $class_name = ref $self;
81 @isa = @{ mro::get_linear_isa($class_name) }
82 }
83
84 foreach my $class (@isa) {
853145µs283µs
# spent 67µs (51+16) within Moose::Object::BEGIN@85 which was called: # once (51µs+16µs) by Moose::BEGIN@34 at line 85
no strict 'refs';
# spent 67µs making 1 call to Moose::Object::BEGIN@85 # spent 16µs making 1 call to strict::unimport
86 my $demolish = *{"${class}::DEMOLISH"}{CODE};
87 $self->$demolish($in_global_destruction)
88 if defined $demolish;
89 }
90}
91
92
# spent 434µs (108+326) within Moose::Object::DESTROY which was called 3 times, avg 145µs/call: # 3 times (108µs+326µs) by main::NULL at line 0 of xt/tapper-mcp-scheduler-with-db-longrun.t, avg 145µs/call
sub DESTROY {
9334µs my $self = shift;
94
9538µs local $?;
96
97
# spent 186µs (98+88) within Moose::Object::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Object.pm:99] which was called 3 times, avg 62µs/call: # 3 times (98µs+88µs) by Try::Tiny::try at line 76 of Try/Tiny.pm, avg 62µs/call
Try::Tiny::try {
983112µs688µs $self->DEMOLISHALL(Devel::GlobalDestruction::in_global_destruction);
# spent 73µs making 3 calls to Moose::Object::DEMOLISHALL, avg 24µs/call # spent 15µs making 3 calls to Devel::GlobalDestruction::in_global_destruction, avg 5µs/call
99 }
100 Try::Tiny::catch {
101 die $_;
102359µs6326µs };
# spent 296µs making 3 calls to Try::Tiny::try, avg 99µs/call # spent 30µs making 3 calls to Try::Tiny::catch, avg 10µs/call
103
104320µs return;
105}
106
107# support for UNIVERSAL::DOES ...
108
# spent 57µs (56+2) within Moose::Object::BEGIN@108 which was called: # once (56µs+2µs) by Moose::BEGIN@34 at line 115
BEGIN {
10918µs12µs my $does = UNIVERSAL->can("DOES") ? "SUPER::DOES" : "isa";
# spent 2µs making 1 call to UNIVERSAL::can
110151µs eval 'sub DOES {
111 my ( $self, $class_or_role_name ) = @_;
112 return $self->'.$does.'($class_or_role_name)
113 || $self->does($class_or_role_name);
114 }';
1151146µs157µs}
# spent 57µs making 1 call to Moose::Object::BEGIN@108
116
117# new does() methods will be created
118# as appropiate see Moose::Meta::Role
119
# spent 1.40ms (172µs+1.22) within Moose::Object::does which was called 3 times, avg 466µs/call: # 3 times (172µs+1.22ms) by MooseX::Traits::Util::check_class at line 17 of MooseX/Traits/Util.pm, avg 466µs/call
sub does {
12035µs my ($self, $role_name) = @_;
121326µs34µs my $class = Scalar::Util::blessed($self) || $self;
# spent 4µs making 3 calls to Scalar::Util::blessed, avg 2µs/call
122327µs365µs my $meta = Class::MOP::Class->initialize($class);
# spent 65µs making 3 calls to Class::MOP::Class::initialize, avg 22µs/call
12332µs (defined $role_name)
124 || $meta->throw_error("You must supply a role name to does()");
1253118µs61.16ms return 1 if $meta->can('does_role') && $meta->does_role($role_name);
# spent 1.15ms making 3 calls to Moose::Meta::Class::does_role, avg 382µs/call # spent 10µs making 3 calls to UNIVERSAL::can, avg 3µs/call
126 return 0;
127}
128
129sub dump {
130 my $self = shift;
131 require Data::Dumper;
132 local $Data::Dumper::Maxdepth = shift if @_;
133 Data::Dumper::Dumper $self;
134}
135
13613µs1;
137
138# ABSTRACT: The base object for Moose
139
- -
142=pod
143
144=head1 NAME
145
146Moose::Object - The base object for Moose
147
148=head1 VERSION
149
150version 2.0602
151
152=head1 DESCRIPTION
153
154This class is the default base class for all Moose-using classes. When
155you C<use Moose> in this class, your class will inherit from this
156class.
157
158It provides a default constructor and destructor, which run all of the
159C<BUILD> and C<DEMOLISH> methods in the inheritance hierarchy,
160respectively.
161
162You don't actually I<need> to inherit from this in order to use Moose,
163but it makes it easier to take advantage of all of Moose's features.
164
165=head1 METHODS
166
167=over 4
168
169=item B<< Moose::Object->new(%params|$params) >>
170
171This method calls C<< $class->BUILDARGS(@_) >>, and then creates a new
172instance of the appropriate class. Once the instance is created, it
173calls C<< $instance->BUILD($params) >> for each C<BUILD> method in the
174inheritance hierarchy.
175
176=item B<< Moose::Object->BUILDARGS(%params|$params) >>
177
178The default implementation of this method accepts a hash or hash
179reference of named parameters. If it receives a single argument that
180I<isn't> a hash reference it throws an error.
181
182You can override this method in your class to handle other types of
183options passed to the constructor.
184
185This method should always return a hash reference of named options.
186
187=item B<< $object->does($role_name) >>
188
189This returns true if the object does the given role.
190
191=item B<< $object->DOES($class_or_role_name) >>
192
193This is a a Moose role-aware implementation of L<UNIVERSAL/DOES>.
194
195This is effectively the same as writing:
196
197 $object->does($name) || $object->isa($name)
198
199This method will work with Perl 5.8, which did not implement
200C<UNIVERSAL::DOES>.
201
202=item B<< $object->dump($maxdepth) >>
203
204This is a handy utility for C<Data::Dumper>ing an object. By default,
205the maximum depth is 1, to avoid making a mess.
206
207=item B<< $object->DESTROY >>
208
209A default destructor is provided, which calls
210C<< $instance->DEMOLISH($in_global_destruction) >> for each C<DEMOLISH>
211method in the inheritance hierarchy.
212
213=back
214
215=head1 BUGS
216
217See L<Moose/BUGS> for details on reporting bugs.
218
219=head1 AUTHOR
220
221Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
222
223=head1 COPYRIGHT AND LICENSE
224
225This software is copyright (c) 2012 by Infinity Interactive, Inc..
226
227This is free software; you can redistribute it and/or modify it under
228the same terms as the Perl 5 programming language system itself.
229
230=cut
231
232
233__END__