| Filename | /home/doy/coding/src/Class-MOP/blib/lib//metaclass.pm |
| Statements | Executed 243 statements in 3.85ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 20 | 20 | 20 | 2.13ms | 69.9ms | metaclass::import |
| 1 | 1 | 1 | 75µs | 92µs | metaclass::BEGIN@4 |
| 1 | 1 | 1 | 38µs | 194µs | metaclass::BEGIN@7 |
| 1 | 1 | 1 | 38µs | 101µs | metaclass::BEGIN@5 |
| 1 | 1 | 1 | 37µs | 211µs | metaclass::BEGIN@9 |
| 1 | 1 | 1 | 37µs | 191µs | metaclass::BEGIN@8 |
| 1 | 1 | 1 | 26µs | 26µs | metaclass::BEGIN@15 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package metaclass; | ||||
| 3 | |||||
| 4 | 3 | 104µs | 2 | 108µs | # spent 92µs (75+17) within metaclass::BEGIN@4 which was called:
# once (75µs+17µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 4 # spent 92µs making 1 call to metaclass::BEGIN@4
# spent 17µs making 1 call to strict::import |
| 5 | 3 | 101µs | 2 | 163µs | # spent 101µs (38+63) within metaclass::BEGIN@5 which was called:
# once (38µs+63µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 5 # spent 101µs making 1 call to metaclass::BEGIN@5
# spent 63µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 104µs | 2 | 350µs | # spent 194µs (38+156) within metaclass::BEGIN@7 which was called:
# once (38µs+156µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 7 # spent 194µs making 1 call to metaclass::BEGIN@7
# spent 156µs making 1 call to Exporter::import |
| 8 | 3 | 98µs | 2 | 344µs | # spent 191µs (37+154) within metaclass::BEGIN@8 which was called:
# once (37µs+154µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 8 # spent 191µs making 1 call to metaclass::BEGIN@8
# spent 154µs making 1 call to Exporter::import |
| 9 | 3 | 217µs | 2 | 385µs | # spent 211µs (37+174) within metaclass::BEGIN@9 which was called:
# once (37µs+174µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 9 # spent 211µs making 1 call to metaclass::BEGIN@9
# spent 174µs making 1 call to Exporter::import |
| 10 | |||||
| 11 | 1 | 4µs | our $VERSION = '1.11'; | ||
| 12 | 1 | 56µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 13 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 14 | |||||
| 15 | 3 | 677µs | 1 | 26µs | # spent 26µs within metaclass::BEGIN@15 which was called:
# once (26µs+0s) by Moose::Meta::TypeConstraint::BEGIN@6 at line 15 # spent 26µs making 1 call to metaclass::BEGIN@15 |
| 16 | |||||
| 17 | # spent 69.9ms (2.13+67.8) within metaclass::import which was called 20 times, avg 3.50ms/call:
# once (230µs+16.4ms) by Moose::Object::BEGIN@14 at line 15 of if.pm
# once (131µs+3.77ms) by Moose::Meta::TypeConstraint::Union::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Union.pm
# once (121µs+3.08ms) by Moose::Meta::TypeConstraint::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint.pm
# once (98µs+2.82ms) by Moose::Meta::Role::Composite::BEGIN@5 at line 5 of Moose/Meta/Role/Composite.pm
# once (96µs+2.81ms) by Moose::Meta::TypeCoercion::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion.pm
# once (95µs+2.73ms) by Moose::Meta::TypeConstraint::Class::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Class.pm
# once (98µs+2.65ms) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Parameterized.pm
# once (97µs+2.62ms) by Moose::Meta::TypeConstraint::Registry::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Registry.pm
# once (98µs+2.62ms) by Moose::Meta::Role::Application::BEGIN@5 at line 5 of Moose/Meta/Role/Application.pm
# once (98µs+2.61ms) by Moose::Meta::Role::Application::ToRole::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToRole.pm
# once (98µs+2.61ms) by Moose::Meta::Role::Method::Required::BEGIN@6 at line 6 of Moose/Meta/Role/Method/Required.pm
# once (97µs+2.61ms) by Moose::Meta::Role::Application::RoleSummation::BEGIN@5 at line 5 of Moose/Meta/Role/Application/RoleSummation.pm
# once (96µs+2.60ms) by Moose::Meta::TypeConstraint::Enum::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Enum.pm
# once (97µs+2.58ms) by Moose::Meta::Role::Application::ToClass::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToClass.pm
# once (95µs+2.58ms) by Moose::Meta::TypeCoercion::Union::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion/Union.pm
# once (99µs+2.57ms) by Moose::Meta::Role::BEGIN@6 at line 6 of Moose/Meta/Role.pm
# once (96µs+2.57ms) by Moose::Meta::TypeConstraint::Role::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Role.pm
# once (100µs+2.57ms) by Moose::Meta::Role::Application::ToInstance::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToInstance.pm
# once (95µs+2.57ms) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Parameterizable.pm
# once (99µs+2.49ms) by Moose::Meta::TypeConstraint::DuckType::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/DuckType.pm | ||||
| 18 | 20 | 123µs | my ( $class, @args ) = @_; | ||
| 19 | |||||
| 20 | 20 | 94µs | unshift @args, "metaclass" if @args % 2 == 1; | ||
| 21 | 20 | 86µs | my %options = @args; | ||
| 22 | |||||
| 23 | 20 | 80µs | my $meta_name = exists $options{meta_name} ? $options{meta_name} : 'meta'; | ||
| 24 | 20 | 77µs | my $metaclass = delete $options{metaclass}; | ||
| 25 | |||||
| 26 | 20 | 76µs | unless ( defined $metaclass ) { | ||
| 27 | $metaclass = "Class::MOP::Class"; | ||||
| 28 | } else { | ||||
| 29 | 1 | 15µs | 1 | 296µs | Class::MOP::load_class($metaclass); # spent 296µs making 1 call to Class::MOP::load_class |
| 30 | } | ||||
| 31 | |||||
| 32 | 20 | 634µs | 20 | 257µs | ($metaclass->isa('Class::MOP::Class')) # spent 257µs making 20 calls to UNIVERSAL::isa, avg 13µs/call |
| 33 | || confess "The metaclass ($metaclass) must be derived from Class::MOP::Class"; | ||||
| 34 | |||||
| 35 | # make sure the custom metaclasses get loaded | ||||
| 36 | 20 | 230µs | foreach my $key (grep { /_(?:meta)?class$/ } keys %options) { | ||
| 37 | unless ( ref( my $class = $options{$key} ) ) { | ||||
| 38 | Class::MOP::load_class($class) | ||||
| 39 | } | ||||
| 40 | } | ||||
| 41 | |||||
| 42 | 20 | 91µs | my $package = caller(); | ||
| 43 | |||||
| 44 | # create a meta object so we can install &meta | ||||
| 45 | 20 | 289µs | 20 | 17.8ms | my $meta = $metaclass->initialize($package => %options); # spent 8.98ms making 19 calls to Class::MOP::Class::initialize, avg 472µs/call
# spent 8.87ms making 1 call to Moose::Meta::Class::initialize |
| 46 | 20 | 683µs | 20 | 49.4ms | $meta->_add_meta_method($meta_name) # spent 49.4ms making 20 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 2.47ms/call |
| 47 | if defined $meta_name; | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | 1 | 12µs | 1; | ||
| 51 | |||||
| 52 | __END__ |