Filename | /opt/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level/metaclass.pm |
Statements | Executed 239 statements in 950µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
20 | 20 | 20 | 394µs | 11.9ms | import | metaclass::
1 | 1 | 1 | 10µs | 10µs | BEGIN@3 | metaclass::
1 | 1 | 1 | 10µs | 51µs | BEGIN@16 | metaclass::
1 | 1 | 1 | 10µs | 47µs | BEGIN@13 | metaclass::
1 | 1 | 1 | 9µs | 13µs | BEGIN@11 | metaclass::
1 | 1 | 1 | 9µs | 35µs | BEGIN@14 | metaclass::
1 | 1 | 1 | 8µs | 35µs | BEGIN@15 | metaclass::
1 | 1 | 1 | 8µs | 23µs | BEGIN@10 | metaclass::
1 | 1 | 1 | 5µs | 5µs | BEGIN@18 | metaclass::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | |||||
2 | package metaclass; | ||||
3 | # spent 10µs within metaclass::BEGIN@3 which was called:
# once (10µs+0s) by Moose::Meta::TypeConstraint::BEGIN@12 at line 5 | ||||
4 | 1 | 7µs | $metaclass::AUTHORITY = 'cpan:STEVAN'; | ||
5 | 1 | 39µs | 1 | 10µs | } # spent 10µs making 1 call to metaclass::BEGIN@3 |
6 | { | ||||
7 | 2 | 2µs | $metaclass::VERSION = '2.1005'; | ||
8 | } | ||||
9 | |||||
10 | 2 | 29µs | 2 | 38µs | # spent 23µs (8+15) within metaclass::BEGIN@10 which was called:
# once (8µs+15µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 10 # spent 23µs making 1 call to metaclass::BEGIN@10
# spent 15µs making 1 call to strict::import |
11 | 2 | 38µs | 2 | 18µs | # spent 13µs (9+4) within metaclass::BEGIN@11 which was called:
# once (9µs+4µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 11 # spent 13µs making 1 call to metaclass::BEGIN@11
# spent 4µs making 1 call to warnings::import |
12 | |||||
13 | 2 | 34µs | 2 | 85µs | # spent 47µs (10+38) within metaclass::BEGIN@13 which was called:
# once (10µs+38µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 13 # spent 47µs making 1 call to metaclass::BEGIN@13
# spent 38µs making 1 call to Exporter::import |
14 | 2 | 32µs | 2 | 60µs | # spent 35µs (9+26) within metaclass::BEGIN@14 which was called:
# once (9µs+26µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 14 # spent 35µs making 1 call to metaclass::BEGIN@14
# spent 26µs making 1 call to Exporter::import |
15 | 2 | 31µs | 2 | 61µs | # spent 35µs (8+26) within metaclass::BEGIN@15 which was called:
# once (8µs+26µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 15 # spent 35µs making 1 call to metaclass::BEGIN@15
# spent 26µs making 1 call to Exporter::import |
16 | 2 | 32µs | 2 | 92µs | # spent 51µs (10+41) within metaclass::BEGIN@16 which was called:
# once (10µs+41µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 16 # spent 51µs making 1 call to metaclass::BEGIN@16
# spent 41µs making 1 call to Exporter::import |
17 | |||||
18 | 2 | 257µs | 1 | 5µs | # spent 5µs within metaclass::BEGIN@18 which was called:
# once (5µs+0s) by Moose::Meta::TypeConstraint::BEGIN@12 at line 18 # spent 5µs making 1 call to metaclass::BEGIN@18 |
19 | |||||
20 | # spent 11.9ms (394µs+11.5) within metaclass::import which was called 20 times, avg 593µs/call:
# once (42µs+2.40ms) by Moose::Object::BEGIN@20 at line 15 of if.pm
# once (26µs+589µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint.pm
# once (19µs+485µs) by Moose::Meta::TypeConstraint::Union::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint/Union.pm
# once (18µs+485µs) by Moose::Meta::TypeCoercion::BEGIN@12 at line 12 of Moose/Meta/TypeCoercion.pm
# once (17µs+483µs) by Moose::Meta::Role::Application::BEGIN@11 at line 11 of Moose/Meta/Role/Application.pm
# once (18µs+479µs) by Moose::Meta::TypeConstraint::Class::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Class.pm
# once (18µs+477µs) by Moose::Meta::Role::BEGIN@11 at line 11 of Moose/Meta/Role.pm
# once (17µs+477µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (18µs+474µs) by Moose::Meta::Role::Application::ToClass::BEGIN@11 at line 11 of Moose/Meta/Role/Application/ToClass.pm
# once (18µs+474µs) by Moose::Meta::Role::Application::ToInstance::BEGIN@11 at line 11 of Moose/Meta/Role/Application/ToInstance.pm
# once (18µs+473µs) by Moose::Meta::TypeConstraint::Enum::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Enum.pm
# once (23µs+466µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint/Registry.pm
# once (18µs+470µs) by Moose::Meta::TypeCoercion::Union::BEGIN@12 at line 12 of Moose/Meta/TypeCoercion/Union.pm
# once (18µs+469µs) by Moose::Meta::Role::Method::Required::BEGIN@12 at line 12 of Moose/Meta/Role/Method/Required.pm
# once (18µs+468µs) by Moose::Meta::TypeConstraint::Role::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Role.pm
# once (17µs+468µs) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (19µs+462µs) by Moose::Meta::Role::Composite::BEGIN@11 at line 11 of Moose/Meta/Role/Composite.pm
# once (18µs+462µs) by Moose::Meta::Role::Application::ToRole::BEGIN@11 at line 11 of Moose/Meta/Role/Application/ToRole.pm
# once (17µs+454µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@11 at line 11 of Moose/Meta/Role/Application/RoleSummation.pm
# once (18µs+451µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/DuckType.pm | ||||
21 | 20 | 18µs | my ( $class, @args ) = @_; | ||
22 | |||||
23 | 20 | 20µs | unshift @args, "metaclass" if @args % 2 == 1; | ||
24 | 20 | 11µs | my %options = @args; | ||
25 | |||||
26 | 20 | 12µs | my $meta_name = exists $options{meta_name} ? $options{meta_name} : 'meta'; | ||
27 | 20 | 9µs | my $metaclass = delete $options{metaclass}; | ||
28 | |||||
29 | 20 | 9µs | unless ( defined $metaclass ) { | ||
30 | $metaclass = "Class::MOP::Class"; | ||||
31 | } else { | ||||
32 | 1 | 2µs | 1 | 71µs | load_class($metaclass); # spent 71µs making 1 call to Class::Load::load_class |
33 | } | ||||
34 | |||||
35 | 20 | 131µs | 20 | 43µs | ($metaclass->isa('Class::MOP::Class')) # spent 43µs making 20 calls to UNIVERSAL::isa, avg 2µs/call |
36 | || confess "The metaclass ($metaclass) must be derived from Class::MOP::Class"; | ||||
37 | |||||
38 | # make sure the custom metaclasses get loaded | ||||
39 | 20 | 37µs | foreach my $key (grep { /_(?:meta)?class$/ } keys %options) { | ||
40 | unless ( ref( my $class = $options{$key} ) ) { | ||||
41 | load_class($class) | ||||
42 | } | ||||
43 | } | ||||
44 | |||||
45 | 20 | 14µs | my $package = caller(); | ||
46 | |||||
47 | # create a meta object so we can install &meta | ||||
48 | 20 | 35µs | 20 | 2.63ms | my $meta = $metaclass->initialize($package => %options); # spent 1.58ms making 19 calls to Class::MOP::Class::initialize, avg 83µs/call
# spent 1.05ms making 1 call to Moose::Meta::Class::initialize |
49 | 20 | 148µs | 20 | 8.73ms | $meta->_add_meta_method($meta_name) # spent 8.73ms making 20 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 436µs/call |
50 | if defined $meta_name; | ||||
51 | } | ||||
52 | |||||
53 | 1 | 4µs | 1; | ||
54 | |||||
55 | # ABSTRACT: a pragma for installing and using Class::MOP metaclasses | ||||
56 | |||||
57 | __END__ |