| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP/Class/Immutable/Trait.pm |
| Statements | Executed 5020 statements in 42.8ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 62 | 1 | 1 | 953µs | 953µs | Class::MOP::Class::Immutable::Trait::_get_mutable_metaclass_name |
| 1 | 1 | 1 | 74µs | 93µs | Class::MOP::Class::Immutable::Trait::BEGIN@3 |
| 1 | 1 | 1 | 72µs | 142µs | Class::MOP::Class::Immutable::Trait::BEGIN@4 |
| 1 | 1 | 1 | 49µs | 118µs | Class::MOP::Class::Immutable::Trait::BEGIN@36 |
| 1 | 1 | 1 | 37µs | 194µs | Class::MOP::Class::Immutable::Trait::BEGIN@9 |
| 1 | 1 | 1 | 37µs | 195µs | Class::MOP::Class::Immutable::Trait::BEGIN@8 |
| 1 | 1 | 1 | 23µs | 23µs | Class::MOP::Class::Immutable::Trait::BEGIN@6 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::__ANON__[:37] |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::_immutable_cannot_call |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::_immutable_metaclass |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::_method_map |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::add_package_symbol |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::class_precedence_list |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::get_all_attributes |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::get_all_method_names |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::get_all_methods |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::get_meta_instance |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::is_immutable |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::is_mutable |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::linearized_isa |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::superclasses |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Class::MOP::Class::Immutable::Trait; | ||||
| 2 | |||||
| 3 | 3 | 142µs | 2 | 111µs | # spent 93µs (74+18) within Class::MOP::Class::Immutable::Trait::BEGIN@3 which was called:
# once (74µs+18µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 3 # spent 93µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 99µs | 2 | 212µs | # spent 142µs (72+70) within Class::MOP::Class::Immutable::Trait::BEGIN@4 which was called:
# once (72µs+70µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 4 # spent 142µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@4
# spent 70µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 92µs | 1 | 23µs | # spent 23µs within Class::MOP::Class::Immutable::Trait::BEGIN@6 which was called:
# once (23µs+0s) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 6 # spent 23µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@6 |
| 7 | |||||
| 8 | 3 | 106µs | 2 | 353µs | # spent 195µs (37+158) within Class::MOP::Class::Immutable::Trait::BEGIN@8 which was called:
# once (37µs+158µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 8 # spent 195µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@8
# spent 158µs making 1 call to Exporter::import |
| 9 | 3 | 738µs | 2 | 351µs | # spent 194µs (37+157) within Class::MOP::Class::Immutable::Trait::BEGIN@9 which was called:
# once (37µs+157µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 9 # spent 194µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@9
# spent 157µs making 1 call to Exporter::import |
| 10 | |||||
| 11 | 1 | 5µs | our $VERSION = '1.11'; | ||
| 12 | 1 | 67µs | $VERSION = eval $VERSION; # spent 10µs executing statements in string eval | ||
| 13 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 14 | |||||
| 15 | # the original class of the metaclass instance | ||||
| 16 | 62 | 1.12ms | # spent 953µs within Class::MOP::Class::Immutable::Trait::_get_mutable_metaclass_name which was called 62 times, avg 15µs/call:
# 62 times (953µs+0s) by Class::MOP::Class::_real_ref_name at line 126 of Class/MOP/Class.pm, avg 15µs/call | ||
| 17 | |||||
| 18 | sub is_mutable { 0 } | ||||
| 19 | 62 | 840µs | sub is_immutable { 1 } | ||
| 20 | |||||
| 21 | sub _immutable_metaclass { ref $_[1] } | ||||
| 22 | |||||
| 23 | sub superclasses { | ||||
| 24 | 76 | 504µs | my $orig = shift; | ||
| 25 | my $self = shift; | ||||
| 26 | confess "This method is read-only" if @_; | ||||
| 27 | 19 | 3.41ms | $self->$orig; # spent 3.41ms making 19 calls to Class::MOP::Class::superclasses, avg 179µs/call | ||
| 28 | } | ||||
| 29 | |||||
| 30 | sub _immutable_cannot_call { | ||||
| 31 | my $name = shift; | ||||
| 32 | Carp::confess "The '$name' method cannot be called on an immutable instance"; | ||||
| 33 | } | ||||
| 34 | |||||
| 35 | 1 | 6µs | for my $name (qw/add_method alias_method remove_method add_attribute remove_attribute remove_package_symbol/) { | ||
| 36 | 3 | 1.25ms | 2 | 187µs | # spent 118µs (49+69) within Class::MOP::Class::Immutable::Trait::BEGIN@36 which was called:
# once (49µs+69µs) by Class::MOP::__ANON__[/home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Class/MOP.pm:118] at line 36 # spent 118µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@36
# spent 69µs making 1 call to strict::unimport |
| 37 | 6 | 130µs | *{__PACKAGE__."::$name"} = sub { _immutable_cannot_call($name) }; | ||
| 38 | } | ||||
| 39 | |||||
| 40 | sub class_precedence_list { | ||||
| 41 | 219 | 2.18ms | my $orig = shift; | ||
| 42 | my $self = shift; | ||||
| 43 | 19 | 0s | @{ $self->{__immutable}{class_precedence_list} # spent 20.6ms making 19 calls to Class::MOP::Class::class_precedence_list, avg 1.09ms/call, recursion: max depth 4, sum of overlapping time 20.6ms | ||
| 44 | ||= [ $self->$orig ] }; | ||||
| 45 | } | ||||
| 46 | |||||
| 47 | sub linearized_isa { | ||||
| 48 | 573 | 5.27ms | my $orig = shift; | ||
| 49 | my $self = shift; | ||||
| 50 | 18 | 946µs | @{ $self->{__immutable}{linearized_isa} ||= [ $self->$orig ] }; # spent 946µs making 18 calls to Class::MOP::Class::linearized_isa, avg 53µs/call | ||
| 51 | } | ||||
| 52 | |||||
| 53 | sub get_all_methods { | ||||
| 54 | my $orig = shift; | ||||
| 55 | my $self = shift; | ||||
| 56 | @{ $self->{__immutable}{get_all_methods} ||= [ $self->$orig ] }; | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | sub get_all_method_names { | ||||
| 60 | my $orig = shift; | ||||
| 61 | my $self = shift; | ||||
| 62 | @{ $self->{__immutable}{get_all_method_names} ||= [ $self->$orig ] }; | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | sub get_all_attributes { | ||||
| 66 | 831 | 7.99ms | my $orig = shift; | ||
| 67 | my $self = shift; | ||||
| 68 | 18 | 10.9ms | @{ $self->{__immutable}{get_all_attributes} ||= [ $self->$orig ] }; # spent 10.9ms making 18 calls to Class::MOP::Class::get_all_attributes, avg 607µs/call | ||
| 69 | } | ||||
| 70 | |||||
| 71 | sub get_meta_instance { | ||||
| 72 | 1812 | 12.5ms | my $orig = shift; | ||
| 73 | my $self = shift; | ||||
| 74 | 24 | 15.0ms | $self->{__immutable}{get_meta_instance} ||= $self->$orig; # spent 15.0ms making 24 calls to Class::MOP::Class::get_meta_instance, avg 627µs/call | ||
| 75 | } | ||||
| 76 | |||||
| 77 | sub _method_map { | ||||
| 78 | 1356 | 9.77ms | my $orig = shift; | ||
| 79 | my $self = shift; | ||||
| 80 | 23 | 198µs | $self->{__immutable}{_method_map} ||= $self->$orig; # spent 198µs making 23 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 9µs/call | ||
| 81 | } | ||||
| 82 | |||||
| 83 | sub add_package_symbol { | ||||
| 84 | my $orig = shift; | ||||
| 85 | my $self = shift; | ||||
| 86 | confess "Cannot add package symbols to an immutable metaclass" | ||||
| 87 | unless ( caller(3) )[3] eq 'Class::MOP::Package::get_package_symbol'; | ||||
| 88 | |||||
| 89 | $self->$orig(@_); | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | 1 | 18µs | 1; | ||
| 93 | |||||
| 94 | __END__ |