Profile of Moose/Meta/TypeConstraint/Registry.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:35 2012

Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm
Statements | Executed 437 statements in 1.51ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
33 | 7 | 2 | 499µs | 708µs | Moose::Meta::TypeConstraint::Registry::::add_type_constraintMoose::Meta::TypeConstraint::Registry::add_type_constraint
71 | 5 | 1 | 314µs | 405µs | Moose::Meta::TypeConstraint::Registry::::get_type_constraintMoose::Meta::TypeConstraint::Registry::get_type_constraint
50 | 1 | 1 | 285µs | 407µs | Moose::Meta::TypeConstraint::Registry::::has_type_constraintMoose::Meta::TypeConstraint::Registry::has_type_constraint
1 | 1 | 1 | 11µs | 316µs | Moose::Meta::TypeConstraint::Registry::::newMoose::Meta::TypeConstraint::Registry::new
1 | 1 | 1 | 10µs | 10µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@3Moose::Meta::TypeConstraint::Registry::BEGIN@3
1 | 1 | 1 | 9µs | 56µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@14Moose::Meta::TypeConstraint::Registry::BEGIN@14
1 | 1 | 1 | 8µs | 13µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@10Moose::Meta::TypeConstraint::Registry::BEGIN@10
1 | 1 | 1 | 8µs | 24µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@11Moose::Meta::TypeConstraint::Registry::BEGIN@11
1 | 1 | 1 | 8µs | 570µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@12Moose::Meta::TypeConstraint::Registry::BEGIN@12
1 | 1 | 1 | 8µs | 87µs | Moose::Meta::TypeConstraint::Registry::::BEGIN@16Moose::Meta::TypeConstraint::Registry::BEGIN@16
1 | 1 | 1 | 2µs | 2µs | Moose::Meta::TypeConstraint::Registry::::__ANON__[:27]Moose::Meta::TypeConstraint::Registry::__ANON__[:27]
0 | 0 | 0 | 0s | 0s | Moose::Meta::TypeConstraint::Registry::::find_type_constraintMoose::Meta::TypeConstraint::Registry::find_type_constraint

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

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  |
2 |  |  |  |  | package Moose::Meta::TypeConstraint::Registry;
3 |  |  |  |  | # spent 10µs within Moose::Meta::TypeConstraint::Registry::BEGIN@3 which was called: # once (10µs+0s) by Moose::Util::TypeConstraints::BEGIN@42 at line 5 BEGIN {
4 | 1 | 8µs |  |  | $Moose::Meta::TypeConstraint::Registry::AUTHORITY = 'cpan:STEVAN';
5 | 1 | 23µs | 1 | 10µs | } # spent 10µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@3
6 |  |  |  |  | {
7 | 2 | 1µs |  |  | $Moose::Meta::TypeConstraint::Registry::VERSION = '2.0602';
8 |  |  |  |  | }
9 |  |  |  |  |
10 | 3 | 18µs | 2 | 18µs | # spent 13µs (8+5) within Moose::Meta::TypeConstraint::Registry::BEGIN@10 which was called: # once (8µs+5µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 10 use strict; # spent 13µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@10 # spent 5µs making 1 call to strict::import
11 | 3 | 18µs | 2 | 40µs | # spent 24µs (8+16) within Moose::Meta::TypeConstraint::Registry::BEGIN@11 which was called: # once (8µs+16µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 11 use warnings; # spent 24µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@11 # spent 16µs making 1 call to warnings::import
12 | 3 | 28µs | 2 | 1.13ms | # spent 570µs (8+562) within Moose::Meta::TypeConstraint::Registry::BEGIN@12 which was called: # once (8µs+562µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 12 use metaclass; # spent 570µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@12 # spent 562µs making 1 call to metaclass::import
13 |  |  |  |  |
14 | 3 | 22µs | 2 | 103µs | # spent 56µs (9+47) within Moose::Meta::TypeConstraint::Registry::BEGIN@14 which was called: # once (9µs+47µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 14 use Scalar::Util 'blessed'; # spent 56µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@14 # spent 47µs making 1 call to Exporter::import
15 |  |  |  |  |
16 | 3 | 292µs | 2 | 166µs | # spent 87µs (8+79) within Moose::Meta::TypeConstraint::Registry::BEGIN@16 which was called: # once (8µs+79µs) by Moose::Util::TypeConstraints::BEGIN@42 at line 16 use base 'Class::MOP::Object'; # spent 87µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@16 # spent 79µs making 1 call to base::import
17 |  |  |  |  |
18 | 1 | 6µs | 3 | 783µs | __PACKAGE__->meta->add_attribute('parent_registry' => ( # spent 756µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 17µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta # spent 9µs making 1 call to Class::MOP::_definition_context
19 |  |  |  |  | reader => 'get_parent_registry',
20 |  |  |  |  | writer => 'set_parent_registry',
21 |  |  |  |  | predicate => 'has_parent_registry',
22 |  |  |  |  | Class::MOP::_definition_context(),
23 |  |  |  |  | ));
24 |  |  |  |  |
25 |  |  |  |  | __PACKAGE__->meta->add_attribute('type_constraints' => (
26 |  |  |  |  | reader => 'type_constraints',
27 | 1 | 4µs |  |  | # spent 2µs within Moose::Meta::TypeConstraint::Registry::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Meta/TypeConstraint/Registry.pm:27] which was called: # once (2µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 45 of Class/MOP/Mixin/AttributeCore.pm default => sub { {} },
28 | 1 | 6µs | 3 | 304µs | Class::MOP::_definition_context(), # spent 288µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute # spent 11µs making 1 call to Moose::Meta::TypeConstraint::Registry::meta # spent 5µs making 1 call to Class::MOP::_definition_context
29 |  |  |  |  | ));
30 |  |  |  |  |
31 |  |  |  |  | # spent 316µs (11+306) within Moose::Meta::TypeConstraint::Registry::new which was called: # once (11µs+306µs) by Moose::Meta::Attribute::BEGIN@24 at line 61 of Moose/Util/TypeConstraints.pm sub new {
32 | 3 | 10µs |  |  | my $class = shift;
33 |  |  | 1 | 306µs | my $self = $class->_new(@_); # spent 306µs making 1 call to Class::MOP::Object::_new
34 |  |  |  |  | return $self;
35 |  |  |  |  | }
36 |  |  |  |  |
37 |  |  |  |  | # spent 407µs (285+123) within Moose::Meta::TypeConstraint::Registry::has_type_constraint which was called 50 times, avg 8µs/call: # 50 times (285µs+123µs) by Moose::Util::TypeConstraints::find_type_constraint at line 316 of Moose/Util/TypeConstraints.pm, avg 8µs/call sub has_type_constraint {
38 | 100 | 271µs |  |  | my ($self, $type_name) = @_;
39 |  |  | 50 | 123µs | ($type_name and exists $self->type_constraints->{$type_name}) ? 1 : 0 # spent 123µs making 50 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call
40 |  |  |  |  | }
41 |  |  |  |  |
42 |  |  |  |  | # spent 405µs (314+90) within Moose::Meta::TypeConstraint::Registry::get_type_constraint which was called 71 times, avg 6µs/call: # 38 times (156µs+42µs) by Moose::Util::TypeConstraints::find_type_constraint at line 317 of Moose/Util/TypeConstraints.pm, avg 5µs/call # 17 times (65µs+25µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 539 of Moose/Util/TypeConstraints.pm, avg 5µs/call # 8 times (56µs+13µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 166 of Moose/Util/TypeConstraints.pm, avg 9µs/call # 4 times (23µs+5µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 202 of Moose/Util/TypeConstraints.pm, avg 7µs/call # 4 times (13µs+4µs) by Moose::Meta::Attribute::BEGIN@24 at line 730 of Moose/Util/TypeConstraints.pm, avg 4µs/call sub get_type_constraint {
43 | 213 | 300µs |  |  | my ($self, $type_name) = @_;
44 |  |  |  |  | return unless defined $type_name;
45 |  |  | 71 | 90µs | $self->type_constraints->{$type_name} # spent 90µs making 71 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 1µs/call
46 |  |  |  |  | }
47 |  |  |  |  |
48 |  |  |  |  | # spent 708µs (499+209) within Moose::Meta::TypeConstraint::Registry::add_type_constraint which was called 33 times, avg 21µs/call: # 17 times (204µs+91µs) by Moose::Util::TypeConstraints::_create_type_constraint at line 578 of Moose/Util/TypeConstraints.pm, avg 17µs/call # 8 times (178µs+70µs) by Moose::Util::TypeConstraints::create_class_type_constraint at line 189 of Moose/Util/TypeConstraints.pm, avg 31µs/call # 4 times (70µs+27µs) by Moose::Util::TypeConstraints::create_role_type_constraint at line 225 of Moose/Util/TypeConstraints.pm, avg 24µs/call # once (14µs+6µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 185 of Moose/Util/TypeConstraints/Builtins.pm # once (11µs+5µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 281 of Moose/Util/TypeConstraints/Builtins.pm # once (11µs+5µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 220 of Moose/Util/TypeConstraints/Builtins.pm # once (11µs+5µs) by Moose::Util::TypeConstraints::Builtins::define_builtins at line 255 of Moose/Util/TypeConstraints/Builtins.pm sub add_type_constraint {
49 | 99 | 263µs |  |  | my ($self, $type) = @_;
50 |  |  |  |  |
51 | 1 | 227µs | 99 | 110µs | unless ( $type && blessed $type && $type->isa('Moose::Meta::TypeConstraint') ) { # spent 42µs making 33 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:16], avg 1µs/call # spent 35µs making 33 calls to UNIVERSAL::isa, avg 1µs/call # spent 33µs making 33 calls to Scalar::Util::blessed, avg 1µs/call
52 |  |  |  |  | require Moose;
53 |  |  |  |  | Moose->throw_error("No type supplied / type is not a valid type constraint");
54 |  |  |  |  | }
55 |  |  |  |  |
56 |  |  | 66 | 99µs | $self->type_constraints->{$type->name} = $type; # spent 54µs making 33 calls to Moose::Meta::TypeConstraint::Registry::type_constraints, avg 2µs/call # spent 45µs making 33 calls to Moose::Meta::TypeConstraint::name, avg 1µs/call
57 |  |  |  |  | }
58 |  |  |  |  |
59 |  |  |  |  | sub find_type_constraint {
60 |  |  |  |  | my ($self, $type_name) = @_;
61 |  |  |  |  | return $self->get_type_constraint($type_name)
62 |  |  |  |  | if $self->has_type_constraint($type_name);
63 |  |  |  |  | return $self->get_parent_registry->find_type_constraint($type_name)
64 |  |  |  |  | if $self->has_parent_registry;
65 |  |  |  |  | return;
66 |  |  |  |  | }
67 |  |  |  |  |
68 | 1 | 10µs |  |  | 1;
69 |  |  |  |  |
70 |  |  |  |  | # ABSTRACT: registry for type constraints
71 |  |  |  |  |
- - |  |  |  |  |
74 |  |  |  |  | =pod
75 |  |  |  |  |
76 |  |  |  |  | =head1 NAME
77 |  |  |  |  |
78 |  |  |  |  | Moose::Meta::TypeConstraint::Registry - registry for type constraints
79 |  |  |  |  |
80 |  |  |  |  | =head1 VERSION
81 |  |  |  |  |
82 |  |  |  |  | version 2.0602
83 |  |  |  |  |
84 |  |  |  |  | =head1 DESCRIPTION
85 |  |  |  |  |
86 |  |  |  |  | This class is a registry that maps type constraint names to
87 |  |  |  |  | L<Moose::Meta::TypeConstraint> objects.
88 |  |  |  |  |
89 |  |  |  |  | Currently, it is only used internally by
90 |  |  |  |  | L<Moose::Util::TypeConstraints>, which creates a single global
91 |  |  |  |  | registry.
92 |  |  |  |  |
93 |  |  |  |  | =head1 INHERITANCE
94 |  |  |  |  |
95 |  |  |  |  | C<Moose::Meta::TypeConstraint::Registry> is a subclass of
96 |  |  |  |  | L<Class::MOP::Object>.
97 |  |  |  |  |
98 |  |  |  |  | =head1 METHODS
99 |  |  |  |  |
100 |  |  |  |  | =over 4
101 |  |  |  |  |
102 |  |  |  |  | =item B<< Moose::Meta::TypeConstraint::Registry->new(%options) >>
103 |  |  |  |  |
104 |  |  |  |  | This creates a new registry object based on the provided C<%options>:
105 |  |  |  |  |
106 |  |  |  |  | =over 8
107 |  |  |  |  |
108 |  |  |  |  | =item * parent_registry
109 |  |  |  |  |
110 |  |  |  |  | This is an optional L<Moose::Meta::TypeConstraint::Registry>
111 |  |  |  |  | object.
112 |  |  |  |  |
113 |  |  |  |  | =item * type_constraints
114 |  |  |  |  |
115 |  |  |  |  | This is hash reference of type names to type objects. This is
116 |  |  |  |  | optional. Constraints can be added to the registry after it is
117 |  |  |  |  | created.
118 |  |  |  |  |
119 |  |  |  |  | =back
120 |  |  |  |  |
121 |  |  |  |  | =item B<< $registry->get_parent_registry >>
122 |  |  |  |  |
123 |  |  |  |  | Returns the registry's parent registry, if it has one.
124 |  |  |  |  |
125 |  |  |  |  | =item B<< $registry->has_parent_registry >>
126 |  |  |  |  |
127 |  |  |  |  | Returns true if the registry has a parent.
128 |  |  |  |  |
129 |  |  |  |  | =item B<< $registry->set_parent_registry($registry) >>
130 |  |  |  |  |
131 |  |  |  |  | Sets the parent registry.
132 |  |  |  |  |
133 |  |  |  |  | =item B<< $registry->get_type_constraint($type_name) >>
134 |  |  |  |  |
135 |  |  |  |  | This returns the L<Moose::Meta::TypeConstraint> object from the
136 |  |  |  |  | registry for the given name, if one exists.
137 |  |  |  |  |
138 |  |  |  |  | =item B<< $registry->has_type_constraint($type_name) >>
139 |  |  |  |  |
140 |  |  |  |  | Returns true if the registry has a type of the given name.
141 |  |  |  |  |
142 |  |  |  |  | =item B<< $registry->add_type_constraint($type) >>
143 |  |  |  |  |
144 |  |  |  |  | Adds a new L<Moose::Meta::TypeConstraint> object to the registry.
145 |  |  |  |  |
146 |  |  |  |  | =item B<< $registry->find_type_constraint($type_name) >>
147 |  |  |  |  |
148 |  |  |  |  | This method looks in the current registry for the named type. If the
149 |  |  |  |  | type is not found, then this method will look in the registry's
150 |  |  |  |  | parent, if it has one.
151 |  |  |  |  |
152 |  |  |  |  | =back
153 |  |  |  |  |
154 |  |  |  |  | =head1 BUGS
155 |  |  |  |  |
156 |  |  |  |  | See L<Moose/BUGS> for details on reporting bugs.
157 |  |  |  |  |
158 |  |  |  |  | =head1 AUTHOR
159 |  |  |  |  |
160 |  |  |  |  | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
161 |  |  |  |  |
162 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
163 |  |  |  |  |
164 |  |  |  |  | This software is copyright (c) 2012 by Infinity Interactive, Inc..
165 |  |  |  |  |
166 |  |  |  |  | This is free software; you can redistribute it and/or modify it under
167 |  |  |  |  | the same terms as the Perl 5 programming language system itself.
168 |  |  |  |  |
169 |  |  |  |  | =cut
170 |  |  |  |  |
171 |  |  |  |  |
172 |  |  |  |  | __END__