← Index
NYTProf Performance Profile   « line view »
For examples/Atom-timer.pl
  Run on Mon Aug 12 14:45:28 2013
Reported on Mon Aug 12 14:46:14 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Class/MOP/Method/Constructor.pm
StatementsExecuted 896 statements in 2.47ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3122830µs69.3msClass::MOP::Method::Constructor::::_generate_constructor_method_inlineClass::MOP::Method::Constructor::_generate_constructor_method_inline
3011453µs55.3msClass::MOP::Method::Constructor::::newClass::MOP::Method::Constructor::new
3011170µs170µsClass::MOP::Method::Constructor::::_newClass::MOP::Method::Constructor::_new
3011159µs54.6msClass::MOP::Method::Constructor::::_initialize_bodyClass::MOP::Method::Constructor::_initialize_body
3111134µs7.77msClass::MOP::Method::Constructor::::_eval_environmentClass::MOP::Method::Constructor::_eval_environment
11110µs10µsClass::MOP::Method::Constructor::::BEGIN@3Class::MOP::Method::Constructor::BEGIN@3
1117µs756µsClass::MOP::Method::Constructor::::BEGIN@17Class::MOP::Method::Constructor::BEGIN@17
1116µs18µsClass::MOP::Method::Constructor::::BEGIN@10Class::MOP::Method::Constructor::BEGIN@10
1116µs29µsClass::MOP::Method::Constructor::::BEGIN@13Class::MOP::Method::Constructor::BEGIN@13
1116µs30µsClass::MOP::Method::Constructor::::BEGIN@14Class::MOP::Method::Constructor::BEGIN@14
1116µs32µsClass::MOP::Method::Constructor::::BEGIN@15Class::MOP::Method::Constructor::BEGIN@15
1116µs10µsClass::MOP::Method::Constructor::::BEGIN@11Class::MOP::Method::Constructor::BEGIN@11
0000s0sClass::MOP::Method::Constructor::::__ANON__[:111]Class::MOP::Method::Constructor::__ANON__[:111]
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 {
414µs $Class::MOP::Method::Constructor::AUTHORITY = 'cpan:STEVAN';
5130µs110µs}
# spent 10µs making 1 call to Class::MOP::Method::Constructor::BEGIN@3
6{
72900ns $Class::MOP::Method::Constructor::VERSION = '2.1005';
8}
9
10221µs229µs
# spent 18µs (6+12) within Class::MOP::Method::Constructor::BEGIN@10 which was called: # once (6µs+12µs) by Class::MOP::Class::BEGIN@16 at line 10
use strict;
# spent 18µs making 1 call to Class::MOP::Method::Constructor::BEGIN@10 # spent 12µs making 1 call to strict::import
11226µs213µs
# spent 10µs (6+3) within Class::MOP::Method::Constructor::BEGIN@11 which was called: # once (6µs+3µs) by Class::MOP::Class::BEGIN@16 at line 11
use warnings;
# spent 10µs making 1 call to Class::MOP::Method::Constructor::BEGIN@11 # spent 3µs making 1 call to warnings::import
12
13224µs252µs
# spent 29µs (6+23) within Class::MOP::Method::Constructor::BEGIN@13 which was called: # once (6µs+23µs) by Class::MOP::Class::BEGIN@16 at line 13
use Carp 'confess';
# spent 29µs making 1 call to Class::MOP::Method::Constructor::BEGIN@13 # spent 23µs making 1 call to Exporter::import
14221µs253µs
# spent 30µs (6+23) within Class::MOP::Method::Constructor::BEGIN@14 which was called: # once (6µs+23µs) by Class::MOP::Class::BEGIN@16 at line 14
use Scalar::Util 'blessed', 'weaken';
# spent 30µs making 1 call to Class::MOP::Method::Constructor::BEGIN@14 # spent 23µs making 1 call to Exporter::import
15222µs259µs
# spent 32µs (6+26) within Class::MOP::Method::Constructor::BEGIN@15 which was called: # once (6µs+26µs) by Class::MOP::Class::BEGIN@16 at line 15
use Try::Tiny;
# spent 32µs making 1 call to Class::MOP::Method::Constructor::BEGIN@15 # spent 26µs making 1 call to Exporter::import
16
172474µs21.51ms
# spent 756µs (7+750) within Class::MOP::Method::Constructor::BEGIN@17 which was called: # once (7µs+750µs) by Class::MOP::Class::BEGIN@16 at line 17
use base 'Class::MOP::Method::Inlined';
# spent 756µs making 1 call to Class::MOP::Method::Constructor::BEGIN@17 # spent 750µs making 1 call to base::import
18
19
# spent 55.3ms (453µs+54.8) within Class::MOP::Method::Constructor::new which was called 30 times, avg 1.84ms/call: # 30 times (453µs+54.8ms) by Class::MOP::Class::_inline_constructor at line 1438 of Class/MOP/Class.pm, avg 1.84ms/call
sub new {
20304µs my $class = shift;
213045µs my %options = @_;
22
2330131µs6038µs (blessed $options{metaclass} && $options{metaclass}->isa('Class::MOP::Class'))
# spent 20µs making 30 calls to Scalar::Util::blessed, avg 660ns/call # spent 18µs making 30 calls to UNIVERSAL::isa, avg 610ns/call
24 || confess "You must pass a metaclass instance if you want to inline"
25 if $options{is_inline};
26
27307µs ($options{package_name} && $options{name})
28 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
29
303030µs30170µs my $self = $class->_new(\%options);
# spent 170µs making 30 calls to Class::MOP::Method::Constructor::_new, avg 6µs/call
31
32 # we don't want this creating
33 # a cycle in the code, if not
34 # needed
3530153µs3025µs weaken($self->{'associated_metaclass'});
# spent 25µs making 30 calls to Scalar::Util::weaken, avg 843ns/call
36
373023µs3054.6ms $self->_initialize_body;
# spent 54.6ms making 30 calls to Class::MOP::Method::Constructor::_initialize_body, avg 1.82ms/call
38
393062µs return $self;
40}
41
42
# spent 170µs within Class::MOP::Method::Constructor::_new which was called 30 times, avg 6µs/call: # 30 times (170µs+0s) by Class::MOP::Method::Constructor::new at line 30, avg 6µs/call
sub _new {
43304µs my $class = shift;
44
45307µs return Class::MOP::Class->initialize($class)->new_object(@_)
46 if $class ne __PACKAGE__;
47
483010µs my $params = @_ == 1 ? $_[0] : {@_};
49
5030170µs return bless {
51 # inherited from Class::MOP::Method
52 body => $params->{body},
53 # associated_metaclass => $params->{associated_metaclass}, # overridden
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
733160µssub options { (shift)->{'options'} }
7490154µssub associated_metaclass { (shift)->{'associated_metaclass'} }
75
76## method
77
78
# spent 54.6ms (159µs+54.4) within Class::MOP::Method::Constructor::_initialize_body which was called 30 times, avg 1.82ms/call: # 30 times (159µs+54.4ms) by Class::MOP::Method::Constructor::new at line 37, avg 1.82ms/call
sub _initialize_body {
79303µs my $self = shift;
80304µs my $method_name = '_generate_constructor_method';
81
823062µs3014µs $method_name .= '_inline' if $self->is_inline;
# spent 14µs making 30 calls to Class::MOP::Method::Generated::is_inline, avg 470ns/call
83
843085µs3054.4ms $self->{'body'} = $self->$method_name;
# spent 54.4ms making 30 calls to Class::MOP::Method::Constructor::_generate_constructor_method_inline, avg 1.81ms/call
85}
86
87
# spent 7.77ms (134µs+7.63) within Class::MOP::Method::Constructor::_eval_environment which was called 31 times, avg 251µs/call: # 31 times (134µs+7.63ms) by Class::MOP::Method::Generated::_compile_code at line 59 of Class/MOP/Method/Generated.pm, avg 251µs/call
sub _eval_environment {
88314µs my $self = shift;
893178µs627.63ms return $self->associated_metaclass->_eval_environment;
# spent 4.20ms making 30 calls to Class::MOP::Class::_eval_environment, avg 140µs/call # spent 3.40ms making 1 call to Moose::Meta::Class::_eval_environment # spent 26µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 880ns/call # spent 900ns making 1 call to Class::MOP::Method::associated_metaclass
90}
91
92sub _generate_constructor_method {
93 return sub { Class::MOP::Class->initialize(shift)->new_object(@_) }
94}
95
96
# spent 69.3ms (830µs+68.5) within Class::MOP::Method::Constructor::_generate_constructor_method_inline which was called 31 times, avg 2.24ms/call: # 30 times (765µs+53.6ms) by Class::MOP::Method::Constructor::_initialize_body at line 84, avg 1.81ms/call # once (65µs+14.9ms) by Moose::Meta::Method::Constructor::_initialize_body at line 57 of Moose/Meta/Method/Constructor.pm
sub _generate_constructor_method_inline {
97313µs my $self = shift;
98
993122µs3123µs my $meta = $self->associated_metaclass;
# spent 22µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 747ns/call # spent 800ns making 1 call to Class::MOP::Method::associated_metaclass
100
10131170µs3145.2ms my @source = (
# spent 45.2ms making 31 calls to Class::MOP::Class::_inline_new_object, avg 1.46ms/call
102 'sub {',
103 $meta->_inline_new_object,
104 '}',
105 );
106
1073134µs3132µs warn join("\n", @source) if $self->options->{debug};
# spent 32µs making 31 calls to Class::MOP::Method::Constructor::options, avg 1µs/call
108
109 my $code = try {
1103164µs3122.5ms $self->_compile_code(\@source);
# spent 22.5ms making 31 calls to Class::MOP::Method::Generated::_compile_code, avg 727µ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$_";
11531264µs6223.2ms };
# spent 23.1ms making 31 calls to Try::Tiny::try, avg 747µs/call # spent 75µs making 31 calls to Try::Tiny::catch, avg 2µs/call
116
11731193µs return $code;
118}
119
12013µs1;
121
122# ABSTRACT: Method Meta Object for constructors
123
124__END__