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

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

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 999µs | 1.31ms | Class::MOP::Method::Meta::::BEGIN@16Class::MOP::Method::Meta::BEGIN@16
35 | 2 | 2 | 832µs | 12.7ms | Class::MOP::Method::Meta::::wrapClass::MOP::Method::Meta::wrap
35 | 1 | 1 | 315µs | 366µs | Class::MOP::Method::Meta::::_generate_meta_methodClass::MOP::Method::Meta::_generate_meta_method
1 | 1 | 1 | 8µs | 1.53ms | Class::MOP::Method::Meta::::BEGIN@18Class::MOP::Method::Meta::BEGIN@18
1 | 1 | 1 | 7µs | 7µs | Class::MOP::Method::Meta::::BEGIN@3Class::MOP::Method::Meta::BEGIN@3
1 | 1 | 1 | 7µs | 14µs | Class::MOP::Method::Meta::::BEGIN@11Class::MOP::Method::Meta::BEGIN@11
1 | 1 | 1 | 7µs | 9µs | Class::MOP::Method::Meta::::BEGIN@10Class::MOP::Method::Meta::BEGIN@10
1 | 1 | 1 | 7µs | 31µs | Class::MOP::Method::Meta::::BEGIN@14Class::MOP::Method::Meta::BEGIN@14
1 | 1 | 1 | 6µs | 28µs | Class::MOP::Method::Meta::::BEGIN@13Class::MOP::Method::Meta::BEGIN@13
0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Meta::::__ANON__[:49]Class::MOP::Method::Meta::__ANON__[:49]
0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Meta::::_is_caller_mop_internalClass::MOP::Method::Meta::_is_caller_mop_internal
0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Meta::::_make_compatible_withClass::MOP::Method::Meta::_make_compatible_with

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  |
2 |  |  |  |  | package Class::MOP::Method::Meta;
3 |  |  |  |  | # spent 7µs within Class::MOP::Method::Meta::BEGIN@3 which was called: # once (7µs+0s) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 5 BEGIN {
4 | 1 | 4µs |  |  | $Class::MOP::Method::Meta::AUTHORITY = 'cpan:STEVAN';
5 | 1 | 26µs | 1 | 7µs | } # spent 7µs making 1 call to Class::MOP::Method::Meta::BEGIN@3
6 |  |  |  |  | {
7 | 2 | 1µs |  |  | $Class::MOP::Method::Meta::VERSION = '2.0602';
8 |  |  |  |  | }
9 |  |  |  |  |
10 | 3 | 16µs | 2 | 11µs | # spent 9µs (7+2) within Class::MOP::Method::Meta::BEGIN@10 which was called: # once (7µs+2µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 10 use strict; # spent 9µs making 1 call to Class::MOP::Method::Meta::BEGIN@10 # spent 2µs making 1 call to strict::import
11 | 3 | 18µs | 2 | 21µs | # spent 14µs (7+7) within Class::MOP::Method::Meta::BEGIN@11 which was called: # once (7µs+7µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 11 use warnings; # spent 14µs making 1 call to Class::MOP::Method::Meta::BEGIN@11 # spent 7µs making 1 call to warnings::import
12 |  |  |  |  |
13 | 3 | 55µs | 2 | 50µs | # spent 28µs (6+22) within Class::MOP::Method::Meta::BEGIN@13 which was called: # once (6µs+22µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 13 use Carp 'confess'; # spent 28µs making 1 call to Class::MOP::Method::Meta::BEGIN@13 # spent 22µs making 1 call to Exporter::import
14 | 3 | 24µs | 2 | 55µs | # spent 31µs (7+24) within Class::MOP::Method::Meta::BEGIN@14 which was called: # once (7µs+24µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 14 use Scalar::Util 'blessed', 'weaken'; # spent 31µs making 1 call to Class::MOP::Method::Meta::BEGIN@14 # spent 24µs making 1 call to Exporter::import
15 |  |  |  |  |
16 | 3 | 97µs | 2 | 1.36ms | # spent 1.31ms (999µs+310µs) within Class::MOP::Method::Meta::BEGIN@16 which was called: # once (999µs+310µs) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 16 use constant DEBUG_NO_META => $ENV{DEBUG_NO_META} ? 1 : 0; # spent 1.31ms making 1 call to Class::MOP::Method::Meta::BEGIN@16 # spent 50µs making 1 call to constant::import
17 |  |  |  |  |
18 | 3 | 368µs | 2 | 3.06ms | # spent 1.53ms (8µs+1.52) within Class::MOP::Method::Meta::BEGIN@18 which was called: # once (8µs+1.52ms) by Class::MOP::Mixin::HasMethods::BEGIN@12 at line 18 use base 'Class::MOP::Method'; # spent 1.53ms making 1 call to Class::MOP::Method::Meta::BEGIN@18 # spent 1.52ms making 1 call to base::import
19 |  |  |  |  |
20 |  |  |  |  | sub _is_caller_mop_internal {
21 |  |  |  |  | my $self = shift;
22 |  |  |  |  | my ($caller) = @_;
23 |  |  |  |  | return $caller =~ /^(?:Class::MOP|metaclass)(?:::|$)/;
24 |  |  |  |  | }
25 |  |  |  |  |
26 |  |  |  |  | # spent 366µs (315+51) within Class::MOP::Method::Meta::_generate_meta_method which was called 35 times, avg 10µs/call: # 35 times (315µs+51µs) by Class::MOP::Method::Meta::wrap at line 61, avg 10µs/call sub _generate_meta_method {
27 | 140 | 383µs |  |  | my $method_self = shift;
28 |  |  |  |  | my $metaclass = shift;
29 |  |  | 35 | 51µs | weaken($metaclass); # spent 51µs making 35 calls to Scalar::Util::weaken, avg 1µs/call
30 |  |  |  |  |
31 |  |  |  |  | sub {
32 |  |  |  |  | # this will be compiled out if the env var wasn't set
33 | 448 | 1.72ms |  |  | if (DEBUG_NO_META) {
34 |  |  |  |  | confess "'meta' method called by MOP internals"
35 |  |  |  |  | # it's okay to call meta methods on metaclasses, since we
36 |  |  |  |  | # explicitly ask for them
37 |  |  |  |  | if !$_[0]->isa('Class::MOP::Object')
38 |  |  |  |  | && !$_[0]->isa('Class::MOP::Mixin')
39 |  |  |  |  | # it's okay if the test itself calls ->meta, we only care about
40 |  |  |  |  | # if the mop internals call ->meta
41 |  |  |  |  | && $method_self->_is_caller_mop_internal(scalar caller);
42 |  |  |  |  | }
43 |  |  |  |  | # we must re-initialize so that it
44 |  |  |  |  | # works as expected in subclasses,
45 |  |  |  |  | # since metaclass instances are
46 |  |  |  |  | # singletons, this is not really a
47 |  |  |  |  | # big deal anyway.
48 |  |  | 448 | 5.50ms | $metaclass->initialize(blessed($_[0]) || $_[0]) # spent 5.39ms making 224 calls to Class::MOP::Class::initialize, avg 24µs/call, recursion: max depth 1, sum of overlapping time 75µs # spent 180µs making 224 calls to Scalar::Util::blessed, avg 803ns/call
49 |  |  |  |  | };
50 |  |  |  |  | }
51 |  |  |  |  |
52 |  |  |  |  | # spent 12.7ms (832µs+11.9) within Class::MOP::Method::Meta::wrap which was called 35 times, avg 364µs/call: # 22 times (483µs+5.76ms) by Class::MOP::Mixin::HasMethods::_add_meta_method at line 33 of Class/MOP/Mixin/HasMethods.pm, avg 284µs/call # 13 times (349µs+6.15ms) by Moose::Meta::Method::Meta::wrap at line 26 of Moose/Meta/Method/Meta.pm, avg 500µs/call sub wrap {
53 | 245 | 773µs |  |  | my ($class, @args) = @_;
54 |  |  |  |  |
55 |  |  |  |  | unshift @args, 'body' if @args % 2 == 1;
56 |  |  |  |  | my %params = @args;
57 |  |  |  |  | confess "Overriding the body of meta methods is not allowed"
58 |  |  |  |  | if $params{body};
59 |  |  |  |  |
60 |  |  | 35 | 482µs | my $metaclass_class = $params{associated_metaclass}->meta; # spent 397µs making 31 calls to Class::MOP::Object::meta, avg 13µs/call # spent 84µs making 4 calls to Moose::Meta::Role::meta, avg 21µs/call
61 |  |  | 35 | 366µs | $params{body} = $class->_generate_meta_method($metaclass_class); # spent 366µs making 35 calls to Class::MOP::Method::Meta::_generate_meta_method, avg 10µs/call
62 |  |  | 35 | 11.1ms | return $class->SUPER::wrap(%params); # spent 11.1ms making 35 calls to Class::MOP::Method::wrap, avg 316µs/call
63 |  |  |  |  | }
64 |  |  |  |  |
65 |  |  |  |  | sub _make_compatible_with {
66 |  |  |  |  | my $self = shift;
67 |  |  |  |  | my ($other) = @_;
68 |  |  |  |  |
69 |  |  |  |  | # XXX: this is pretty gross. the issue here is that CMOP::Method::Meta
70 |  |  |  |  | # objects are subclasses of CMOP::Method, but when we get to moose, they'll
71 |  |  |  |  | # need to be compatible with Moose::Meta::Method, which isn't possible. the
72 |  |  |  |  | # right solution here is to make ::Meta into a role that gets applied to
73 |  |  |  |  | # whatever the method_metaclass happens to be and get rid of
74 |  |  |  |  | # _meta_method_metaclass entirely, but that's not going to happen until
75 |  |  |  |  | # we ditch cmop and get roles into the bootstrapping, so. i'm not
76 |  |  |  |  | # maintaining the previous behavior of turning them into instances of the
77 |  |  |  |  | # new method_metaclass because that's equally broken, and at least this way
78 |  |  |  |  | # any issues will at least be detectable and potentially fixable. -doy
79 |  |  |  |  | return $self unless $other->_is_compatible_with($self->_real_ref_name);
80 |  |  |  |  |
81 |  |  |  |  | return $self->SUPER::_make_compatible_with(@_);
82 |  |  |  |  | }
83 |  |  |  |  |
84 | 1 | 3µs |  |  | 1;
85 |  |  |  |  |
86 |  |  |  |  | # ABSTRACT: Method Meta Object for C<meta> methods
87 |  |  |  |  |
- - |  |  |  |  |
90 |  |  |  |  | =pod
91 |  |  |  |  |
92 |  |  |  |  | =head1 NAME
93 |  |  |  |  |
94 |  |  |  |  | Class::MOP::Method::Meta - Method Meta Object for C<meta> methods
95 |  |  |  |  |
96 |  |  |  |  | =head1 VERSION
97 |  |  |  |  |
98 |  |  |  |  | version 2.0602
99 |  |  |  |  |
100 |  |  |  |  | =head1 DESCRIPTION
101 |  |  |  |  |
102 |  |  |  |  | This is a L<Class::MOP::Method> subclass which represents C<meta>
103 |  |  |  |  | methods installed into classes by Class::MOP.
104 |  |  |  |  |
105 |  |  |  |  | =head1 METHODS
106 |  |  |  |  |
107 |  |  |  |  | =over 4
108 |  |  |  |  |
109 |  |  |  |  | =item B<< Class::MOP::Method::Wrapped->wrap($metamethod, %options) >>
110 |  |  |  |  |
111 |  |  |  |  | This is the constructor. It accepts a L<Class::MOP::Method> object and
112 |  |  |  |  | a hash of options. The options accepted are identical to the ones
113 |  |  |  |  | accepted by L<Class::MOP::Method>, except that C<body> cannot be passed
114 |  |  |  |  | (it will be generated automatically).
115 |  |  |  |  |
116 |  |  |  |  | =back
117 |  |  |  |  |
118 |  |  |  |  | =head1 AUTHOR
119 |  |  |  |  |
120 |  |  |  |  | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
121 |  |  |  |  |
122 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
123 |  |  |  |  |
124 |  |  |  |  | This software is copyright (c) 2012 by Infinity Interactive, Inc..
125 |  |  |  |  |
126 |  |  |  |  | This is free software; you can redistribute it and/or modify it under
127 |  |  |  |  | the same terms as the Perl 5 programming language system itself.
128 |  |  |  |  |
129 |  |  |  |  | =cut
130 |  |  |  |  |
131 |  |  |  |  |
132 |  |  |  |  | __END__