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

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Constructor.pm
StatementsExecuted 892 statements in 4.39ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
30111.50ms51.0msClass::MOP::Method::Constructor::::_generate_constructor_method_inlineClass::MOP::Method::Constructor::_generate_constructor_method_inline
3011787µs52.9msClass::MOP::Method::Constructor::::newClass::MOP::Method::Constructor::new
3011619µs619µsClass::MOP::Method::Constructor::::_newClass::MOP::Method::Constructor::_new
3011297µs51.3msClass::MOP::Method::Constructor::::_initialize_bodyClass::MOP::Method::Constructor::_initialize_body
3011197µs5.67msClass::MOP::Method::Constructor::::_eval_environmentClass::MOP::Method::Constructor::_eval_environment
3011145µs18.8msClass::MOP::Method::Constructor::::__ANON__[:111]Class::MOP::Method::Constructor::__ANON__[:111]
11120µs46µsClass::MOP::Method::Constructor::::BEGIN@11Class::MOP::Method::Constructor::BEGIN@11
11112µs730µsClass::MOP::Method::Constructor::::BEGIN@17Class::MOP::Method::Constructor::BEGIN@17
11110µs10µsClass::MOP::Method::Constructor::::BEGIN@3Class::MOP::Method::Constructor::BEGIN@3
1119µs39µsClass::MOP::Method::Constructor::::BEGIN@14Class::MOP::Method::Constructor::BEGIN@14
1119µs62µsClass::MOP::Method::Constructor::::BEGIN@13Class::MOP::Method::Constructor::BEGIN@13
1119µs17µsClass::MOP::Method::Constructor::::BEGIN@10Class::MOP::Method::Constructor::BEGIN@10
1118µs41µsClass::MOP::Method::Constructor::::BEGIN@15Class::MOP::Method::Constructor::BEGIN@15
0000s0sClass::MOP::Method::Constructor::::__ANON__[:115]Class::MOP::Method::Constructor::__ANON__[:115]
0000s0sClass::MOP::Method::Constructor::::__ANON__[:93]Class::MOP::Method::Constructor::__ANON__[:93]
0000s0sClass::MOP::Method::Constructor::::_generate_constructor_methodClass::MOP::Method::Constructor::_generate_constructor_method
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Class::MOP::Method::Constructor;
3
# spent 10µs within Class::MOP::Method::Constructor::BEGIN@3 which was called: # once (10µs+0s) by Class::MOP::Class::BEGIN@16 at line 5
BEGIN {
415µs $Class::MOP::Method::Constructor::AUTHORITY = 'cpan:STEVAN';
5124µs110µs}
# spent 10µs making 1 call to Class::MOP::Method::Constructor::BEGIN@3
6{
721µs $Class::MOP::Method::Constructor::VERSION = '2.0602';
8}
9
10320µs225µs
# spent 17µs (9+8) within Class::MOP::Method::Constructor::BEGIN@10 which was called: # once (9µs+8µs) by Class::MOP::Class::BEGIN@16 at line 10
use strict;
# spent 17µs making 1 call to Class::MOP::Method::Constructor::BEGIN@10 # spent 8µs making 1 call to strict::import
11396µs271µs
# spent 46µs (20+26) within Class::MOP::Method::Constructor::BEGIN@11 which was called: # once (20µs+26µs) by Class::MOP::Class::BEGIN@16 at line 11
use warnings;
# spent 46µs making 1 call to Class::MOP::Method::Constructor::BEGIN@11 # spent 26µs making 1 call to warnings::import
12
13324µs2115µs
# spent 62µs (9+53) within Class::MOP::Method::Constructor::BEGIN@13 which was called: # once (9µs+53µs) by Class::MOP::Class::BEGIN@16 at line 13
use Carp 'confess';
# spent 62µs making 1 call to Class::MOP::Method::Constructor::BEGIN@13 # spent 53µs making 1 call to Exporter::import
14320µs268µs
# spent 39µs (9+30) within Class::MOP::Method::Constructor::BEGIN@14 which was called: # once (9µs+30µs) by Class::MOP::Class::BEGIN@16 at line 14
use Scalar::Util 'blessed', 'weaken';
# spent 39µs making 1 call to Class::MOP::Method::Constructor::BEGIN@14 # spent 30µs making 1 call to Exporter::import
15324µs274µs
# spent 41µs (8+33) within Class::MOP::Method::Constructor::BEGIN@15 which was called: # once (8µs+33µs) by Class::MOP::Class::BEGIN@16 at line 15
use Try::Tiny;
# spent 41µs making 1 call to Class::MOP::Method::Constructor::BEGIN@15 # spent 33µs making 1 call to Exporter::import
16
173412µs21.45ms
# spent 730µs (12+717) within Class::MOP::Method::Constructor::BEGIN@17 which was called: # once (12µs+717µs) by Class::MOP::Class::BEGIN@16 at line 17
use base 'Class::MOP::Method::Inlined';
# spent 730µs making 1 call to Class::MOP::Method::Constructor::BEGIN@17 # spent 717µs making 1 call to base::import
18
19
# spent 52.9ms (787µs+52.1) within Class::MOP::Method::Constructor::new which was called 30 times, avg 1.76ms/call: # 30 times (787µs+52.1ms) by Class::MOP::Class::_inline_constructor at line 1438 of Class/MOP/Class.pm, avg 1.76ms/call
sub new {
203029µs my $class = shift;
2130140µs my %options = @_;
22
2330240µs6067µs (blessed $options{metaclass} && $options{metaclass}->isa('Class::MOP::Class'))
# spent 37µs making 30 calls to UNIVERSAL::isa, avg 1µs/call # spent 31µs making 30 calls to Scalar::Util::blessed, avg 1µs/call
24 || confess "You must pass a metaclass instance if you want to inline"
25 if $options{is_inline};
26
273024µs ($options{package_name} && $options{name})
28 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
29
303086µs30619µs my $self = $class->_new(\%options);
# spent 619µs making 30 calls to Class::MOP::Method::Constructor::_new, avg 21µs/call
31
32 # we don't want this creating
33 # a cycle in the code, if not
34 # needed
353097µs3029µs weaken($self->{'associated_metaclass'});
# spent 29µs making 30 calls to Scalar::Util::weaken, avg 980ns/call
36
373086µs3051.3ms $self->_initialize_body;
# spent 51.3ms making 30 calls to Class::MOP::Method::Constructor::_initialize_body, avg 1.71ms/call
38
3930134µs return $self;
40}
41
42
# spent 619µs within Class::MOP::Method::Constructor::_new which was called 30 times, avg 21µs/call: # 30 times (619µs+0s) by Class::MOP::Method::Constructor::new at line 30, avg 21µs/call
sub _new {
433015µs my $class = shift;
44
453018µs return Class::MOP::Class->initialize($class)->new_object(@_)
46 if $class ne __PACKAGE__;
47
483032µs my $params = @_ == 1 ? $_[0] : {@_};
49
5030590µs return bless {
51 # inherited from Class::MOP::Method
52 body => $params->{body},
53 # associated_metaclass => $params->{associated_metaclass}, # overriden
54 package_name => $params->{package_name},
55 name => $params->{name},
56 original_method => $params->{original_method},
57
58 # inherited from Class::MOP::Generated
59 is_inline => $params->{is_inline} || 0,
60 definition_context => $params->{definition_context},
61
62 # inherited from Class::MOP::Inlined
63 _expected_method_class => $params->{_expected_method_class},
64
65 # defined in this subclass
66 options => $params->{options} || {},
67 associated_metaclass => $params->{metaclass},
68 }, $class;
69}
70
71## accessors
72
733089µssub options { (shift)->{'options'} }
7490210µssub associated_metaclass { (shift)->{'associated_metaclass'} }
75
76## method
77
78
# spent 51.3ms (297µs+51.1) within Class::MOP::Method::Constructor::_initialize_body which was called 30 times, avg 1.71ms/call: # 30 times (297µs+51.1ms) by Class::MOP::Method::Constructor::new at line 37, avg 1.71ms/call
sub _initialize_body {
793015µs my $self = shift;
803017µs my $method_name = '_generate_constructor_method';
81
8230104µs3027µs $method_name .= '_inline' if $self->is_inline;
# spent 27µs making 30 calls to Class::MOP::Method::Generated::is_inline, avg 883ns/call
83
8430186µs3051.0ms $self->{'body'} = $self->$method_name;
# spent 51.0ms making 30 calls to Class::MOP::Method::Constructor::_generate_constructor_method_inline, avg 1.70ms/call
85}
86
87
# spent 5.67ms (197µs+5.47) within Class::MOP::Method::Constructor::_eval_environment which was called 30 times, avg 189µs/call: # 30 times (197µs+5.47ms) by Class::MOP::Method::Generated::_compile_code at line 59 of Class/MOP/Method/Generated.pm, avg 189µs/call
sub _eval_environment {
883012µs my $self = shift;
8930137µs605.47ms return $self->associated_metaclass->_eval_environment;
# spent 5.44ms making 30 calls to Class::MOP::Class::_eval_environment, avg 181µs/call # spent 31µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 1µs/call
90}
91
92sub _generate_constructor_method {
93 return sub { Class::MOP::Class->initialize(shift)->new_object(@_) }
94}
95
96
# spent 51.0ms (1.50+49.5) within Class::MOP::Method::Constructor::_generate_constructor_method_inline which was called 30 times, avg 1.70ms/call: # 30 times (1.50ms+49.5ms) by Class::MOP::Method::Constructor::_initialize_body at line 84, avg 1.70ms/call
sub _generate_constructor_method_inline {
973011µs my $self = shift;
98
993049µs3037µs my $meta = $self->associated_metaclass;
# spent 37µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 1µs/call
100
10130719µs3029.9ms my @source = (
# spent 29.9ms making 30 calls to Class::MOP::Class::_inline_new_object, avg 998µs/call
102 'sub {',
103 $meta->_inline_new_object,
104 '}',
105 );
106
1073075µs3055µs warn join("\n", @source) if $self->options->{debug};
# spent 55µs making 30 calls to Class::MOP::Method::Constructor::options, avg 2µs/call
108
109
# spent 18.8ms (145µs+18.7) within Class::MOP::Method::Constructor::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Constructor.pm:111] which was called 30 times, avg 627µs/call: # 30 times (145µs+18.7ms) by Try::Tiny::try at line 71 of Try/Tiny.pm, avg 627µs/call
my $code = try {
11030134µs3018.7ms $self->_compile_code(\@source);
# spent 18.7ms making 30 calls to Class::MOP::Method::Generated::_compile_code, avg 622µs/call
111 }
112 catch {
113 my $source = join("\n", @source);
114 confess "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$_";
11530356µs6019.5ms };
# spent 19.4ms making 30 calls to Try::Tiny::try, avg 645µs/call # spent 140µs making 30 calls to Try::Tiny::catch, avg 5µs/call
116
11730157µs return $code;
118}
119
12013µs1;
121
122# ABSTRACT: Method Meta Object for constructors
123
- -
126=pod
127
128=head1 NAME
129
130Class::MOP::Method::Constructor - Method Meta Object for constructors
131
132=head1 VERSION
133
134version 2.0602
135
136=head1 SYNOPSIS
137
138 use Class::MOP::Method::Constructor;
139
140 my $constructor = Class::MOP::Method::Constructor->new(
141 metaclass => $metaclass,
142 options => {
143 debug => 1, # this is all for now
144 },
145 );
146
147 # calling the constructor ...
148 $constructor->body->execute($metaclass->name, %params);
149
150=head1 DESCRIPTION
151
152This is a subclass of C<Class::MOP::Method> which generates
153constructor methods.
154
155=head1 METHODS
156
157=over 4
158
159=item B<< Class::MOP::Method::Constructor->new(%options) >>
160
161This creates a new constructor object. It accepts a hash reference of
162options.
163
164=over 8
165
166=item * metaclass
167
168This should be a L<Class::MOP::Class> object. It is required.
169
170=item * name
171
172The method name (without a package name). This is required.
173
174=item * package_name
175
176The package name for the method. This is required.
177
178=item * is_inline
179
180This indicates whether or not the constructor should be inlined. This
181defaults to false.
182
183=back
184
185=item B<< $metamethod->is_inline >>
186
187Returns a boolean indicating whether or not the constructor is
188inlined.
189
190=item B<< $metamethod->associated_metaclass >>
191
192This returns the L<Class::MOP::Class> object for the method.
193
194=back
195
196=head1 AUTHOR
197
198Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
199
200=head1 COPYRIGHT AND LICENSE
201
202This software is copyright (c) 2012 by Infinity Interactive, Inc..
203
204This is free software; you can redistribute it and/or modify it under
205the same terms as the Perl 5 programming language system itself.
206
207=cut
208
209
210__END__