| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Method/Meta.pm |
| Statements | Executed 3822 statements in 64.6ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 216 | 2 | 2 | 22.7ms | 378ms | Class::MOP::Method::Meta::wrap |
| 216 | 1 | 1 | 6.29ms | 6.29ms | Class::MOP::Method::Meta::_generate_meta_method |
| 1 | 1 | 1 | 2.87ms | 4.15ms | Class::MOP::Method::Meta::BEGIN@14 |
| 42 | 1 | 1 | 1.63ms | 4.56ms | Class::MOP::Method::Meta::_make_compatible_with |
| 1 | 1 | 1 | 75µs | 92µs | Class::MOP::Method::Meta::BEGIN@4 |
| 1 | 1 | 1 | 52µs | 180µs | Class::MOP::Method::Meta::BEGIN@8 |
| 1 | 1 | 1 | 42µs | 7.41ms | Class::MOP::Method::Meta::BEGIN@16 |
| 1 | 1 | 1 | 36µs | 193µs | Class::MOP::Method::Meta::BEGIN@7 |
| 1 | 1 | 1 | 36µs | 99µs | Class::MOP::Method::Meta::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Meta::__ANON__[:45] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Meta::_is_caller_mop_internal |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Class::MOP::Method::Meta; | ||||
| 3 | |||||
| 4 | 3 | 95µs | 2 | 108µs | # spent 92µs (75+17) within Class::MOP::Method::Meta::BEGIN@4 which was called:
# once (75µs+17µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 4 # spent 92µs making 1 call to Class::MOP::Method::Meta::BEGIN@4
# spent 17µs making 1 call to strict::import |
| 5 | 3 | 132µs | 2 | 162µs | # spent 99µs (36+63) within Class::MOP::Method::Meta::BEGIN@5 which was called:
# once (36µs+63µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 5 # spent 99µs making 1 call to Class::MOP::Method::Meta::BEGIN@5
# spent 63µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 103µs | 2 | 350µs | # spent 193µs (36+157) within Class::MOP::Method::Meta::BEGIN@7 which was called:
# once (36µs+157µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 7 # spent 193µs making 1 call to Class::MOP::Method::Meta::BEGIN@7
# spent 157µs making 1 call to Exporter::import |
| 8 | 3 | 248µs | 2 | 307µs | # spent 180µs (52+127) within Class::MOP::Method::Meta::BEGIN@8 which was called:
# once (52µs+127µs) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 8 # spent 180µs making 1 call to Class::MOP::Method::Meta::BEGIN@8
# spent 127µs making 1 call to Exporter::import |
| 9 | |||||
| 10 | 1 | 5µs | our $VERSION = '1.11'; | ||
| 11 | 1 | 57µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 12 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 13 | |||||
| 14 | 3 | 415µs | 2 | 4.42ms | # spent 4.15ms (2.87+1.28) within Class::MOP::Method::Meta::BEGIN@14 which was called:
# once (2.87ms+1.28ms) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 14 # spent 4.15ms making 1 call to Class::MOP::Method::Meta::BEGIN@14
# spent 270µs making 1 call to constant::import |
| 15 | |||||
| 16 | 3 | 1.02ms | 2 | 7.41ms | # spent 7.41ms (42µs+7.36) within Class::MOP::Method::Meta::BEGIN@16 which was called:
# once (42µs+7.36ms) by Class::MOP::Mixin::HasMethods::BEGIN@6 at line 16 # spent 7.41ms making 1 call to Class::MOP::Method::Meta::BEGIN@16
# spent 7.36ms making 1 call to base::import, recursion: max depth 1, sum of overlapping time 7.36ms |
| 17 | |||||
| 18 | sub _is_caller_mop_internal { | ||||
| 19 | my $self = shift; | ||||
| 20 | my ($caller) = @_; | ||||
| 21 | return $caller =~ /^(?:Class::MOP|metaclass)(?:::|$)/; | ||||
| 22 | } | ||||
| 23 | |||||
| 24 | # spent 6.29ms within Class::MOP::Method::Meta::_generate_meta_method which was called 216 times, avg 29µs/call:
# 216 times (6.29ms+0s) by Class::MOP::Method::Meta::wrap at line 57, avg 29µs/call | ||||
| 25 | 216 | 1.03ms | my $method_self = shift; | ||
| 26 | 216 | 708µs | my $metaclass = shift; | ||
| 27 | sub { | ||||
| 28 | # this will be compiled out if the env var wasn't set | ||||
| 29 | 757 | 1.20ms | if (DEBUG_NO_META) { | ||
| 30 | confess "'meta' method called by MOP internals" | ||||
| 31 | # it's okay to call meta methods on metaclasses, since we | ||||
| 32 | # explicitly ask for them | ||||
| 33 | if !$_[0]->isa('Class::MOP::Object') | ||||
| 34 | && !$_[0]->isa('Class::MOP::Mixin') | ||||
| 35 | # it's okay if the test itself calls ->meta, we only care about | ||||
| 36 | # if the mop internals call ->meta | ||||
| 37 | && $method_self->_is_caller_mop_internal(scalar caller); | ||||
| 38 | } | ||||
| 39 | # we must re-initialize so that it | ||||
| 40 | # works as expected in subclasses, | ||||
| 41 | # since metaclass instances are | ||||
| 42 | # singletons, this is not really a | ||||
| 43 | # big deal anyway. | ||||
| 44 | 757 | 31.3ms | 1514 | 53.5ms | $metaclass->initialize(blessed($_[0]) || $_[0]) # spent 53.7ms making 757 calls to Class::MOP::Class::initialize, avg 71µs/call, recursion: max depth 1, sum of overlapping time 4.60ms
# spent 4.30ms making 757 calls to Scalar::Util::blessed, avg 6µs/call |
| 45 | 216 | 5.04ms | }; | ||
| 46 | } | ||||
| 47 | |||||
| 48 | # spent 378ms (22.7+355) within Class::MOP::Method::Meta::wrap which was called 216 times, avg 1.75ms/call:
# 193 times (20.3ms+322ms) by Moose::Meta::Method::Meta::wrap at line 24 of Moose/Meta/Method/Meta.pm, avg 1.77ms/call
# 23 times (2.44ms+33.1ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 30 of Class/MOP/Mixin/HasMethods.pm, avg 1.55ms/call | ||||
| 49 | 216 | 2.28ms | my ($class, @args) = @_; | ||
| 50 | |||||
| 51 | 216 | 1.05ms | unshift @args, 'body' if @args % 2 == 1; | ||
| 52 | 216 | 1.74ms | my %params = @args; | ||
| 53 | 216 | 606µs | confess "Overriding the body of meta methods is not allowed" | ||
| 54 | if $params{body}; | ||||
| 55 | |||||
| 56 | 216 | 2.82ms | 216 | 18.7ms | my $metaclass_class = $params{associated_metaclass}->meta; # spent 7.56ms making 81 calls to Moose::Meta::Role::meta, avg 93µs/call
# spent 7.32ms making 91 calls to Class::MOP::Object::meta, avg 80µs/call
# spent 3.67ms making 42 calls to MooseX::Role::Parameterized::Meta::Role::Parameterized::meta, avg 87µs/call
# spent 176µs making 2 calls to MooseX::Role::Parameterized::Meta::Role::Parameterizable::meta, avg 88µs/call |
| 57 | 216 | 3.37ms | 216 | 6.29ms | $params{body} = $class->_generate_meta_method($metaclass_class); # spent 6.29ms making 216 calls to Class::MOP::Method::Meta::_generate_meta_method, avg 29µs/call |
| 58 | 216 | 9.85ms | 216 | 330ms | return $class->SUPER::wrap(%params); # spent 330ms making 216 calls to Class::MOP::Method::wrap, avg 1.53ms/call |
| 59 | } | ||||
| 60 | |||||
| 61 | # spent 4.56ms (1.63+2.94) within Class::MOP::Method::Meta::_make_compatible_with which was called 42 times, avg 109µs/call:
# 42 times (1.63ms+2.94ms) by Moose::Meta::Method::Meta::_make_compatible_with at line 29 of Moose/Meta/Method/Meta.pm, avg 109µs/call | ||||
| 62 | 42 | 114µs | my $self = shift; | ||
| 63 | 42 | 159µs | my ($other) = @_; | ||
| 64 | |||||
| 65 | # XXX: this is pretty gross. the issue here is that CMOP::Method::Meta | ||||
| 66 | # objects are subclasses of CMOP::Method, but when we get to moose, they'll | ||||
| 67 | # need to be compatible with Moose::Meta::Method, which isn't possible. the | ||||
| 68 | # right solution here is to make ::Meta into a role that gets applied to | ||||
| 69 | # whatever the method_metaclass happens to be and get rid of | ||||
| 70 | # _meta_method_metaclass entirely, but that's not going to happen until | ||||
| 71 | # we ditch cmop and get roles into the bootstrapping, so. i'm not | ||||
| 72 | # maintaining the previous behavior of turning them into instances of the | ||||
| 73 | # new method_metaclass because that's equally broken, and at least this way | ||||
| 74 | # any issues will at least be detectable and potentially fixable. -doy | ||||
| 75 | 42 | 1.29ms | 84 | 2.94ms | return $self unless $other->_is_compatible_with($self->_real_ref_name); # spent 1.81ms making 42 calls to Class::MOP::Object::_is_compatible_with, avg 43µs/call
# spent 1.13ms making 42 calls to Class::MOP::Object::_real_ref_name, avg 27µs/call |
| 76 | |||||
| 77 | return $self->SUPER::_make_compatible_with(@_); | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | 1 | 11µs | 1; | ||
| 81 | |||||
| 82 | __END__ |