← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:45:08 2010
Reported on Wed Nov 17 22:09:57 2010

Filename/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Method/Generated.pm
StatementsExecuted 6669 statements in 235ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
29863207ms211msClass::MOP::Method::Generated::::_eval_closureClass::MOP::Method::Generated::_eval_closure
1773312.4ms178msClass::MOP::Method::Generated::::_compile_codeClass::MOP::Method::Generated::_compile_code
1771112.0ms13.9msClass::MOP::Method::Generated::::_add_line_directiveClass::MOP::Method::Generated::_add_line_directive
11183µs101µsClass::MOP::Method::Generated::::BEGIN@4Class::MOP::Method::Generated::BEGIN@4
11144µs296µsClass::MOP::Method::Generated::::BEGIN@13Class::MOP::Method::Generated::BEGIN@13
11137µs103µsClass::MOP::Method::Generated::::BEGIN@5Class::MOP::Method::Generated::BEGIN@5
11136µs188µsClass::MOP::Method::Generated::::BEGIN@7Class::MOP::Method::Generated::BEGIN@7
0000s0sClass::MOP::Method::Generated::::_dump_sourceClass::MOP::Method::Generated::_dump_source
0000s0sClass::MOP::Method::Generated::::_initialize_bodyClass::MOP::Method::Generated::_initialize_body
0000s0sClass::MOP::Method::Generated::::newClass::MOP::Method::Generated::new
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Class::MOP::Method::Generated;
3
4399µs2119µs
# spent 101µs (83+18) within Class::MOP::Method::Generated::BEGIN@4 which was called: # once (83µs+18µs) by base::import at line 4
use strict;
# spent 101µs making 1 call to Class::MOP::Method::Generated::BEGIN@4 # spent 18µs making 1 call to strict::import
53113µs2170µs
# spent 103µs (37+67) within Class::MOP::Method::Generated::BEGIN@5 which was called: # once (37µs+67µs) by base::import at line 5
use warnings;
# spent 103µs making 1 call to Class::MOP::Method::Generated::BEGIN@5 # spent 67µs making 1 call to warnings::import
6
73204µs2339µs
# spent 188µs (36+152) within Class::MOP::Method::Generated::BEGIN@7 which was called: # once (36µs+152µs) by base::import at line 7
use Carp 'confess';
# spent 188µs making 1 call to Class::MOP::Method::Generated::BEGIN@7 # spent 152µs making 1 call to Exporter::import
8
914µsour $VERSION = '1.11';
10160µs$VERSION = eval $VERSION;
# spent 10µs executing statements in string eval
1114µsour $AUTHORITY = 'cpan:STEVAN';
12
1331.88ms2296µs
# spent 296µs (44+252) within Class::MOP::Method::Generated::BEGIN@13 which was called: # once (44µs+252µs) by base::import at line 13
use base 'Class::MOP::Method';
# spent 296µs making 1 call to Class::MOP::Method::Generated::BEGIN@13 # spent 252µs making 1 call to base::import, recursion: max depth 2, sum of overlapping time 252µs
14
15## accessors
16
17sub new {
18 confess __PACKAGE__ . " is an abstract base class, you must provide a constructor.";
19}
20
213254.25mssub is_inline { $_[0]{is_inline} }
22
231772.66mssub definition_context { $_[0]{definition_context} }
24
25sub _initialize_body {
26 confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
27}
28
29
# spent 211ms (207+4.10) within Class::MOP::Method::Generated::_eval_closure which was called 298 times, avg 708µs/call: # 177 times (148ms+3.74ms) by Class::MOP::Method::Generated::_compile_code at line 119, avg 859µs/call # 52 times (16.0ms+0s) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 152 of Class/MOP/Method/Accessor.pm, avg 308µs/call # 31 times (31.8ms+361µs) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 124 of Class/MOP/Method/Constructor.pm, avg 1.04ms/call # 20 times (5.22ms+0s) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 180 of Class/MOP/Method/Accessor.pm, avg 261µs/call # 15 times (4.85ms+0s) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 136 of Class/MOP/Method/Accessor.pm, avg 323µs/call # 3 times (793µs+0s) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 167 of Class/MOP/Method/Accessor.pm, avg 264µs/call
sub _eval_closure {
304274203ms my ($self, $__captures, $sub_body) = @_;
31
32 my $code;
33
34 my $e = do {
35 local $@;
36 local $SIG{__DIE__};
376474.10ms my $source = join
# spent 4.10ms making 647 calls to Class::MOP::Method::Generated::CORE:match, avg 6µs/call
38 "\n", (
39 map {
40 /^([\@\%\$])/
41 or die "capture key should start with \@, \% or \$: $_";
42 q[my ]
43 . $_ . q[ = ]
44 . $1
45 . q[{$__captures->{']
46 . $_ . q['}};];
47 } keys %$__captures
48 ),
49 $sub_body;
50
51 $self->_dump_source($source) if $ENV{MOP_PRINT_SOURCE};
52
53 $code = eval $source;
# spent 446ms executing statements in 259 string evals (merged)
54 $@;
55 };
56
57 return ( $code, $e );
58}
59
60sub _dump_source {
61 my ( $self, $source ) = @_;
62
63 my $output;
64 if ( eval { require Perl::Tidy } ) {
65 require File::Spec;
66
67 my $rc_file = File::Spec->catfile(
68 $INC{'Class/MOP/Method/Generated.pm'},
69 ('..') x 5,
70 'perltidyrc'
71 );
72
73 my %p = (
74 source => \$source,
75 destination => \$output,
76 );
77 $p{perltidyrc} = $rc_file
78 if -f $rc_file;
79
80 Perl::Tidy::perltidy(%p);
81 }
82 else {
83 $output = $source;
84 }
85
86 print STDERR "\n", $self->name, ":\n", $output, "\n";
87}
88
89
# spent 13.9ms (12.0+1.85) within Class::MOP::Method::Generated::_add_line_directive which was called 177 times, avg 78µs/call: # 177 times (12.0ms+1.85ms) by Class::MOP::Method::Generated::_compile_code at line 117, avg 78µs/call
sub _add_line_directive {
90134611.8ms my ( $self, %args ) = @_;
91
92 my ( $line, $file );
93
941771.85ms if ( my $ctx = ( $args{context} || $self->definition_context ) ) {
# spent 1.85ms making 177 calls to Class::MOP::Method::Generated::definition_context, avg 10µs/call
95 $line = $ctx->{line};
96 if ( my $desc = $ctx->{description} ) {
97 $file = "$desc defined at $ctx->{file}";
98 } else {
99 $file = $ctx->{file};
100 }
101 } else {
102 ( $line, $file ) = ( 0, "generated method (unknown origin)" );
103 }
104
105 my $code = $args{code};
106
107 # if it's an array of lines, join it up
108 # don't use newlines so that the definition context is more meaningful
109 $code = join(@$code, ' ') if ref $code;
110
111 return qq{#line $line "$file"\n} . $code;
112}
113
114
# spent 178ms (12.4+166) within Class::MOP::Method::Generated::_compile_code which was called 177 times, avg 1.01ms/call: # 96 times (6.87ms+77.2ms) by Moose::Meta::Method::Accessor::_eval_code at line 24 of Moose/Meta/Method/Accessor.pm, avg 876µs/call # 42 times (3.18ms+73.3ms) by Moose::Meta::Method::Constructor::_initialize_body at line 101 of Moose/Meta/Method/Constructor.pm, avg 1.82ms/call # 39 times (2.34ms+15.3ms) by Moose::Meta::Method::Destructor::_initialize_body at line 111 of Moose/Meta/Method/Destructor.pm, avg 453µs/call
sub _compile_code {
11553110.4ms my ( $self, %args ) = @_;
116
11717713.9ms my $code = $self->_add_line_directive(%args);
# spent 13.9ms making 177 calls to Class::MOP::Method::Generated::_add_line_directive, avg 78µs/call
118
119177152ms return $self->_eval_closure($args{environment}, $code);
# spent 152ms making 177 calls to Class::MOP::Method::Generated::_eval_closure, avg 859µs/call
120}
121
122110µs1;
123
124__END__