Profile of Class/MOP/MiniTrait.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For xt/tapper-mcp-scheduler-with-db-longrun.t
Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:22:44 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/MiniTrait.pm
Statements | Executed 198 statements in 837µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
7 | 7 | 7 | 606µs | 20.5ms | Class::MOP::MiniTrait::::applyClass::MOP::MiniTrait::apply
1 | 1 | 1 | 8µs | 8µs | Class::MOP::MiniTrait::::BEGIN@2Class::MOP::MiniTrait::BEGIN@2
1 | 1 | 1 | 7µs | 31µs | Class::MOP::MiniTrait::::BEGIN@12Class::MOP::MiniTrait::BEGIN@12
1 | 1 | 1 | 7µs | 9µs | Class::MOP::MiniTrait::::BEGIN@9Class::MOP::MiniTrait::BEGIN@9
1 | 1 | 1 | 6µs | 17µs | Class::MOP::MiniTrait::::BEGIN@10Class::MOP::MiniTrait::BEGIN@10

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package 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 {
3 | 1 | 5µs |  |  | $Class::MOP::MiniTrait::AUTHORITY = 'cpan:STEVAN';
4 | 1 | 21µs | 1 | 8µs | } # spent 8µs making 1 call to Class::MOP::MiniTrait::BEGIN@2
5 |  |  |  |  | {
6 | 2 | 900ns |  |  | $Class::MOP::MiniTrait::VERSION = '2.0602';
7 |  |  |  |  | }
8 |  |  |  |  |
9 | 3 | 16µs | 2 | 12µs | # spent 9µs (7+3) within Class::MOP::MiniTrait::BEGIN@9 which was called: # once (7µs+3µs) by Class::MOP::Class::BEGIN@17 at line 9 use strict; # spent 9µs making 1 call to Class::MOP::MiniTrait::BEGIN@9 # spent 3µs making 1 call to strict::import
10 | 3 | 19µs | 2 | 27µs | # spent 17µs (6+10) within Class::MOP::MiniTrait::BEGIN@10 which was called: # once (6µs+10µs) by Class::MOP::Class::BEGIN@17 at line 10 use warnings; # spent 17µs making 1 call to Class::MOP::MiniTrait::BEGIN@10 # spent 10µs making 1 call to warnings::import
11 |  |  |  |  |
12 | 3 | 133µs | 2 | 55µs | # spent 31µs (7+24) within Class::MOP::MiniTrait::BEGIN@12 which was called: # once (7µs+24µs) by Class::MOP::Class::BEGIN@17 at line 12 use Class::Load qw(load_class); # spent 31µs making 1 call to Class::MOP::MiniTrait::BEGIN@12 # spent 24µs making 1 call to Exporter::import
13 |  |  |  |  |
14 |  |  |  |  | # spent 20.5ms (606µs+19.9) within Class::MOP::MiniTrait::apply which was called 7 times, avg 2.93ms/call: # once (244µs+11.0ms) by Class::MOP::Class::_immutable_metaclass at line 1359 of Class/MOP/Class.pm # once (59µs+1.99ms) by base::import at line 16 of Moose/Meta/Method.pm # once (66µs+1.66ms) by Moose::Meta::TypeCoercion::BEGIN@14 at line 29 of Moose/Meta/Attribute.pm # once (62µs+1.62ms) by Moose::BEGIN@28 at line 33 of Moose/Meta/Class.pm # once (55µs+1.27ms) by Moose::BEGIN@32 at line 17 of Moose/Meta/Instance.pm # once (66µs+1.25ms) by Moose::BEGIN@36 at line 31 of Moose/Meta/Role.pm # once (54µs+1.06ms) by Moose::Meta::Class::BEGIN@23 at line 19 of Moose/Error/Default.pm sub apply {
15 | 21 | 109µs |  |  | my ( $to_class, $trait ) = @_;
16 |  |  |  |  |
17 |  |  |  |  | for ( grep { !ref } $to_class, $trait ) {
18 | 26 | 70µs | 13 | 1.89ms | load_class($_); # spent 1.89ms making 13 calls to Class::Load::load_class, avg 146µs/call
19 |  |  | 13 | 2.31ms | $_ = Class::MOP::Class->initialize($_); # spent 2.31ms making 13 calls to Class::MOP::Class::initialize, avg 178µs/call
20 |  |  |  |  | }
21 |  |  |  |  |
22 | 61 | 150µs | 68 | 2.80ms | for my $meth ( grep { $_->package_name ne 'UNIVERSAL' } $trait->get_all_methods ) { # spent 2.77ms making 7 calls to Class::MOP::Class::get_all_methods, avg 396µs/call # spent 31µs making 61 calls to Class::MOP::Method::package_name, avg 503ns/call
23 | 66 | 276µs | 33 | 19µs | my $meth_name = $meth->name; # spent 19µs making 33 calls to Class::MOP::Method::name, avg 582ns/call
24 |  |  |  |  |
25 | 10 | 34µs | 79 | 12.0ms | if ( $to_class->find_method_by_name($meth_name) ) { # spent 6.19ms making 23 calls to Class::MOP::Class::add_around_method_modifier, avg 269µs/call # spent 5.76ms making 33 calls to Class::MOP::Class::find_method_by_name, avg 175µs/call # spent 16µs making 23 calls to Class::MOP::Method::body, avg 683ns/call
26 |  |  |  |  | $to_class->add_around_method_modifier( $meth_name, $meth->body );
27 |  |  |  |  | }
28 |  |  |  |  | else {
29 |  |  | 20 | 892µs | $to_class->add_method( $meth_name, $meth->clone ); # spent 678µs making 10 calls to Class::MOP::Mixin::HasMethods::add_method, avg 68µs/call # spent 214µs making 10 calls to Class::MOP::Method::clone, avg 21µ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.
38 | 1 | 600ns |  |  | require Class::MOP;
39 |  |  |  |  |
40 | 1 | 2µs |  |  | 1;
41 |  |  |  |  |
42 |  |  |  |  | # ABSTRACT: Extremely limited trait application
43 |  |  |  |  |
- - |  |  |  |  |
46 |  |  |  |  | =pod
47 |  |  |  |  |
48 |  |  |  |  | =head1 NAME
49 |  |  |  |  |
50 |  |  |  |  | Class::MOP::MiniTrait - Extremely limited trait application
51 |  |  |  |  |
52 |  |  |  |  | =head1 VERSION
53 |  |  |  |  |
54 |  |  |  |  | version 2.0602
55 |  |  |  |  |
56 |  |  |  |  | =head1 DESCRIPTION
57 |  |  |  |  |
58 |  |  |  |  | This package provides a single function, C<apply>, which does a half-assed job
59 |  |  |  |  | of applying a trait to a class. It exists solely for use inside Class::MOP and
60 |  |  |  |  | L<Moose> core classes.
61 |  |  |  |  |
62 |  |  |  |  | =head1 AUTHOR
63 |  |  |  |  |
64 |  |  |  |  | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
65 |  |  |  |  |
66 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
67 |  |  |  |  |
68 |  |  |  |  | This software is copyright (c) 2012 by Infinity Interactive, Inc..
69 |  |  |  |  |
70 |  |  |  |  | This is free software; you can redistribute it and/or modify it under
71 |  |  |  |  | the same terms as the Perl 5 programming language system itself.
72 |  |  |  |  |
73 |  |  |  |  | =cut
74 |  |  |  |  |
75 |  |  |  |  |
76 |  |  |  |  | __END__