| 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 6669 statements in 235ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 298 | 6 | 3 | 207ms | 211ms | Class::MOP::Method::Generated::_eval_closure |
| 177 | 3 | 3 | 12.4ms | 178ms | Class::MOP::Method::Generated::_compile_code |
| 177 | 1 | 1 | 12.0ms | 13.9ms | Class::MOP::Method::Generated::_add_line_directive |
| 1 | 1 | 1 | 83µs | 101µs | Class::MOP::Method::Generated::BEGIN@4 |
| 1 | 1 | 1 | 44µs | 296µs | Class::MOP::Method::Generated::BEGIN@13 |
| 1 | 1 | 1 | 37µs | 103µs | Class::MOP::Method::Generated::BEGIN@5 |
| 1 | 1 | 1 | 36µs | 188µs | Class::MOP::Method::Generated::BEGIN@7 |
| 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 | 99µs | 2 | 119µ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 # spent 101µs making 1 call to Class::MOP::Method::Generated::BEGIN@4
# spent 18µs making 1 call to strict::import |
| 5 | 3 | 113µs | 2 | 170µ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 # spent 103µs making 1 call to Class::MOP::Method::Generated::BEGIN@5
# spent 67µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 204µs | 2 | 339µ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 # spent 188µs making 1 call to Class::MOP::Method::Generated::BEGIN@7
# spent 152µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 4µs | our $VERSION = '1.11'; | ||
| 10 | 1 | 60µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 11 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 1.88ms | 2 | 296µ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 # 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 | |||||
| 17 | sub new { | ||||
| 18 | confess __PACKAGE__ . " is an abstract base class, you must provide a constructor."; | ||||
| 19 | } | ||||
| 20 | |||||
| 21 | 325 | 4.25ms | sub is_inline { $_[0]{is_inline} } | ||
| 22 | |||||
| 23 | 177 | 2.66ms | 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 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 | ||||
| 30 | 4274 | 203ms | my ($self, $__captures, $sub_body) = @_; | ||
| 31 | |||||
| 32 | my $code; | ||||
| 33 | |||||
| 34 | my $e = do { | ||||
| 35 | local $@; | ||||
| 36 | local $SIG{__DIE__}; | ||||
| 37 | 647 | 4.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 | |||||
| 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 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 | ||||
| 90 | 1346 | 11.8ms | my ( $self, %args ) = @_; | ||
| 91 | |||||
| 92 | my ( $line, $file ); | ||||
| 93 | |||||
| 94 | 177 | 1.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 | ||||
| 115 | 531 | 10.4ms | my ( $self, %args ) = @_; | ||
| 116 | |||||
| 117 | 177 | 13.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 | |||||
| 119 | 177 | 152ms | 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 | |||||
| 122 | 1 | 10µs | 1; | ||
| 123 | |||||
| 124 | __END__ |