← 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:15 2013

Filename/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Role.pm
StatementsExecuted 708 statements in 1.58ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
12753.35ms3.68msMoose::Role::::aroundMoose::Role::around
1911387µs21.9msMoose::Role::::init_metaMoose::Role::init_meta
38153290µs9.99msMoose::Role::::hasMoose::Role::has
5221112µs2.73msMoose::Role::::superMoose::Role::super
22121288µs204msMoose::Role::::withMoose::Role::with (recurses: max depth 2, inclusive time 38.0ms)
127655µs555µsMoose::Role::::requiresMoose::Role::requires
93128µs219µsMoose::Role::::_add_method_modifierMoose::Role::_add_method_modifier
64225µs213µsMoose::Role::::overrideMoose::Role::override
43217µs141µsMoose::Role::::beforeMoose::Role::before
22210µs68µsMoose::Role::::afterMoose::Role::after
1118µs8µsMoose::Role::::BEGIN@2Moose::Role::BEGIN@2
1116µs27µsMoose::Role::::BEGIN@11Moose::Role::BEGIN@11
1116µs1.11msMoose::Role::::BEGIN@22Moose::Role::BEGIN@22
1116µs23µsMoose::Role::::BEGIN@12Moose::Role::BEGIN@12
1116µs94µsMoose::Role::::BEGIN@15Moose::Role::BEGIN@15
1116µs25µsMoose::Role::::BEGIN@20Moose::Role::BEGIN@20
1116µs16µsMoose::Role::::BEGIN@8Moose::Role::BEGIN@8
1116µs9µsMoose::Role::::BEGIN@9Moose::Role::BEGIN@9
1115µs22µsMoose::Role::::BEGIN@13Moose::Role::BEGIN@13
1114µs4µsMoose::Role::::BEGIN@21Moose::Role::BEGIN@21
1113µs3µsMoose::Role::::BEGIN@17Moose::Role::BEGIN@17
1113µs3µsMoose::Role::::BEGIN@18Moose::Role::BEGIN@18
0000s0sMoose::Role::::augmentMoose::Role::augment
0000s0sMoose::Role::::excludesMoose::Role::excludes
0000s0sMoose::Role::::extendsMoose::Role::extends
0000s0sMoose::Role::::innerMoose::Role::inner
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moose::Role;
2
# spent 8µs within Moose::Role::BEGIN@2 which was called: # once (8µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 4
BEGIN {
314µs $Moose::Role::AUTHORITY = 'cpan:STEVAN';
4128µs18µs}
# spent 8µs making 1 call to Moose::Role::BEGIN@2
5{
62800ns $Moose::Role::VERSION = '2.1005';
7}
8220µs226µs
# spent 16µs (6+10) within Moose::Role::BEGIN@8 which was called: # once (6µs+10µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 8
use strict;
# spent 16µs making 1 call to Moose::Role::BEGIN@8 # spent 10µs making 1 call to strict::import
9224µs212µs
# spent 9µs (6+3) within Moose::Role::BEGIN@9 which was called: # once (6µs+3µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 9
use warnings;
# spent 9µs making 1 call to Moose::Role::BEGIN@9 # spent 3µs making 1 call to warnings::import
10
11222µs247µs
# spent 27µs (6+20) within Moose::Role::BEGIN@11 which was called: # once (6µs+20µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 11
use Scalar::Util 'blessed';
# spent 27µs making 1 call to Moose::Role::BEGIN@11 # spent 20µs making 1 call to Exporter::import
12219µs240µs
# spent 23µs (6+17) within Moose::Role::BEGIN@12 which was called: # once (6µs+17µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 12
use Carp 'croak';
# spent 23µs making 1 call to Moose::Role::BEGIN@12 # spent 17µs making 1 call to Exporter::import
13218µs240µs
# spent 22µs (5+17) within Moose::Role::BEGIN@13 which was called: # once (5µs+17µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 13
use Class::Load 'is_class_loaded';
# spent 22µs making 1 call to Moose::Role::BEGIN@13 # spent 17µs making 1 call to Exporter::import
14
15221µs2182µs
# spent 94µs (6+88) within Moose::Role::BEGIN@15 which was called: # once (6µs+88µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 15
use Sub::Exporter;
# spent 94µs making 1 call to Moose::Role::BEGIN@15 # spent 88µs making 1 call to Sub::Exporter::__ANON__[Sub/Exporter.pm:337]
16
17216µs13µs
# spent 3µs within Moose::Role::BEGIN@17 which was called: # once (3µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 17
use Moose ();
# spent 3µs making 1 call to Moose::Role::BEGIN@17
18221µs13µs
# spent 3µs within Moose::Role::BEGIN@18 which was called: # once (3µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 18
use Moose::Util ();
# spent 3µs making 1 call to Moose::Role::BEGIN@18
19
20218µs245µs
# spent 25µs (6+20) within Moose::Role::BEGIN@20 which was called: # once (6µs+20µs) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 20
use Moose::Exporter;
# spent 25µs making 1 call to Moose::Role::BEGIN@20 # spent 20µs making 1 call to Moose::Exporter::import
21217µs14µs
# spent 4µs within Moose::Role::BEGIN@21 which was called: # once (4µs+0s) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 21
use Moose::Meta::Role;
# spent 4µs making 1 call to Moose::Role::BEGIN@21
222635µs22.21ms
# spent 1.11ms (6µs+1.10) within Moose::Role::BEGIN@22 which was called: # once (6µs+1.10ms) by MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize::BEGIN@9 at line 22
use Moose::Util::TypeConstraints;
# spent 1.11ms making 1 call to Moose::Role::BEGIN@22 # spent 1.10ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:519]
23
24sub extends {
25 croak "Roles do not support 'extends' (you can use 'with' to specialize a role)";
26}
27
28
# spent 204ms (88µs+203) within Moose::Role::with which was called 22 times, avg 9.25ms/call: # 11 times (28µs+82.7ms) by Moose::Role::with at line 409 of Moose/Exporter.pm, avg 7.52ms/call # once (6µs+38.2ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/clear.pm # once (5µs+27.9ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/Writer.pm # once (7µs+10.2ms) by Module::Runtime::require_module at line 11 of Moose/Meta/Attribute/Native/Trait/Array.pm # once (5µs+9.46ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/count.pm # once (5µs+6.74ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/push.pm # once (5µs+6.49ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/set.pm # once (6µs+5.03ms) by Module::Runtime::require_module at line 17 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (5µs+5.02ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Reader.pm # once (5µs+4.96ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/elements.pm # once (6µs+3.65ms) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Array/delete.pm # once (5µs+3.05ms) by Module::Runtime::require_module at line 16 of Moose/Meta/Method/Accessor/Native/Array/get.pm
sub with {
291125µs113.64ms Moose::Util::apply_all_roles( shift, @_ );
# spent 121ms making 11 calls to Moose::Util::apply_all_roles, avg 11.0ms/call, recursion: max depth 3, sum of overlapping time 117ms
30}
31
32
# spent 555µs (55+501) within Moose::Role::requires which was called 12 times, avg 46µs/call: # 6 times (22µs+220µs) by Moose::Role::requires at line 409 of Moose/Exporter.pm, avg 40µs/call # once (8µs+92µs) by Module::Runtime::require_module at line 12 of MooseX/Storage/IO/StorableFile.pm # once (5µs+44µs) by Module::Runtime::require_module at line 19 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (5µs+42µs) by Module::Runtime::require_module at line 17 of Moose/Meta/Attribute/Native/Trait.pm # once (5µs+37µs) by Module::Runtime::require_module at line 16 of Moose/Meta/Method/Accessor/Native/Reader.pm # once (5µs+35µs) by Module::Runtime::require_module at line 14 of Moose/Meta/Method/Accessor/Native/Collection.pm # once (4µs+30µs) by Module::Runtime::require_module at line 13 of MooseX/Storage/IO/StorableFile.pm
sub requires {
3361µs my $meta = shift;
3461µs croak "Must specify at least one method" unless @_;
35615µs6220µs $meta->add_required_methods(@_);
# spent 220µs making 6 calls to Moose::Meta::Role::add_required_methods, avg 37µs/call
36}
37
38sub excludes {
39 my $meta = shift;
40 croak "Must specify at least one role" unless @_;
41 $meta->add_excluded_roles(@_);
42}
43
44
# spent 9.99ms (290µs+9.69) within Moose::Role::has which was called 38 times, avg 263µs/call: # 19 times (205µs+4.69ms) by Moose::Role::has at line 409 of Moose/Exporter.pm, avg 258µs/call # 3 times (13µs+208µs) by Module::Runtime::require_module at line 31 of lib/roles/PhysVecRole.pm, avg 74µs/call # 3 times (12µs+200µs) by Module::Runtime::require_module at line 102 of lib/roles/PhysVecRole.pm, avg 71µs/call # 2 times (8µs+138µs) by Module::Runtime::require_module at line 64 of lib/roles/PhysVecRole.pm, avg 73µs/call # once (9µs+3.76ms) by Module::Runtime::require_module at line 6 of lib/roles/PhysVecRole.pm # once (5µs+80µs) by Module::Runtime::require_module at line 19 of Moose/Meta/Attribute/Native/Trait.pm # once (5µs+78µs) by Module::Runtime::require_module at line 223 of Moose/Meta/Attribute/Native/Trait.pm # once (5µs+73µs) by Module::Runtime::require_module at line 8 of lib/roles/PhysVecRole.pm # once (4µs+73µs) by Module::Runtime::require_module at line 56 of lib/roles/PhysVecRole.pm # once (4µs+71µs) by Module::Runtime::require_module at line 10 of lib/roles/PhysVecRole.pm # once (4µs+66µs) by Module::Runtime::require_module at line 47 of lib/roles/PhysVecRole.pm # once (4µs+66µs) by Module::Runtime::require_module at line 12 of lib/roles/PhysVecRole.pm # once (4µs+64µs) by Module::Runtime::require_module at line 170 of lib/roles/PhysVecRole.pm # once (4µs+64µs) by Module::Runtime::require_module at line 34 of lib/roles/PhysVecRole.pm # once (4µs+63µs) by Module::Runtime::require_module at line 40 of lib/roles/PhysVecRole.pm
sub has {
45192µs my $meta = shift;
46192µs my $name = shift;
47192µs croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1;
481925µs1989µs my %context = Moose::Util::_caller_info;
# spent 89µs making 19 calls to Moose::Util::_caller_info, avg 5µs/call
49199µs $context{context} = 'has declaration';
50194µs $context{type} = 'role';
511925µs my %options = ( definition_context => \%context, @_ );
521912µs my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
531985µs194.60ms $meta->add_attribute( $_, %options ) for @$attrs;
# spent 4.60ms making 19 calls to Moose::Meta::Role::add_attribute, avg 242µs/call
54}
55
56
# spent 219µs (28+190) within Moose::Role::_add_method_modifier which was called 9 times, avg 24µs/call: # 6 times (18µs+122µs) by Moose::Role::around at line 72, avg 23µs/call # 2 times (8µs+46µs) by Moose::Role::before at line 68, avg 27µs/call # once (3µs+22µs) by Moose::Role::after at line 70
sub _add_method_modifier {
5792µs my $type = shift;
5891µs my $meta = shift;
59
6092µs if ( ref($_[0]) eq 'Regexp' ) {
61 croak "Roles do not currently support regex "
62 . " references for $type method modifiers";
63 }
64
65922µs9190µs Moose::Util::add_method_modifier($meta, $type, \@_);
# spent 190µs making 9 calls to Moose::Util::add_method_modifier, avg 21µs/call
66}
67
6825µs254µs
# spent 141µs (17+124) within Moose::Role::before which was called 4 times, avg 35µs/call: # 2 times (6µs+54µs) by Moose::Role::before at line 409 of Moose/Exporter.pm, avg 30µs/call # once (7µs+45µs) by Module::Runtime::require_module at line 55 of Moose/Meta/Attribute/Native/Trait.pm # once (4µs+25µs) by Module::Runtime::require_module at line 122 of Moose/Meta/Attribute/Native/Trait.pm
sub before { _add_method_modifier('before', @_) }
# spent 54µs making 2 calls to Moose::Role::_add_method_modifier, avg 27µs/call
69
7013µs125µs
# spent 68µs (10+58) within Moose::Role::after which was called 2 times, avg 34µs/call: # once (7µs+33µs) by Module::Runtime::require_module at line 87 of Moose/Meta/Attribute/Native/Trait.pm # once (3µs+25µs) by Moose::Role::after at line 409 of Moose/Exporter.pm
sub after { _add_method_modifier('after', @_) }
# spent 25µs making 1 call to Moose::Role::_add_method_modifier
71
72611µs6140µs
# spent 3.68ms (3.35+326µs) within Moose::Role::around which was called 12 times, avg 307µs/call: # 6 times (15µs+140µs) by Moose::Role::around at line 409 of Moose/Exporter.pm, avg 26µs/call # once (3.31ms+31µs) by Module::Runtime::require_module at line 190 of Moose/Meta/Attribute/Native/Trait.pm # once (6µs+40µs) by Module::Runtime::require_module at line 43 of Moose/Meta/Method/Accessor/Native.pm # once (7µs+33µs) by Module::Runtime::require_module at line 155 of Moose/Meta/Attribute/Native/Trait.pm # once (4µs+29µs) by Module::Runtime::require_module at line 166 of Moose/Meta/Method/Accessor/Native/Collection.pm # once (4µs+27µs) by Module::Runtime::require_module at line 132 of Moose/Meta/Method/Accessor/Native/Writer.pm # once (4µs+26µs) by Module::Runtime::require_module at line 142 of Moose/Meta/Method/Accessor/Native/Writer.pm
sub around { _add_method_modifier('around', @_) }
# spent 140µs making 6 calls to Moose::Role::_add_method_modifier, avg 23µs/call
73
74# see Moose.pm for discussion
75
# spent 2.73ms (112µs+2.62) within Moose::Role::super which was called 52 times, avg 53µs/call: # 26 times (54µs+1.80ms) by Moose::Meta::Method::Accessor::Native::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/Method/Accessor/Native.pm:156] at line 139 of Moose/Meta/Method/Accessor/Native.pm, avg 71µs/call # 26 times (58µs+820µs) by Moose::Meta::Method::Accessor::Native::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Meta/Method/Accessor/Native.pm:125] at line 122 of Moose/Meta/Method/Accessor/Native.pm, avg 34µs/call
sub super {
76525µs return unless $Moose::SUPER_BODY;
775298µs522.62ms $Moose::SUPER_BODY->(@Moose::SUPER_ARGS);
# spent 1.80ms making 26 calls to Moose::Meta::Method::Accessor::_eval_environment, avg 69µs/call # spent 820µs making 26 calls to Moose::Meta::Method::Accessor::_get_value, avg 32µs/call
78}
79
80
# spent 213µs (25+188) within Moose::Role::override which was called 6 times, avg 35µs/call: # 3 times (10µs+81µs) by Moose::Role::override at line 409 of Moose/Exporter.pm, avg 30µs/call # once (7µs+50µs) by Module::Runtime::require_module at line 125 of Moose/Meta/Method/Accessor/Native.pm # once (4µs+30µs) by Module::Runtime::require_module at line 134 of Moose/Meta/Method/Accessor/Native.pm # once (4µs+27µs) by Module::Runtime::require_module at line 156 of Moose/Meta/Method/Accessor/Native.pm
sub override {
813400ns my $meta = shift;
8231µs my ( $name, $code ) = @_;
8337µs381µs $meta->add_override_method_modifier( $name, $code );
# spent 81µs making 3 calls to Moose::Meta::Role::add_override_method_modifier, avg 27µs/call
84}
85
86sub inner {
87 croak "Roles cannot support 'inner'";
88}
89
90sub augment {
91 croak "Roles cannot support 'augment'";
92}
93
9415µs1699µsMoose::Exporter->setup_import_methods(
# spent 699µs making 1 call to Moose::Exporter::setup_import_methods
95 with_meta => [
96 qw( with requires excludes has before after around override )
97 ],
98 as_is => [
99 qw( extends super inner augment ),
100 \&Carp::confess,
101 \&Scalar::Util::blessed,
102 ],
103);
104
105
# spent 21.9ms (387µs+21.5) within Moose::Role::init_meta which was called 19 times, avg 1.15ms/call: # 19 times (387µs+21.5ms) by Moose::Exporter::__ANON__[/Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Exporter.pm:519] at line 474 of Moose/Exporter.pm, avg 1.15ms/call
sub init_meta {
10619900ns shift;
1071922µs my %args = @_;
108
109194µs my $role = $args{for_class};
110
11119200ns unless ($role) {
112 require Moose;
113 Moose->throw_error("Cannot call init_meta without specifying a for_class");
114 }
115
116195µs my $metaclass = $args{metaclass} || "Moose::Meta::Role";
117198µs my $meta_name = exists $args{meta_name} ? $args{meta_name} : 'meta';
118
1191968µs1929µs Moose->throw_error("The Metaclass $metaclass must be loaded. (Perhaps you forgot to 'use $metaclass'?)")
# spent 29µs making 19 calls to Class::Load::XS::is_class_loaded, avg 2µs/call
120 unless is_class_loaded($metaclass);
121
1221953µs1917µs Moose->throw_error("The Metaclass $metaclass must be a subclass of Moose::Meta::Role.")
# spent 17µs making 19 calls to UNIVERSAL::isa, avg 889ns/call
123 unless $metaclass->isa('Moose::Meta::Role');
124
125 # make a subtype for each Moose role
1261932µs3810.1ms role_type $role unless find_type_constraint($role);
# spent 9.89ms making 19 calls to Moose::Util::TypeConstraints::role_type, avg 521µs/call # spent 190µs making 19 calls to Moose::Util::TypeConstraints::find_type_constraint, avg 10µs/call
127
128192µs my $meta;
1291922µs1921µs if ( $meta = Class::MOP::get_metaclass_by_name($role) ) {
# spent 21µs making 19 calls to Class::MOP::get_metaclass_by_name, avg 1µs/call
130 unless ( $meta->isa("Moose::Meta::Role") ) {
131 my $error_message = "$role already has a metaclass, but it does not inherit $metaclass ($meta).";
132 if ( $meta->isa('Moose::Meta::Class') ) {
133 Moose->throw_error($error_message . ' You cannot make the same thing a role and a class. Remove either Moose or Moose::Role.');
134 } else {
135 Moose->throw_error($error_message);
136 }
137 }
138 }
139 else {
1401926µs191.59ms $meta = $metaclass->initialize($role);
# spent 1.59ms making 19 calls to Moose::Meta::Role::initialize, avg 83µs/call
141 }
142
143199µs if (defined $meta_name) {
144 # also check for inherited non moose 'meta' method?
1451921µs19660µs my $existing = $meta->get_method($meta_name);
# spent 660µs making 19 calls to Class::MOP::Mixin::HasMethods::get_method, avg 35µs/call
14619200ns if ($existing && !$existing->isa('Class::MOP::Method::Meta')) {
147 Carp::cluck "Moose::Role is overwriting an existing method named "
148 . "$meta_name in role $role with a method "
149 . "which returns the class's metaclass. If this is "
150 . "actually what you want, you should remove the "
151 . "existing method, otherwise, you should rename or "
152 . "disable this generated method using the "
153 . "'-meta_name' option to 'use Moose::Role'.";
154 }
1551923µs199.13ms $meta->_add_meta_method($meta_name);
# spent 9.13ms making 19 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 480µs/call
156 }
157
1581943µs return $meta;
159}
160
16115µs1;
162
163# ABSTRACT: The Moose Role
164
165__END__