Profile of Class/MOP/Method/Inlined.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:34 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Inlined.pm
Statements | Executed 199 statements in 1.18ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
30 | 1 | 1 | 624µs | 3.56ms | Class::MOP::Method::Inlined::::can_be_inlinedClass::MOP::Method::Inlined::can_be_inlined
1 | 1 | 1 | 9µs | 9µs | Class::MOP::Method::Inlined::::BEGIN@2Class::MOP::Method::Inlined::BEGIN@2
1 | 1 | 1 | 7µs | 10µs | Class::MOP::Method::Inlined::::BEGIN@9Class::MOP::Method::Inlined::BEGIN@9
1 | 1 | 1 | 7µs | 70µs | Class::MOP::Method::Inlined::::BEGIN@15Class::MOP::Method::Inlined::BEGIN@15
1 | 1 | 1 | 6µs | 15µs | Class::MOP::Method::Inlined::::BEGIN@10Class::MOP::Method::Inlined::BEGIN@10
1 | 1 | 1 | 6µs | 34µs | Class::MOP::Method::Inlined::::BEGIN@12Class::MOP::Method::Inlined::BEGIN@12
1 | 1 | 1 | 6µs | 59µs | Class::MOP::Method::Inlined::::BEGIN@13Class::MOP::Method::Inlined::BEGIN@13
0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Inlined::::_uninlined_bodyClass::MOP::Method::Inlined::_uninlined_body

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::Method::Inlined;
2 |  |  |  |  | # spent 9µs within Class::MOP::Method::Inlined::BEGIN@2 which was called: # once (9µs+0s) by base::import at line 4 BEGIN {
3 | 1 | 4µs |  |  | $Class::MOP::Method::Inlined::AUTHORITY = 'cpan:STEVAN';
4 | 1 | 24µs | 1 | 9µs | } # spent 9µs making 1 call to Class::MOP::Method::Inlined::BEGIN@2
5 |  |  |  |  | {
6 | 2 | 1µs |  |  | $Class::MOP::Method::Inlined::VERSION = '2.0602';
7 |  |  |  |  | }
8 |  |  |  |  |
9 | 3 | 20µs | 2 | 12µs | # spent 10µs (7+2) within Class::MOP::Method::Inlined::BEGIN@9 which was called: # once (7µs+2µs) by base::import at line 9 use strict; # spent 10µs making 1 call to Class::MOP::Method::Inlined::BEGIN@9 # spent 2µs making 1 call to strict::import
10 | 3 | 17µs | 2 | 24µs | # spent 15µs (6+9) within Class::MOP::Method::Inlined::BEGIN@10 which was called: # once (6µs+9µs) by base::import at line 10 use warnings; # spent 15µs making 1 call to Class::MOP::Method::Inlined::BEGIN@10 # spent 9µs making 1 call to warnings::import
11 |  |  |  |  |
12 | 3 | 20µs | 2 | 62µs | # spent 34µs (6+28) within Class::MOP::Method::Inlined::BEGIN@12 which was called: # once (6µs+28µs) by base::import at line 12 use Carp 'confess'; # spent 34µs making 1 call to Class::MOP::Method::Inlined::BEGIN@12 # spent 28µs making 1 call to Exporter::import
13 | 3 | 18µs | 2 | 112µs | # spent 59µs (6+53) within Class::MOP::Method::Inlined::BEGIN@13 which was called: # once (6µs+53µs) by base::import at line 13 use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr'; # spent 59µs making 1 call to Class::MOP::Method::Inlined::BEGIN@13 # spent 53µs making 1 call to Exporter::import
14 |  |  |  |  |
15 | 3 | 307µs | 2 | 70µs | # spent 70µs (7+63) within Class::MOP::Method::Inlined::BEGIN@15 which was called: # once (7µs+63µs) by base::import at line 15 use base 'Class::MOP::Method::Generated'; # spent 70µs making 1 call to Class::MOP::Method::Inlined::BEGIN@15 # spent 63µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 63µs
16 |  |  |  |  |
17 |  |  |  |  | sub _uninlined_body {
18 |  |  |  |  | my $self = shift;
19 |  |  |  |  |
20 |  |  |  |  | my $super_method
21 |  |  |  |  | = $self->associated_metaclass->find_next_method_by_name( $self->name )
22 |  |  |  |  | or return;
23 |  |  |  |  |
24 |  |  |  |  | if ( $super_method->isa(__PACKAGE__) ) {
25 |  |  |  |  | return $super_method->_uninlined_body;
26 |  |  |  |  | }
27 |  |  |  |  | else {
28 |  |  |  |  | return $super_method->body;
29 |  |  |  |  | }
30 |  |  |  |  | }
31 |  |  |  |  |
32 |  |  |  |  | # spent 3.56ms (624µs+2.93) within Class::MOP::Method::Inlined::can_be_inlined which was called 30 times, avg 119µs/call: # 30 times (624µs+2.93ms) by Class::MOP::Class::_inline_constructor at line 1451 of Class/MOP/Class.pm, avg 119µs/call sub can_be_inlined {
33 | 180 | 767µs |  |  | my $self = shift;
34 |  |  | 30 | 33µs | my $metaclass = $self->associated_metaclass; # spent 33µs making 30 calls to Class::MOP::Method::Constructor::associated_metaclass, avg 1µs/call
35 |  |  | 30 | 29µs | my $class = $metaclass->name; # spent 29µs making 30 calls to Class::MOP::Package::name, avg 977ns/call
36 |  |  |  |  |
37 |  |  |  |  | # If we don't find an inherited method, this is a rather weird
38 |  |  |  |  | # case where we have no method in the inheritance chain even
39 |  |  |  |  | # though we're expecting one to be there
40 |  |  | 60 | 2.74ms | my $inherited_method # spent 2.71ms making 30 calls to Class::MOP::Class::find_next_method_by_name, avg 90µs/call # spent 33µs making 30 calls to Class::MOP::Method::name, avg 1µs/call
41 |  |  |  |  | = $metaclass->find_next_method_by_name( $self->name );
42 |  |  |  |  |
43 |  |  | 28 | 88µs | if ( $inherited_method # spent 88µs making 28 calls to UNIVERSAL::isa, avg 3µs/call
44 |  |  |  |  | && $inherited_method->isa('Class::MOP::Method::Wrapped') ) {
45 |  |  |  |  | warn "Not inlining '"
46 |  |  |  |  | . $self->name
47 |  |  |  |  | . "' for $class since it "
48 |  |  |  |  | . "has method modifiers which would be lost if it were inlined\n";
49 |  |  |  |  |
50 |  |  |  |  | return 0;
51 |  |  |  |  | }
52 |  |  |  |  |
53 |  |  | 30 | 38µs | my $expected_class = $self->_expected_method_class # spent 38µs making 30 calls to Class::MOP::Method::Inlined::_expected_method_class, avg 1µs/call
54 |  |  |  |  | or return 1;
55 |  |  |  |  |
56 |  |  |  |  | # if we are shadowing a method we first verify that it is
57 |  |  |  |  | # compatible with the definition we are replacing it with
58 |  |  |  |  | my $expected_method = $expected_class->can( $self->name );
59 |  |  |  |  |
60 |  |  |  |  | if ( ! $expected_method ) {
61 |  |  |  |  | warn "Not inlining '"
62 |  |  |  |  | . $self->name
63 |  |  |  |  | . "' for $class since ${expected_class}::"
64 |  |  |  |  | . $self->name
65 |  |  |  |  | . " is not defined\n";
66 |  |  |  |  |
67 |  |  |  |  | return 0;
68 |  |  |  |  | }
69 |  |  |  |  |
70 |  |  |  |  | my $actual_method = $class->can( $self->name )
71 |  |  |  |  | or return 1;
72 |  |  |  |  |
73 |  |  |  |  | # the method is what we wanted (probably Moose::Object::new)
74 |  |  |  |  | return 1
75 |  |  |  |  | if refaddr($expected_method) == refaddr($actual_method);
76 |  |  |  |  |
77 |  |  |  |  | # otherwise we have to check that the actual method is an inlined
78 |  |  |  |  | # version of what we're expecting
79 |  |  |  |  | if ( $inherited_method->isa(__PACKAGE__) ) {
80 |  |  |  |  | if ( $inherited_method->_uninlined_body
81 |  |  |  |  | && refaddr( $inherited_method->_uninlined_body )
82 |  |  |  |  | == refaddr($expected_method) ) {
83 |  |  |  |  | return 1;
84 |  |  |  |  | }
85 |  |  |  |  | }
86 |  |  |  |  | elsif ( refaddr( $inherited_method->body )
87 |  |  |  |  | == refaddr($expected_method) ) {
88 |  |  |  |  | return 1;
89 |  |  |  |  | }
90 |  |  |  |  |
91 |  |  |  |  | my $warning
92 |  |  |  |  | = "Not inlining '"
93 |  |  |  |  | . $self->name
94 |  |  |  |  | . "' for $class since it is not"
95 |  |  |  |  | . " inheriting the default ${expected_class}::"
96 |  |  |  |  | . $self->name . "\n";
97 |  |  |  |  |
98 |  |  |  |  | if ( $self->isa("Class::MOP::Method::Constructor") ) {
99 |  |  |  |  |
100 |  |  |  |  | # FIXME kludge, refactor warning generation to a method
101 |  |  |  |  | $warning
102 |  |  |  |  | .= "If you are certain you don't need to inline your"
103 |  |  |  |  | . " constructor, specify inline_constructor => 0 in your"
104 |  |  |  |  | . " call to $class->meta->make_immutable\n";
105 |  |  |  |  | }
106 |  |  |  |  |
107 |  |  |  |  | warn $warning;
108 |  |  |  |  |
109 |  |  |  |  | return 0;
110 |  |  |  |  | }
111 |  |  |  |  |
112 | 1 | 2µs |  |  | 1;
113 |  |  |  |  |
114 |  |  |  |  | # ABSTRACT: Method base class for methods which have been inlined
115 |  |  |  |  |
- - |  |  |  |  |
118 |  |  |  |  | =pod
119 |  |  |  |  |
120 |  |  |  |  | =head1 NAME
121 |  |  |  |  |
122 |  |  |  |  | Class::MOP::Method::Inlined - Method base class for methods which have been inlined
123 |  |  |  |  |
124 |  |  |  |  | =head1 VERSION
125 |  |  |  |  |
126 |  |  |  |  | version 2.0602
127 |  |  |  |  |
128 |  |  |  |  | =head1 DESCRIPTION
129 |  |  |  |  |
130 |  |  |  |  | This is a L<Class::MOP::Method::Generated> subclass for methods which
131 |  |  |  |  | can be inlined.
132 |  |  |  |  |
133 |  |  |  |  | =head1 METHODS
134 |  |  |  |  |
135 |  |  |  |  | =over 4
136 |  |  |  |  |
137 |  |  |  |  | =item B<< $metamethod->can_be_inlined >>
138 |  |  |  |  |
139 |  |  |  |  | This method returns true if the method in question can be inlined in
140 |  |  |  |  | the associated metaclass.
141 |  |  |  |  |
142 |  |  |  |  | If it cannot be inlined, it spits out a warning and returns false.
143 |  |  |  |  |
144 |  |  |  |  | =back
145 |  |  |  |  |
146 |  |  |  |  | =head1 AUTHOR
147 |  |  |  |  |
148 |  |  |  |  | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
149 |  |  |  |  |
150 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
151 |  |  |  |  |
152 |  |  |  |  | This software is copyright (c) 2012 by Infinity Interactive, Inc..
153 |  |  |  |  |
154 |  |  |  |  | This is free software; you can redistribute it and/or modify it under
155 |  |  |  |  | the same terms as the Perl 5 programming language system itself.
156 |  |  |  |  |
157 |  |  |  |  | =cut
158 |  |  |  |  |
159 |  |  |  |  |
160 |  |  |  |  | __END__