← 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
StatementsExecuted 437 statements in 1.51ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3372499µs708µsMoose::Meta::TypeConstraint::Registry::::add_type_constraintMoose::Meta::TypeConstraint::Registry::add_type_constraint
7151314µs405µsMoose::Meta::TypeConstraint::Registry::::get_type_constraintMoose::Meta::TypeConstraint::Registry::get_type_constraint
5011285µs407µsMoose::Meta::TypeConstraint::Registry::::has_type_constraintMoose::Meta::TypeConstraint::Registry::has_type_constraint
11111µs316µsMoose::Meta::TypeConstraint::Registry::::newMoose::Meta::TypeConstraint::Registry::new
11110µs10µsMoose::Meta::TypeConstraint::Registry::::BEGIN@3Moose::Meta::TypeConstraint::Registry::BEGIN@3
1119µs56µsMoose::Meta::TypeConstraint::Registry::::BEGIN@14Moose::Meta::TypeConstraint::Registry::BEGIN@14
1118µs13µsMoose::Meta::TypeConstraint::Registry::::BEGIN@10Moose::Meta::TypeConstraint::Registry::BEGIN@10
1118µs24µsMoose::Meta::TypeConstraint::Registry::::BEGIN@11Moose::Meta::TypeConstraint::Registry::BEGIN@11
1118µs570µsMoose::Meta::TypeConstraint::Registry::::BEGIN@12Moose::Meta::TypeConstraint::Registry::BEGIN@12
1118µs87µsMoose::Meta::TypeConstraint::Registry::::BEGIN@16Moose::Meta::TypeConstraint::Registry::BEGIN@16
1112µs2µsMoose::Meta::TypeConstraint::Registry::::__ANON__[:27]Moose::Meta::TypeConstraint::Registry::__ANON__[:27]
0000s0sMoose::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
2package 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 {
418µs $Moose::Meta::TypeConstraint::Registry::AUTHORITY = 'cpan:STEVAN';
5123µs110µs}
# spent 10µs making 1 call to Moose::Meta::TypeConstraint::Registry::BEGIN@3
6{
721µs $Moose::Meta::TypeConstraint::Registry::VERSION = '2.0602';
8}
9
10318µs218µ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
11318µs240µ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
12328µs21.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
14322µs2103µ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
163292µs2166µ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
1816µs3783µ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',
2714µ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 { {} },
2816µs3304µ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 {
32310µs my $class = shift;
331306µ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 {
38100271µs my ($self, $type_name) = @_;
3950123µ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 {
43213300µs my ($self, $type_name) = @_;
44 return unless defined $type_name;
457190µ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 {
4999263µs my ($self, $type) = @_;
50
511227µs99110µ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
566699µ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
59sub 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
68110µs1;
69
70# ABSTRACT: registry for type constraints
71
- -
74=pod
75
76=head1 NAME
77
78Moose::Meta::TypeConstraint::Registry - registry for type constraints
79
80=head1 VERSION
81
82version 2.0602
83
84=head1 DESCRIPTION
85
86This class is a registry that maps type constraint names to
87L<Moose::Meta::TypeConstraint> objects.
88
89Currently, it is only used internally by
90L<Moose::Util::TypeConstraints>, which creates a single global
91registry.
92
93=head1 INHERITANCE
94
95C<Moose::Meta::TypeConstraint::Registry> is a subclass of
96L<Class::MOP::Object>.
97
98=head1 METHODS
99
100=over 4
101
102=item B<< Moose::Meta::TypeConstraint::Registry->new(%options) >>
103
104This creates a new registry object based on the provided C<%options>:
105
106=over 8
107
108=item * parent_registry
109
110This is an optional L<Moose::Meta::TypeConstraint::Registry>
111object.
112
113=item * type_constraints
114
115This is hash reference of type names to type objects. This is
116optional. Constraints can be added to the registry after it is
117created.
118
119=back
120
121=item B<< $registry->get_parent_registry >>
122
123Returns the registry's parent registry, if it has one.
124
125=item B<< $registry->has_parent_registry >>
126
127Returns true if the registry has a parent.
128
129=item B<< $registry->set_parent_registry($registry) >>
130
131Sets the parent registry.
132
133=item B<< $registry->get_type_constraint($type_name) >>
134
135This returns the L<Moose::Meta::TypeConstraint> object from the
136registry for the given name, if one exists.
137
138=item B<< $registry->has_type_constraint($type_name) >>
139
140Returns true if the registry has a type of the given name.
141
142=item B<< $registry->add_type_constraint($type) >>
143
144Adds a new L<Moose::Meta::TypeConstraint> object to the registry.
145
146=item B<< $registry->find_type_constraint($type_name) >>
147
148This method looks in the current registry for the named type. If the
149type is not found, then this method will look in the registry's
150parent, if it has one.
151
152=back
153
154=head1 BUGS
155
156See L<Moose/BUGS> for details on reporting bugs.
157
158=head1 AUTHOR
159
160Moose 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
164This software is copyright (c) 2012 by Infinity Interactive, Inc..
165
166This is free software; you can redistribute it and/or modify it under
167the same terms as the Perl 5 programming language system itself.
168
169=cut
170
171
172__END__