| File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Class/MOP/Method/Generated.pm |
| Statements Executed | 1632 |
| Statement Execution Time | 15.9ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 122 | 6 | 3 | 12.6ms | 12.6ms | Class::MOP::Method::Generated::_eval_closure |
| 1 | 1 | 1 | 1.14ms | 1.54ms | Class::MOP::Method::Generated::BEGIN@15 |
| 203 | 2 | 2 | 232µs | 232µs | Class::MOP::Method::Generated::is_inline |
| 8 | 3 | 3 | 124µs | 1.39ms | Class::MOP::Method::Generated::_compile_code |
| 8 | 1 | 1 | 105µs | 116µs | Class::MOP::Method::Generated::_add_line_directive |
| 49 | 1 | 2 | 65µs | 65µs | Class::MOP::Method::Generated::CORE:match (opcode) |
| 1 | 1 | 1 | 22µs | 27µs | Class::MOP::Method::Generated::BEGIN@4 |
| 1 | 1 | 1 | 14µs | 81µs | Class::MOP::Method::Generated::BEGIN@13 |
| 1 | 1 | 1 | 12µs | 26µs | Class::MOP::Method::Generated::BEGIN@5 |
| 8 | 1 | 1 | 11µs | 11µs | Class::MOP::Method::Generated::definition_context |
| 1 | 1 | 1 | 10µs | 47µs | Class::MOP::Method::Generated::BEGIN@7 |
| 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 | 43µs | 2 | 31µs | # spent 27µs (22+4) within Class::MOP::Method::Generated::BEGIN@4 which was called
# once (22µs+4µs) by base::import at line 4 # spent 27µs making 1 call to Class::MOP::Method::Generated::BEGIN@4
# spent 4µs making 1 call to strict::import |
| 5 | 3 | 36µs | 2 | 40µs | # spent 26µs (12+14) within Class::MOP::Method::Generated::BEGIN@5 which was called
# once (12µs+14µs) by base::import at line 5 # spent 26µs making 1 call to Class::MOP::Method::Generated::BEGIN@5
# spent 14µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 80µs | 2 | 84µs | # spent 47µs (10+37) within Class::MOP::Method::Generated::BEGIN@7 which was called
# once (10µs+37µs) by base::import at line 7 # spent 47µs making 1 call to Class::MOP::Method::Generated::BEGIN@7
# spent 37µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 800ns | our $VERSION = '0.98'; | ||
| 10 | 1 | 19µs | $VERSION = eval $VERSION; | ||
| 11 | 1 | 500ns | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 74µs | 2 | 81µs | # spent 81µs (14+67) within Class::MOP::Method::Generated::BEGIN@13 which was called
# once (14µs+67µs) by base::import at line 13 # spent 81µs making 1 call to Class::MOP::Method::Generated::BEGIN@13
# spent 67µs making 1 call to base::import, recursion: max depth 1, time 67µs |
| 14 | |||||
| 15 | 3 | 593µs | 2 | 1.63ms | # spent 1.54ms (1.14+403µs) within Class::MOP::Method::Generated::BEGIN@15 which was called
# once (1.14ms+403µs) by base::import at line 15 # spent 1.54ms making 1 call to Class::MOP::Method::Generated::BEGIN@15
# spent 85µs making 1 call to constant::import |
| 16 | |||||
| 17 | ## accessors | ||||
| 18 | |||||
| 19 | sub new { | ||||
| 20 | confess __PACKAGE__ . " is an abstract base class, you must provide a constructor."; | ||||
| 21 | } | ||||
| 22 | |||||
| 23 | 203 | 369µs | # spent 232µs within Class::MOP::Method::Generated::is_inline which was called 203 times, avg 1µs/call:
# 172 times (193µs+0s) by Class::MOP::Method::Accessor::_initialize_body at line 80 of Class/MOP/Method/Accessor.pm, avg 1µs/call
# 31 times (38µs+0s) by Class::MOP::Method::Constructor::_initialize_body at line 91 of Class/MOP/Method/Constructor.pm, avg 1µs/call | ||
| 24 | |||||
| 25 | 8 | 21µs | # spent 11µs within Class::MOP::Method::Generated::definition_context which was called 8 times, avg 1µs/call:
# 8 times (11µs+0s) by Class::MOP::Method::Generated::_add_line_directive at line 66, avg 1µs/call | ||
| 26 | |||||
| 27 | sub _initialize_body { | ||||
| 28 | confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class"; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | # spent 12.6ms (12.6+65µs) within Class::MOP::Method::Generated::_eval_closure which was called 122 times, avg 104µs/call:
# 52 times (3.06ms+0s) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 157 of Class/MOP/Method/Accessor.pm, avg 59µs/call
# 31 times (6.73ms+37µs) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 121 of Class/MOP/Method/Constructor.pm, avg 218µs/call
# 15 times (902µs+0s) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 138 of Class/MOP/Method/Accessor.pm, avg 60µs/call
# 13 times (599µs+0s) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 192 of Class/MOP/Method/Accessor.pm, avg 46µs/call
# 8 times (1.13ms+27µs) by Class::MOP::Method::Generated::_compile_code at line 91, avg 144µs/call
# 3 times (144µs+0s) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 175 of Class/MOP/Method/Accessor.pm, avg 48µs/call | ||||
| 32 | # my ($self, $captures, $sub_body) = @_; | ||||
| 33 | 122 | 27µs | my $__captures = $_[1]; | ||
| 34 | |||||
| 35 | 122 | 14µs | my $code; | ||
| 36 | |||||
| 37 | 122 | 52µs | my $e = do { | ||
| 38 | 122 | 15µs | local $@; | ||
| 39 | 122 | 259µs | local $SIG{__DIE__}; | ||
| 40 | 49 | 158µs | 49 | 65µs | my $source = join # spent 65µs making 49 calls to Class::MOP::Method::Generated::CORE:match, avg 1µs/call |
| 41 | "\n", ( | ||||
| 42 | map { | ||||
| 43 | 122 | 237µs | /^([\@\%\$])/ | ||
| 44 | or die "capture key should start with \@, \% or \$: $_"; | ||||
| 45 | 49 | 71µs | q[my ] | ||
| 46 | . $_ . q[ = ] | ||||
| 47 | . $1 | ||||
| 48 | . q[{$__captures->{'] | ||||
| 49 | . $_ . q['}};]; | ||||
| 50 | } keys %$__captures | ||||
| 51 | ), | ||||
| 52 | $_[2]; | ||||
| 53 | 122 | 500ns | print STDERR "\n", $_[0]->name, ":\n", $source, "\n" if _PRINT_SOURCE; | ||
| 54 | 122 | 13.0ms | 6 | 12µs | $code = eval $source; # spent 7µs making 4 calls to Class::MOP::__ANON__[Class/MOP.pm:494], avg 2µs/call
# spent 5µs making 2 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:30], avg 2µs/call |
| 55 | 122 | 204µs | $@; | ||
| 56 | }; | ||||
| 57 | |||||
| 58 | 122 | 464µs | return ( $code, $e ); | ||
| 59 | } | ||||
| 60 | |||||
| 61 | # spent 116µs (105+11) within Class::MOP::Method::Generated::_add_line_directive which was called 8 times, avg 14µs/call:
# 8 times (105µs+11µs) by Class::MOP::Method::Generated::_compile_code at line 89, avg 14µs/call | ||||
| 62 | 8 | 9µs | my ( $self, %args ) = @_; | ||
| 63 | |||||
| 64 | 8 | 2µs | my ( $line, $file ); | ||
| 65 | |||||
| 66 | 8 | 27µs | 8 | 11µs | if ( my $ctx = ( $args{context} || $self->definition_context ) ) { # spent 11µs making 8 calls to Class::MOP::Method::Generated::definition_context, avg 1µs/call |
| 67 | 4 | 2µs | $line = $ctx->{line}; | ||
| 68 | 4 | 6µs | if ( my $desc = $ctx->{description} ) { | ||
| 69 | $file = "$desc defined at $ctx->{file}"; | ||||
| 70 | } else { | ||||
| 71 | $file = $ctx->{file}; | ||||
| 72 | } | ||||
| 73 | } else { | ||||
| 74 | 4 | 3µs | ( $line, $file ) = ( 0, "generated method (unknown origin)" ); | ||
| 75 | } | ||||
| 76 | |||||
| 77 | 8 | 4µs | my $code = $args{code}; | ||
| 78 | |||||
| 79 | # if it's an array of lines, join it up | ||||
| 80 | # don't use newlines so that the definition context is more meaningful | ||||
| 81 | 8 | 1µs | $code = join(@$code, ' ') if ref $code; | ||
| 82 | |||||
| 83 | 8 | 40µs | return qq{#line $line "$file"\n} . $code; | ||
| 84 | } | ||||
| 85 | |||||
| 86 | # spent 1.39ms (124µs+1.27) within Class::MOP::Method::Generated::_compile_code which was called 8 times, avg 174µs/call:
# 6 times (89µs+902µs) by Moose::Meta::Method::Accessor::_eval_code at line 36 of Moose/Meta/Method/Accessor.pm, avg 165µs/call
# once (19µs+314µs) by Moose::Meta::Method::Constructor::_initialize_body at line 96 of Moose/Meta/Method/Constructor.pm
# once (16µs+54µs) by Moose::Meta::Method::Destructor::_initialize_body at line 108 of Moose/Meta/Method/Destructor.pm | ||||
| 87 | 8 | 14µs | my ( $self, %args ) = @_; | ||
| 88 | |||||
| 89 | 8 | 35µs | 8 | 116µs | my $code = $self->_add_line_directive(%args); # spent 116µs making 8 calls to Class::MOP::Method::Generated::_add_line_directive, avg 14µs/call |
| 90 | |||||
| 91 | 8 | 54µs | 8 | 1.15ms | return $self->_eval_closure($args{environment}, $code); # spent 1.15ms making 8 calls to Class::MOP::Method::Generated::_eval_closure, avg 144µs/call |
| 92 | } | ||||
| 93 | |||||
| 94 | 1 | 6µs | 1; | ||
| 95 | |||||
| 96 | __END__ | ||||
| 97 | |||||
| 98 | =pod | ||||
| 99 | |||||
| 100 | =head1 NAME | ||||
| 101 | |||||
| 102 | Class::MOP::Method::Generated - Abstract base class for generated methods | ||||
| 103 | |||||
| 104 | =head1 DESCRIPTION | ||||
| 105 | |||||
| 106 | This is a C<Class::MOP::Method> subclass which is subclassed by | ||||
| 107 | C<Class::MOP::Method::Accessor> and | ||||
| 108 | C<Class::MOP::Method::Constructor>. | ||||
| 109 | |||||
| 110 | It is not intended to be used directly. | ||||
| 111 | |||||
| 112 | =head1 AUTHORS | ||||
| 113 | |||||
| 114 | Stevan Little E<lt>stevan@iinteractive.comE<gt> | ||||
| 115 | |||||
| 116 | =head1 COPYRIGHT AND LICENSE | ||||
| 117 | |||||
| 118 | Copyright 2006-2010 by Infinity Interactive, Inc. | ||||
| 119 | |||||
| 120 | L<http://www.iinteractive.com> | ||||
| 121 | |||||
| 122 | This library is free software; you can redistribute it and/or modify | ||||
| 123 | it under the same terms as Perl itself. | ||||
| 124 | |||||
| 125 | =cut | ||||
| 126 | |||||
# spent 65µs within Class::MOP::Method::Generated::CORE:match which was called 49 times, avg 1µs/call:
# 49 times (65µs+0s) by Class::MOP::Method::Generated::_eval_closure at line 40 of Class/MOP/Method/Generated.pm, avg 1µs/call |