| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/MiniTrait.pm |
| Statements | Executed 185 statements in 5.24ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 8 | 7 | 7 | 4.28ms | 256ms | Class::MOP::MiniTrait::apply |
| 1 | 1 | 1 | 215µs | 238µs | Class::MOP::MiniTrait::BEGIN@3 |
| 1 | 1 | 1 | 38µs | 109µs | Class::MOP::MiniTrait::BEGIN@4 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Class::MOP::MiniTrait; | ||||
| 2 | |||||
| 3 | 3 | 117µs | 2 | 260µs | # spent 238µs (215+22) within Class::MOP::MiniTrait::BEGIN@3 which was called:
# once (215µs+22µs) by Class::MOP::Class::BEGIN@11 at line 3 # spent 238µs making 1 call to Class::MOP::MiniTrait::BEGIN@3
# spent 22µs making 1 call to strict::import |
| 4 | 3 | 584µs | 2 | 181µs | # spent 109µs (38+72) within Class::MOP::MiniTrait::BEGIN@4 which was called:
# once (38µs+72µs) by Class::MOP::Class::BEGIN@11 at line 4 # spent 109µs making 1 call to Class::MOP::MiniTrait::BEGIN@4
# spent 71µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 4µs | our $VERSION = '1.11'; | ||
| 7 | 1 | 58µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 8 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | # spent 256ms (4.28+252) within Class::MOP::MiniTrait::apply which was called 8 times, avg 32.0ms/call:
# 2 times (2.86ms+192ms) by Class::MOP::Class::_immutable_metaclass at line 1251 of Class/MOP/Class.pm, avg 97.3ms/call
# once (256µs+12.5ms) by Moose::BEGIN@19 at line 31 of Moose/Meta/Class.pm
# once (234µs+11.9ms) by base::import at line 14 of Moose/Meta/Method.pm
# once (232µs+11.1ms) by Moose::Meta::TypeCoercion::BEGIN@8 at line 25 of Moose/Meta/Attribute.pm
# once (231µs+8.66ms) by Moose::BEGIN@23 at line 15 of Moose/Meta/Instance.pm
# once (232µs+8.58ms) by Moose::BEGIN@27 at line 29 of Moose/Meta/Role.pm
# once (228µs+7.36ms) by Moose::Meta::Class::BEGIN@21 at line 15 of Moose/Error/Default.pm | ||||
| 11 | 174 | 4.46ms | my ( $to_class, $trait ) = @_; | ||
| 12 | |||||
| 13 | for ( grep { !ref } $to_class, $trait ) { | ||||
| 14 | 14 | 4.41ms | Class::MOP::load_class($_); # spent 9.01ms making 14 calls to Class::MOP::load_class, avg 643µs/call, recursion: max depth 1, sum of overlapping time 4.59ms | ||
| 15 | 14 | 15.4ms | $_ = Class::MOP::Class->initialize($_); # spent 15.4ms making 14 calls to Class::MOP::Class::initialize, avg 1.10ms/call | ||
| 16 | } | ||||
| 17 | |||||
| 18 | 8 | 27.4ms | for my $meth ( $trait->get_all_methods ) { # spent 27.4ms making 8 calls to Class::MOP::Class::get_all_methods, avg 3.43ms/call | ||
| 19 | 56 | 348µs | my $meth_name = $meth->name; # spent 348µs making 56 calls to Class::MOP::Method::name, avg 6µs/call | ||
| 20 | |||||
| 21 | 148 | 193ms | if ( $to_class->find_method_by_name($meth_name) ) { # spent 103ms making 46 calls to Class::MOP::Class::add_around_method_modifier, avg 2.24ms/call
# spent 90.2ms making 56 calls to Class::MOP::Class::find_method_by_name, avg 1.61ms/call
# spent 263µs making 46 calls to Class::MOP::Method::body, avg 6µs/call | ||
| 22 | $to_class->add_around_method_modifier( $meth_name, $meth->body ); | ||||
| 23 | } | ||||
| 24 | else { | ||||
| 25 | 20 | 6.20ms | $to_class->add_method( $meth_name, $meth->clone ); # spent 5.22ms making 10 calls to Class::MOP::Mixin::HasMethods::add_method, avg 522µs/call
# spent 977µs making 10 calls to Class::MOP::Method::clone, avg 98µs/call | ||
| 26 | } | ||||
| 27 | } | ||||
| 28 | } | ||||
| 29 | |||||
| 30 | # We can't load this with use, since it may be loaded and used from Class::MOP | ||||
| 31 | # (via CMOP::Class, etc). However, if for some reason this module is loaded | ||||
| 32 | # _without_ first loading Class::MOP we need to require Class::MOP so we can | ||||
| 33 | # use it and CMOP::Class. | ||||
| 34 | 1 | 3µs | require Class::MOP; | ||
| 35 | |||||
| 36 | 1 | 12µs | 1; | ||
| 37 | |||||
| 38 | __END__ |