Profile of Class/MOP/Class/Immutable/Trait.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For xt/tapper-mcp-scheduler-with-db-longrun.t
Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:22:46 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Class/Immutable/Trait.pm
Statements | Executed 1610 statements in 2.84ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
24 | 1 | 1 | 68µs | 68µs | Class::MOP::Class::Immutable::Trait::::_get_mutable_metaclass_nameClass::MOP::Class::Immutable::Trait::_get_mutable_metaclass_name
1 | 1 | 1 | 16µs | 22µs | Class::MOP::Class::Immutable::Trait::::BEGIN@9Class::MOP::Class::Immutable::Trait::BEGIN@9
1 | 1 | 1 | 12µs | 29µs | Class::MOP::Class::Immutable::Trait::::BEGIN@10Class::MOP::Class::Immutable::Trait::BEGIN@10
1 | 1 | 1 | 11µs | 11µs | Class::MOP::Class::Immutable::Trait::::BEGIN@2Class::MOP::Class::Immutable::Trait::BEGIN@2
1 | 1 | 1 | 11µs | 25µs | Class::MOP::Class::Immutable::Trait::::BEGIN@36Class::MOP::Class::Immutable::Trait::BEGIN@36
1 | 1 | 1 | 9µs | 48µs | Class::MOP::Class::Immutable::Trait::::BEGIN@14Class::MOP::Class::Immutable::Trait::BEGIN@14
1 | 1 | 1 | 7µs | 34µs | Class::MOP::Class::Immutable::Trait::::BEGIN@15Class::MOP::Class::Immutable::Trait::BEGIN@15
1 | 1 | 1 | 6µs | 13µs | Class::MOP::Class::Immutable::Trait::::BEGIN@46Class::MOP::Class::Immutable::Trait::BEGIN@46
1 | 1 | 1 | 5µs | 5µs | Class::MOP::Class::Immutable::Trait::::BEGIN@12Class::MOP::Class::Immutable::Trait::BEGIN@12
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::__ANON__[:42]Class::MOP::Class::Immutable::Trait::__ANON__[:42]
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::__ANON__[:47]Class::MOP::Class::Immutable::Trait::__ANON__[:47]
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::_immutable_cannot_callClass::MOP::Class::Immutable::Trait::_immutable_cannot_call
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::_immutable_metaclassClass::MOP::Class::Immutable::Trait::_immutable_metaclass
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::_immutable_read_onlyClass::MOP::Class::Immutable::Trait::_immutable_read_only
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::_method_mapClass::MOP::Class::Immutable::Trait::_method_map
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::class_precedence_listClass::MOP::Class::Immutable::Trait::class_precedence_list
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::get_all_attributesClass::MOP::Class::Immutable::Trait::get_all_attributes
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::get_all_method_namesClass::MOP::Class::Immutable::Trait::get_all_method_names
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::get_all_methodsClass::MOP::Class::Immutable::Trait::get_all_methods
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::get_meta_instanceClass::MOP::Class::Immutable::Trait::get_meta_instance
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::is_immutableClass::MOP::Class::Immutable::Trait::is_immutable
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::is_mutableClass::MOP::Class::Immutable::Trait::is_mutable
0 | 0 | 0 | 0s | 0s | Class::MOP::Class::Immutable::Trait::::linearized_isaClass::MOP::Class::Immutable::Trait::linearized_isa

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Class::MOP::Class::Immutable::Trait;
2 |  |  |  |  | # spent 11µs within Class::MOP::Class::Immutable::Trait::BEGIN@2 which was called: # once (11µs+0s) by Module::Runtime::require_module at line 4 BEGIN {
3 | 1 | 4µs |  |  | $Class::MOP::Class::Immutable::Trait::AUTHORITY = 'cpan:STEVAN';
4 | 1 | 34µs | 1 | 11µs | } # spent 11µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@2
5 |  |  |  |  | {
6 | 2 | 1µs |  |  | $Class::MOP::Class::Immutable::Trait::VERSION = '2.0602';
7 |  |  |  |  | }
8 |  |  |  |  |
9 | 3 | 20µs | 2 | 29µs | # spent 22µs (16+6) within Class::MOP::Class::Immutable::Trait::BEGIN@9 which was called: # once (16µs+6µs) by Module::Runtime::require_module at line 9 use strict; # spent 22µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@9 # spent 6µs making 1 call to strict::import
10 | 3 | 20µs | 2 | 45µs | # spent 29µs (12+16) within Class::MOP::Class::Immutable::Trait::BEGIN@10 which was called: # once (12µs+16µs) by Module::Runtime::require_module at line 10 use warnings; # spent 29µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@10 # spent 16µs making 1 call to warnings::import
11 |  |  |  |  |
12 | 3 | 19µs | 1 | 5µs | # spent 5µs within Class::MOP::Class::Immutable::Trait::BEGIN@12 which was called: # once (5µs+0s) by Module::Runtime::require_module at line 12 use MRO::Compat; # spent 5µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@12
13 |  |  |  |  |
14 | 3 | 22µs | 2 | 86µs | # spent 48µs (9+39) within Class::MOP::Class::Immutable::Trait::BEGIN@14 which was called: # once (9µs+39µs) by Module::Runtime::require_module at line 14 use Carp 'confess'; # spent 48µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@14 # spent 39µs making 1 call to Exporter::import
15 | 3 | 149µs | 2 | 61µs | # spent 34µs (7+27) within Class::MOP::Class::Immutable::Trait::BEGIN@15 which was called: # once (7µs+27µs) by Module::Runtime::require_module at line 15 use Scalar::Util 'blessed', 'weaken'; # spent 34µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@15 # spent 27µs making 1 call to Exporter::import
16 |  |  |  |  |
17 |  |  |  |  | # the original class of the metaclass instance
18 | 24 | 79µs |  |  | # spent 68µs within Class::MOP::Class::Immutable::Trait::_get_mutable_metaclass_name which was called 24 times, avg 3µs/call: # 24 times (68µs+0s) by Class::MOP::Class::_real_ref_name at line 128 of Class/MOP/Class.pm, avg 3µs/call sub _get_mutable_metaclass_name { $_[0]{__immutable}{original_class} }
19 |  |  |  |  |
20 |  |  |  |  | sub is_mutable { 0 }
21 | 24 | 61µs |  |  | sub is_immutable { 1 }
22 |  |  |  |  |
23 |  |  |  |  | sub _immutable_metaclass { ref $_[1] }
24 |  |  |  |  |
25 |  |  |  |  | sub _immutable_read_only {
26 |  |  |  |  | my $name = shift;
27 |  |  |  |  | confess "The '$name' method is read-only when called on an immutable instance";
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 | 600ns |  |  | for my $name (qw/superclasses/) {
36 | 3 | 82µs | 2 | 39µs | # spent 25µs (11+14) within Class::MOP::Class::Immutable::Trait::BEGIN@36 which was called: # once (11µs+14µs) by Module::Runtime::require_module at line 36 no strict 'refs'; # spent 25µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@36 # spent 14µs making 1 call to strict::unimport
37 |  |  |  |  | *{__PACKAGE__."::$name"} = sub {
38 |  |  |  |  | my $orig = shift;
39 |  |  |  |  | my $self = shift;
40 |  |  |  |  | _immutable_read_only($name) if @_;
41 |  |  |  |  | $self->$orig;
42 | 1 | 7µs |  |  | };
43 |  |  |  |  | }
44 |  |  |  |  |
45 | 1 | 600ns |  |  | for my $name (qw/add_method alias_method remove_method add_attribute remove_attribute remove_package_symbol add_package_symbol/) {
46 | 3 | 250µs | 2 | 21µs | # spent 13µs (6+7) within Class::MOP::Class::Immutable::Trait::BEGIN@46 which was called: # once (6µs+7µs) by Module::Runtime::require_module at line 46 no strict 'refs'; # spent 13µs making 1 call to Class::MOP::Class::Immutable::Trait::BEGIN@46 # spent 7µs making 1 call to strict::unimport
47 | 7 | 24µs |  |  | *{__PACKAGE__."::$name"} = sub { _immutable_cannot_call($name) };
48 |  |  |  |  | }
49 |  |  |  |  |
50 |  |  |  |  | sub class_precedence_list {
51 |  |  |  |  | my $orig = shift;
52 |  |  |  |  | my $self = shift;
53 |  |  |  |  | @{ $self->{__immutable}{class_precedence_list}
54 |  |  |  |  | ||= [ $self->$orig ] };
55 |  |  |  |  | }
56 |  |  |  |  |
57 |  |  |  |  | sub linearized_isa {
58 | 189 | 304µs |  |  | my $orig = shift;
59 |  |  |  |  | my $self = shift;
60 |  |  | 15 | 138µs | @{ $self->{__immutable}{linearized_isa} ||= [ $self->$orig ] }; # spent 138µs making 15 calls to Class::MOP::Class::linearized_isa, avg 9µs/call
61 |  |  |  |  | }
62 |  |  |  |  |
63 |  |  |  |  | sub get_all_methods {
64 |  |  |  |  | my $orig = shift;
65 |  |  |  |  | my $self = shift;
66 |  |  |  |  | @{ $self->{__immutable}{get_all_methods} ||= [ $self->$orig ] };
67 |  |  |  |  | }
68 |  |  |  |  |
69 |  |  |  |  | sub get_all_method_names {
70 |  |  |  |  | my $orig = shift;
71 |  |  |  |  | my $self = shift;
72 |  |  |  |  | @{ $self->{__immutable}{get_all_method_names} ||= [ $self->$orig ] };
73 |  |  |  |  | }
74 |  |  |  |  |
75 |  |  |  |  | sub get_all_attributes {
76 | 159 | 328µs |  |  | my $orig = shift;
77 |  |  |  |  | my $self = shift;
78 |  |  | 15 | 1.07ms | @{ $self->{__immutable}{get_all_attributes} ||= [ $self->$orig ] }; # spent 1.07ms making 15 calls to Class::MOP::Class::get_all_attributes, avg 71µs/call
79 |  |  |  |  | }
80 |  |  |  |  |
81 |  |  |  |  | sub get_meta_instance {
82 | 918 | 983µs |  |  | my $orig = shift;
83 |  |  |  |  | my $self = shift;
84 |  |  | 21 | 1.64ms | $self->{__immutable}{get_meta_instance} ||= $self->$orig; # spent 1.64ms making 21 calls to Class::MOP::Class::get_meta_instance, avg 78µs/call
85 |  |  |  |  | }
86 |  |  |  |  |
87 |  |  |  |  | sub _method_map {
88 | 261 | 446µs |  |  | my $orig = shift;
89 |  |  |  |  | my $self = shift;
90 |  |  | 22 | 106µs | $self->{__immutable}{_method_map} ||= $self->$orig; # spent 103µs making 17 calls to Class::MOP::Mixin::HasMethods::_method_map, avg 6µs/call # spent 3µs making 5 calls to Class::MOP::Method::body, avg 620ns/call
91 |  |  |  |  | }
92 |  |  |  |  |
93 | 1 | 7µs |  |  | 1;
94 |  |  |  |  |
95 |  |  |  |  | # ABSTRACT: Implements immutability for metaclass objects
96 |  |  |  |  |
- - |  |  |  |  |
99 |  |  |  |  | =pod
100 |  |  |  |  |
101 |  |  |  |  | =head1 NAME
102 |  |  |  |  |
103 |  |  |  |  | Class::MOP::Class::Immutable::Trait - Implements immutability for metaclass objects
104 |  |  |  |  |
105 |  |  |  |  | =head1 VERSION
106 |  |  |  |  |
107 |  |  |  |  | version 2.0602
108 |  |  |  |  |
109 |  |  |  |  | =head1 DESCRIPTION
110 |  |  |  |  |
111 |  |  |  |  | This class provides a pseudo-trait that is applied to immutable metaclass
112 |  |  |  |  | objects. In reality, it is simply a parent class.
113 |  |  |  |  |
114 |  |  |  |  | It implements caching and read-only-ness for various metaclass methods.
115 |  |  |  |  |
116 |  |  |  |  | =head1 AUTHOR
117 |  |  |  |  |
118 |  |  |  |  | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
119 |  |  |  |  |
120 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
121 |  |  |  |  |
122 |  |  |  |  | This software is copyright (c) 2012 by Infinity Interactive, Inc..
123 |  |  |  |  |
124 |  |  |  |  | This is free software; you can redistribute it and/or modify it under
125 |  |  |  |  | the same terms as the Perl 5 programming language system itself.
126 |  |  |  |  |
127 |  |  |  |  | =cut
128 |  |  |  |  |
129 |  |  |  |  |
130 |  |  |  |  | __END__