Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/x86_64-linux/metaclass.pm |
Statements | Executed 231 statements in 538µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
20 | 20 | 20 | 314µs | 12.5ms | import | metaclass::
1 | 1 | 1 | 7µs | 8µs | BEGIN@4 | metaclass::
1 | 1 | 1 | 4µs | 19µs | BEGIN@7 | metaclass::
1 | 1 | 1 | 3µs | 6µs | BEGIN@5 | metaclass::
1 | 1 | 1 | 2µs | 2µs | BEGIN@8 | metaclass::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package metaclass; | ||||
2 | 1 | 300ns | our $VERSION = '2.1605'; | ||
3 | |||||
4 | 2 | 12µs | 2 | 10µs | # spent 8µs (7+1) within metaclass::BEGIN@4 which was called:
# once (7µs+1µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 4 # spent 8µs making 1 call to metaclass::BEGIN@4
# spent 1µs making 1 call to strict::import |
5 | 2 | 13µs | 2 | 8µs | # spent 6µs (3+2) within metaclass::BEGIN@5 which was called:
# once (3µs+2µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 5 # spent 6µs making 1 call to metaclass::BEGIN@5
# spent 2µs making 1 call to warnings::import |
6 | |||||
7 | 2 | 16µs | 2 | 33µs | # spent 19µs (4+14) within metaclass::BEGIN@7 which was called:
# once (4µs+14µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 7 # spent 19µs making 1 call to metaclass::BEGIN@7
# spent 14µs making 1 call to Module::Runtime::import |
8 | 2 | 141µs | 1 | 2µs | # spent 2µs within metaclass::BEGIN@8 which was called:
# once (2µs+0s) by Moose::Meta::TypeConstraint::BEGIN@6 at line 8 # spent 2µs making 1 call to metaclass::BEGIN@8 |
9 | |||||
10 | # spent 12.5ms (314µs+12.2) within metaclass::import which was called 20 times, avg 627µs/call:
# once (26µs+6.04ms) by Moose::Object::BEGIN@16 at line 15 of if.pm
# once (29µs+530µs) by Moose::Meta::TypeConstraint::Union::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Union.pm
# once (42µs+508µs) by Moose::Meta::TypeConstraint::Class::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Class.pm
# once (16µs+387µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (15µs+382µs) by Moose::Meta::TypeCoercion::Union::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion/Union.pm
# once (12µs+381µs) by Moose::Meta::TypeCoercion::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion.pm
# once (14µs+374µs) by Moose::Meta::Role::Application::BEGIN@6 at line 6 of Moose/Meta/Role/Application.pm
# once (14µs+359µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint.pm
# once (15µs+348µs) by Moose::Meta::Role::Composite::BEGIN@6 at line 6 of Moose/Meta/Role/Composite.pm
# once (15µs+318µs) by Moose::Meta::Role::BEGIN@6 at line 6 of Moose/Meta/Role.pm
# once (9µs+320µs) by Moose::Meta::Role::Application::ToRole::BEGIN@6 at line 6 of Moose/Meta/Role/Application/ToRole.pm
# once (27µs+299µs) by Moose::Meta::TypeConstraint::Role::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Role.pm
# once (10µs+267µs) by Moose::Meta::Role::Application::ToClass::BEGIN@6 at line 6 of Moose/Meta/Role/Application/ToClass.pm
# once (10µs+263µs) by Moose::Meta::Role::Method::Required::BEGIN@6 at line 6 of Moose/Meta/Role/Method/Required.pm
# once (11µs+262µs) by Moose::Meta::TypeConstraint::Enum::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Enum.pm
# once (10µs+245µs) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (10µs+244µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@6 at line 6 of Moose/Meta/Role/Application/RoleSummation.pm
# once (9µs+234µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/DuckType.pm
# once (10µs+232µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Registry.pm
# once (9µs+231µs) by Moose::Meta::Role::Application::ToInstance::BEGIN@6 at line 6 of Moose/Meta/Role/Application/ToInstance.pm | ||||
11 | 20 | 18µs | my ( $class, @args ) = @_; | ||
12 | |||||
13 | 20 | 13µs | unshift @args, "metaclass" if @args % 2 == 1; | ||
14 | 20 | 14µs | my %options = @args; | ||
15 | |||||
16 | 20 | 14µs | my $meta_name = exists $options{meta_name} ? $options{meta_name} : 'meta'; | ||
17 | 20 | 10µs | my $metaclass = delete $options{metaclass}; | ||
18 | |||||
19 | 20 | 13µs | unless ( defined $metaclass ) { | ||
20 | $metaclass = "Class::MOP::Class"; | ||||
21 | } else { | ||||
22 | 1 | 1µs | 1 | 27µs | use_package_optimistically($metaclass); # spent 27µs making 1 call to Module::Runtime::use_package_optimistically |
23 | } | ||||
24 | |||||
25 | 20 | 71µs | 20 | 16µs | ($metaclass->isa('Class::MOP::Class')) # spent 16µs making 20 calls to UNIVERSAL::isa, avg 825ns/call |
26 | || die use_module('Moose::Exception::MetaclassMustBeDerivedFromClassMOPClass')->new( class_name => $metaclass ); | ||||
27 | |||||
28 | # make sure the custom metaclasses get loaded | ||||
29 | 20 | 28µs | foreach my $key (grep { /_(?:meta)?class$/ } keys %options) { | ||
30 | unless ( ref( my $class = $options{$key} ) ) { | ||||
31 | use_package_optimistically($class) | ||||
32 | } | ||||
33 | } | ||||
34 | |||||
35 | 20 | 13µs | my $package = caller(); | ||
36 | |||||
37 | # create a meta object so we can install &meta | ||||
38 | 20 | 35µs | 20 | 1.72ms | my $meta = $metaclass->initialize($package => %options); # spent 1.23ms making 19 calls to Class::MOP::Class::initialize, avg 65µs/call
# spent 493µs making 1 call to Moose::Meta::Class::initialize |
39 | 20 | 124µs | 20 | 10.5ms | $meta->_add_meta_method($meta_name) # spent 10.5ms making 20 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 523µs/call |
40 | if defined $meta_name; | ||||
41 | } | ||||
42 | |||||
43 | 1 | 2µs | 1; | ||
44 | |||||
45 | # ABSTRACT: a pragma for installing and using Class::MOP metaclasses | ||||
46 | |||||
47 | __END__ |