| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Method/Generated.pm |
| Statements | Executed 7641 statements in 254ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 360 | 7 | 3 | 223ms | 229ms | Class::MOP::Method::Generated::_eval_closure |
| 187 | 3 | 3 | 12.8ms | 181ms | Class::MOP::Method::Generated::_compile_code |
| 187 | 1 | 1 | 12.5ms | 14.4ms | Class::MOP::Method::Generated::_add_line_directive |
| 1 | 1 | 1 | 91µs | 109µs | Class::MOP::Method::Generated::BEGIN@4 |
| 1 | 1 | 1 | 44µs | 303µs | Class::MOP::Method::Generated::BEGIN@13 |
| 1 | 1 | 1 | 40µs | 191µs | Class::MOP::Method::Generated::BEGIN@7 |
| 1 | 1 | 1 | 38µs | 107µs | Class::MOP::Method::Generated::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Generated::_dump_source |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Generated::_initialize_body |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Generated::new |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Class::MOP::Method::Generated; | ||||
| 3 | |||||
| 4 | 3 | 100µs | 2 | 126µ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 # spent 109µs making 1 call to Class::MOP::Method::Generated::BEGIN@4
# spent 18µs making 1 call to strict::import |
| 5 | 3 | 101µs | 2 | 175µ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 # spent 107µs making 1 call to Class::MOP::Method::Generated::BEGIN@5
# spent 69µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 284µs | 2 | 342µ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 # spent 191µs making 1 call to Class::MOP::Method::Generated::BEGIN@7
# spent 151µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 5µs | our $VERSION = '1.11'; | ||
| 10 | 1 | 64µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 11 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 1.89ms | 2 | 303µ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 # 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 | |||||
| 17 | sub new { | ||||
| 18 | confess __PACKAGE__ . " is an abstract base class, you must provide a constructor."; | ||||
| 19 | } | ||||
| 20 | |||||
| 21 | 402 | 5.28ms | sub is_inline { $_[0]{is_inline} } | ||
| 22 | |||||
| 23 | 187 | 2.63ms | sub definition_context { $_[0]{definition_context} } | ||
| 24 | |||||
| 25 | sub _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 | ||||
| 30 | 360 | 2.03ms | my ($self, $__captures, $sub_body) = @_; | ||
| 31 | |||||
| 32 | 360 | 837µs | my $code; | ||
| 33 | |||||
| 34 | 360 | 1.91ms | my $e = do { | ||
| 35 | 360 | 840µs | local $@; | ||
| 36 | 360 | 6.67ms | local $SIG{__DIE__}; | ||
| 37 | 712 | 12.1ms | 712 | 5.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 { | ||||
| 40 | 360 | 7.62ms | /^([\@\%\$])/ | ||
| 41 | or die "capture key should start with \@, \% or \$: $_"; | ||||
| 42 | 712 | 5.13ms | q[my ] | ||
| 43 | . $_ . q[ = ] | ||||
| 44 | . $1 | ||||
| 45 | . q[{$__captures->{'] | ||||
| 46 | . $_ . q['}};]; | ||||
| 47 | } keys %$__captures | ||||
| 48 | ), | ||||
| 49 | $sub_body; | ||||
| 50 | |||||
| 51 | 360 | 1.63ms | $self->_dump_source($source) if $ENV{MOP_PRINT_SOURCE}; | ||
| 52 | |||||
| 53 | 360 | 170ms | $code = eval $source; # spent 297ms executing statements in 336 string evals (merged) | ||
| 54 | 360 | 3.24ms | $@; | ||
| 55 | }; | ||||
| 56 | |||||
| 57 | 360 | 7.79ms | return ( $code, $e ); | ||
| 58 | } | ||||
| 59 | |||||
| 60 | sub _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 | ||||
| 90 | 187 | 1.52ms | my ( $self, %args ) = @_; | ||
| 91 | |||||
| 92 | 187 | 451µs | my ( $line, $file ); | ||
| 93 | |||||
| 94 | 187 | 3.09ms | 187 | 1.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 |
| 95 | 137 | 502µs | $line = $ctx->{line}; | ||
| 96 | 137 | 1.19ms | if ( my $desc = $ctx->{description} ) { | ||
| 97 | $file = "$desc defined at $ctx->{file}"; | ||||
| 98 | } else { | ||||
| 99 | 5 | 20µs | $file = $ctx->{file}; | ||
| 100 | } | ||||
| 101 | } else { | ||||
| 102 | 50 | 223µs | ( $line, $file ) = ( 0, "generated method (unknown origin)" ); | ||
| 103 | } | ||||
| 104 | |||||
| 105 | 187 | 732µ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 | ||||
| 109 | 187 | 371µs | $code = join(@$code, ' ') if ref $code; | ||
| 110 | |||||
| 111 | 187 | 4.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 | ||||
| 115 | 187 | 1.91ms | my ( $self, %args ) = @_; | ||
| 116 | |||||
| 117 | 187 | 3.62ms | 187 | 14.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 | |||||
| 119 | 187 | 5.48ms | 187 | 154ms | 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 | |||||
| 122 | 1 | 11µs | 1; | ||
| 123 | |||||
| 124 | __END__ |