← 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/MiniTrait.pm
StatementsExecuted 283 statements in 857µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
877685µs35.0msClass::MOP::MiniTrait::::applyClass::MOP::MiniTrait::apply
1118µs8µsClass::MOP::MiniTrait::::BEGIN@2Class::MOP::MiniTrait::BEGIN@2
1116µs29µsClass::MOP::MiniTrait::::BEGIN@12Class::MOP::MiniTrait::BEGIN@12
1116µs10µsClass::MOP::MiniTrait::::BEGIN@10Class::MOP::MiniTrait::BEGIN@10
1116µs17µsClass::MOP::MiniTrait::::BEGIN@9Class::MOP::MiniTrait::BEGIN@9
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::MOP::MiniTrait;
2
# spent 8µs within Class::MOP::MiniTrait::BEGIN@2 which was called: # once (8µs+0s) by Class::MOP::Class::BEGIN@17 at line 4
BEGIN {
314µs $Class::MOP::MiniTrait::AUTHORITY = 'cpan:STEVAN';
4128µs18µs}
# spent 8µs making 1 call to Class::MOP::MiniTrait::BEGIN@2
5{
62900ns $Class::MOP::MiniTrait::VERSION = '2.1005';
7}
8
9221µs229µs
# spent 17µs (6+11) within Class::MOP::MiniTrait::BEGIN@9 which was called: # once (6µs+11µs) by Class::MOP::Class::BEGIN@17 at line 9
use strict;
# spent 17µs making 1 call to Class::MOP::MiniTrait::BEGIN@9 # spent 11µs making 1 call to strict::import
10226µs213µs
# spent 10µs (6+3) within Class::MOP::MiniTrait::BEGIN@10 which was called: # once (6µs+3µs) by Class::MOP::Class::BEGIN@17 at line 10
use warnings;
# spent 10µs making 1 call to Class::MOP::MiniTrait::BEGIN@10 # spent 3µs making 1 call to warnings::import
11
122143µs251µs
# spent 29µs (6+22) within Class::MOP::MiniTrait::BEGIN@12 which was called: # once (6µs+22µs) by Class::MOP::Class::BEGIN@17 at line 12
use Class::Load qw(load_class);
# spent 29µs making 1 call to Class::MOP::MiniTrait::BEGIN@12 # spent 22µs making 1 call to Exporter::import
13
14
# spent 35.0ms (685µs+34.3) within Class::MOP::MiniTrait::apply which was called 8 times, avg 4.38ms/call: # 2 times (443µs+20.8ms) by Class::MOP::Class::_immutable_metaclass at line 1359 of Class/MOP/Class.pm, avg 10.6ms/call # once (40µs+5.01ms) by Moose::BEGIN@35 at line 31 of Moose/Meta/Role.pm # once (40µs+4.03ms) by Moose::Meta::Class::BEGIN@23 at line 19 of Moose/Error/Default.pm # once (43µs+1.54ms) by base::import at line 16 of Moose/Meta/Method.pm # once (40µs+1.07ms) by Moose::BEGIN@27 at line 33 of Moose/Meta/Class.pm # once (43µs+1.04ms) by Moose::Meta::TypeCoercion::BEGIN@14 at line 29 of Moose/Meta/Attribute.pm # once (36µs+803µs) by Moose::BEGIN@31 at line 17 of Moose/Meta/Instance.pm
sub apply {
1585µs my ( $to_class, $trait ) = @_;
16
17813µs for ( grep { !ref } $to_class, $trait ) {
181412µs141.67ms load_class($_);
# spent 1.67ms making 14 calls to Class::Load::load_class, avg 119µs/call
191429µs141.62ms $_ = Class::MOP::Class->initialize($_);
# spent 1.62ms making 14 calls to Class::MOP::Class::initialize, avg 116µs/call
20 }
21
2298204µs982.64ms for my $meth ( grep { $_->package_name ne 'UNIVERSAL' } $trait->get_all_methods ) {
# spent 2.61ms making 8 calls to Class::MOP::Class::get_all_methods, avg 326µs/call # spent 33µs making 90 calls to Class::MOP::Method::package_name, avg 362ns/call
2358128µs5839µs my $meth_name = $meth->name;
# spent 39µs making 58 calls to Class::MOP::Method::name, avg 669ns/call
24
2558214µs14627.3ms if ( $to_class->find_method_by_name($meth_name) ) {
# spent 15.5ms making 58 calls to Class::MOP::Class::find_method_by_name, avg 267µs/call # spent 11.8ms making 44 calls to Class::MOP::Class::add_around_method_modifier, avg 269µs/call # spent 27µs making 44 calls to Class::MOP::Method::body, avg 611ns/call
26 $to_class->add_around_method_modifier( $meth_name, $meth->body );
27 }
28 else {
291425µs281.03ms $to_class->add_method( $meth_name, $meth->clone );
# spent 848µs making 14 calls to Class::MOP::Mixin::HasMethods::add_method, avg 61µs/call # spent 180µs making 14 calls to Class::MOP::Method::clone, avg 13µs/call
30 }
31 }
32}
33
34# We can't load this with use, since it may be loaded and used from Class::MOP
35# (via CMOP::Class, etc). However, if for some reason this module is loaded
36# _without_ first loading Class::MOP we need to require Class::MOP so we can
37# use it and CMOP::Class.
381300nsrequire Class::MOP;
39
4013µs1;
41
42# ABSTRACT: Extremely limited trait application
43
44__END__