← Index
NYTProf Performance Profile   « block view • line view • sub view »
For -e
  Run on Wed Nov 17 21:39:01 2010
Reported on Wed Nov 17 22:07:29 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 7641 statements in 254ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
36073223ms229msClass::MOP::Method::Generated::::_eval_closureClass::MOP::Method::Generated::_eval_closure
1873312.8ms181msClass::MOP::Method::Generated::::_compile_codeClass::MOP::Method::Generated::_compile_code
1871112.5ms14.4msClass::MOP::Method::Generated::::_add_line_directiveClass::MOP::Method::Generated::_add_line_directive
11191µs109µsClass::MOP::Method::Generated::::BEGIN@4Class::MOP::Method::Generated::BEGIN@4
11144µs303µsClass::MOP::Method::Generated::::BEGIN@13Class::MOP::Method::Generated::BEGIN@13
11140µs191µsClass::MOP::Method::Generated::::BEGIN@7Class::MOP::Method::Generated::BEGIN@7
11138µs107µsClass::MOP::Method::Generated::::BEGIN@5Class::MOP::Method::Generated::BEGIN@5
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
43100µs2126µs
# spent 109µs (91+18) within Class::MOP::Method::Generated::BEGIN@4 which was called: # once (91µs+18µs) by base::import at line 4
use strict;
# spent 109µs making 1 call to Class::MOP::Method::Generated::BEGIN@4 # spent 18µs making 1 call to strict::import
53101µs2175µs
# spent 107µs (38+69) within Class::MOP::Method::Generated::BEGIN@5 which was called: # once (38µs+69µs) by base::import at line 5
use warnings;
# spent 107µs making 1 call to Class::MOP::Method::Generated::BEGIN@5 # spent 69µs making 1 call to warnings::import
6
73284µs2342µs
# spent 191µs (40+151) within Class::MOP::Method::Generated::BEGIN@7 which was called: # once (40µs+151µs) by base::import at line 7
use Carp 'confess';
# spent 191µs making 1 call to Class::MOP::Method::Generated::BEGIN@7 # spent 151µs making 1 call to Exporter::import
8
915µsour $VERSION = '1.11';
10164µs$VERSION = eval $VERSION;
# spent 11µs executing statements in string eval
1114µsour $AUTHORITY = 'cpan:STEVAN';
12
1331.89ms2303µs
# spent 303µs (44+259) within Class::MOP::Method::Generated::BEGIN@13 which was called: # once (44µs+259µs) by base::import at line 13
use base 'Class::MOP::Method';
# spent 303µs making 1 call to Class::MOP::Method::Generated::BEGIN@13 # spent 259µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 259µs
14
15## accessors
16
17sub new {
18 confess __PACKAGE__ . " is an abstract base class, you must provide a constructor.";
19}
20
214025.28mssub is_inline { $_[0]{is_inline} }
22
231872.63mssub 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 229ms (223+5.30) within Class::MOP::Method::Generated::_eval_closure which was called 360 times, avg 635µs/call: # 187 times (149ms+4.94ms) by Class::MOP::Method::Generated::_compile_code at line 119, avg 822µs/call # 52 times (16.7ms+0s) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 152 of Class/MOP/Method/Accessor.pm, avg 321µs/call # 43 times (11.6ms+0s) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 180 of Class/MOP/Method/Accessor.pm, avg 270µs/call # 31 times (32.5ms+365µs) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 124 of Class/MOP/Method/Constructor.pm, avg 1.06ms/call # 29 times (7.86ms+0s) by Class::MOP::Method::Accessor::_generate_clearer_method_inline at line 193 of Class/MOP/Method/Accessor.pm, avg 271µs/call # 15 times (5.01ms+0s) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 136 of Class/MOP/Method/Accessor.pm, avg 334µs/call # 3 times (783µs+0s) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 167 of Class/MOP/Method/Accessor.pm, avg 261µs/call
sub _eval_closure {
303602.03ms my ($self, $__captures, $sub_body) = @_;
31
32360837µs my $code;
33
343601.91ms my $e = do {
35360840µs local $@;
363606.67ms local $SIG{__DIE__};
3771212.1ms7125.03ms my $source = join
# spent 5.03ms making 712 calls to Class::MOP::Method::Generated::CORE:match, avg 7µs/call
38 "\n", (
39 map {
403607.62ms /^([\@\%\$])/
41 or die "capture key should start with \@, \% or \$: $_";
427125.13ms q[my ]
43 . $_ . q[ = ]
44 . $1
45 . q[{$__captures->{']
46 . $_ . q['}};];
47 } keys %$__captures
48 ),
49 $sub_body;
50
513601.63ms $self->_dump_source($source) if $ENV{MOP_PRINT_SOURCE};
52
53360170ms $code = eval $source;
# spent 297ms executing statements in 336 string evals (merged)
543603.24ms $@;
55 };
56
573607.79ms 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 14.4ms (12.5+1.93) within Class::MOP::Method::Generated::_add_line_directive which was called 187 times, avg 77µs/call: # 187 times (12.5ms+1.93ms) by Class::MOP::Method::Generated::_compile_code at line 117, avg 77µs/call
sub _add_line_directive {
901871.52ms my ( $self, %args ) = @_;
91
92187451µs my ( $line, $file );
93
941873.09ms1871.93ms if ( my $ctx = ( $args{context} || $self->definition_context ) ) {
# spent 1.93ms making 187 calls to Class::MOP::Method::Generated::definition_context, avg 10µs/call
95137502µs $line = $ctx->{line};
961371.19ms if ( my $desc = $ctx->{description} ) {
97 $file = "$desc defined at $ctx->{file}";
98 } else {
99520µs $file = $ctx->{file};
100 }
101 } else {
10250223µs ( $line, $file ) = ( 0, "generated method (unknown origin)" );
103 }
104
105187732µs 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
109187371µs $code = join(@$code, ' ') if ref $code;
110
1111874.23ms return qq{#line $line "$file"\n} . $code;
112}
113
114
# spent 181ms (12.8+168) within Class::MOP::Method::Generated::_compile_code which was called 187 times, avg 968µs/call: # 139 times (9.35ms+110ms) by Moose::Meta::Method::Accessor::_eval_code at line 24 of Moose/Meta/Method/Accessor.pm, avg 861µs/call # 24 times (1.91ms+47.2ms) by Moose::Meta::Method::Constructor::_initialize_body at line 101 of Moose/Meta/Method/Constructor.pm, avg 2.05ms/call # 24 times (1.54ms+10.6ms) by Moose::Meta::Method::Destructor::_initialize_body at line 111 of Moose/Meta/Method/Destructor.pm, avg 508µs/call
sub _compile_code {
1151871.91ms my ( $self, %args ) = @_;
116
1171873.62ms18714.4ms my $code = $self->_add_line_directive(%args);
# spent 14.4ms making 187 calls to Class::MOP::Method::Generated::_add_line_directive, avg 77µs/call
118
1191875.48ms187154ms return $self->_eval_closure($args{environment}, $code);
# spent 154ms making 187 calls to Class::MOP::Method::Generated::_eval_closure, avg 822µs/call
120}
121
122111µs1;
123
124__END__