Profile of metaclass.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/metaclass.pm
Statements | Executed 246 statements in 931µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
20 | 20 | 20 | 481µs | 13.4ms | metaclass::::importmetaclass::import
1 | 1 | 1 | 8µs | 52µs | metaclass::::BEGIN@13metaclass::BEGIN@13
1 | 1 | 1 | 8µs | 8µs | metaclass::::BEGIN@3metaclass::BEGIN@3
1 | 1 | 1 | 8µs | 28µs | metaclass::::BEGIN@14metaclass::BEGIN@14
1 | 1 | 1 | 7µs | 30µs | metaclass::::BEGIN@15metaclass::BEGIN@15
1 | 1 | 1 | 7µs | 35µs | metaclass::::BEGIN@16metaclass::BEGIN@16
1 | 1 | 1 | 7µs | 9µs | metaclass::::BEGIN@10metaclass::BEGIN@10
1 | 1 | 1 | 6µs | 13µs | metaclass::::BEGIN@11metaclass::BEGIN@11
1 | 1 | 1 | 5µs | 5µs | metaclass::::BEGIN@18metaclass::BEGIN@18

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 metaclass;
3 |  |  |  |  | # spent 8µs within metaclass::BEGIN@3 which was called: # once (8µs+0s) by Moose::Meta::TypeConstraint::BEGIN@12 at line 5 BEGIN {
4 | 1 | 4µs |  |  | $metaclass::AUTHORITY = 'cpan:STEVAN';
5 | 1 | 20µs | 1 | 8µs | } # spent 8µs making 1 call to metaclass::BEGIN@3
6 |  |  |  |  | {
7 | 2 | 1µs |  |  | $metaclass::VERSION = '2.0602';
8 |  |  |  |  | }
9 |  |  |  |  |
10 | 3 | 15µs | 2 | 11µs | # spent 9µs (7+2) within metaclass::BEGIN@10 which was called: # once (7µs+2µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 10 use strict; # spent 9µs making 1 call to metaclass::BEGIN@10 # spent 2µs making 1 call to strict::import
11 | 3 | 17µs | 2 | 20µs | # spent 13µs (6+7) within metaclass::BEGIN@11 which was called: # once (6µs+7µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 11 use warnings; # spent 13µs making 1 call to metaclass::BEGIN@11 # spent 7µs making 1 call to warnings::import
12 |  |  |  |  |
13 | 3 | 22µs | 2 | 95µs | # spent 52µs (8+43) within metaclass::BEGIN@13 which was called: # once (8µs+43µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 13 use Carp 'confess'; # spent 52µs making 1 call to metaclass::BEGIN@13 # spent 43µs making 1 call to Exporter::import
14 | 3 | 18µs | 2 | 48µs | # spent 28µs (8+20) within metaclass::BEGIN@14 which was called: # once (8µs+20µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 14 use Class::Load 'load_class'; # spent 28µs making 1 call to metaclass::BEGIN@14 # spent 20µs making 1 call to Exporter::import
15 | 3 | 17µs | 2 | 53µs | # spent 30µs (7+23) within metaclass::BEGIN@15 which was called: # once (7µs+23µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 15 use Scalar::Util 'blessed'; # spent 30µs making 1 call to metaclass::BEGIN@15 # spent 23µs making 1 call to Exporter::import
16 | 3 | 17µs | 2 | 64µs | # spent 35µs (7+28) within metaclass::BEGIN@16 which was called: # once (7µs+28µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 16 use Try::Tiny; # spent 35µs making 1 call to metaclass::BEGIN@16 # spent 28µs making 1 call to Exporter::import
17 |  |  |  |  |
18 | 3 | 258µ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 use Class::MOP; # spent 5µs making 1 call to metaclass::BEGIN@18
19 |  |  |  |  |
20 |  |  |  |  | # spent 13.4ms (481µs+12.9) within metaclass::import which was called 20 times, avg 670µs/call: # once (45µs+2.39ms) by Moose::Object::BEGIN@20 at line 15 of if.pm # once (22µs+659µs) by Moose::Meta::TypeConstraint::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint.pm # once (23µs+655µs) by Moose::Meta::TypeCoercion::BEGIN@12 at line 12 of Moose/Meta/TypeCoercion.pm # once (26µs+647µs) by Moose::Meta::Role::Composite::BEGIN@11 at line 11 of Moose/Meta/Role/Composite.pm # once (26µs+598µs) by Moose::Meta::TypeConstraint::Union::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint/Union.pm # once (24µs+594µs) by Moose::Meta::Role::Application::BEGIN@11 at line 11 of Moose/Meta/Role/Application.pm # once (23µs+569µs) by Moose::Meta::TypeConstraint::Class::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Class.pm # once (25µs+561µs) by Moose::Meta::Role::Method::Required::BEGIN@12 at line 12 of Moose/Meta/Role/Method/Required.pm # once (26µs+556µs) by Moose::Meta::Role::BEGIN@11 at line 11 of Moose/Meta/Role.pm # once (25µs+546µs) by Moose::Meta::Role::Application::ToRole::BEGIN@11 at line 11 of Moose/Meta/Role/Application/ToRole.pm # once (24µs+545µs) by Moose::Meta::Role::Application::ToClass::BEGIN@11 at line 11 of Moose/Meta/Role/Application/ToClass.pm # once (23µs+540µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Parameterized.pm # once (24µs+539µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@12 at line 12 of Moose/Meta/TypeConstraint/Registry.pm # once (23µs+538µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@11 at line 11 of Moose/Meta/Role/Application/RoleSummation.pm # once (22µs+536µs) by Moose::Meta::Role::Application::ToInstance::BEGIN@11 at line 11 of Moose/Meta/Role/Application/ToInstance.pm # once (23µs+529µs) by Moose::Meta::TypeConstraint::Enum::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Enum.pm # once (23µs+527µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/DuckType.pm # once (23µs+524µs) by Moose::Meta::TypeConstraint::Role::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Role.pm # once (16µs+438µs) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@11 at line 11 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (16µs+431µs) by Moose::Meta::TypeCoercion::Union::BEGIN@12 at line 12 of Moose/Meta/TypeCoercion/Union.pm sub import {
21 | 221 | 539µs |  |  | my ( $class, @args ) = @_;
22 |  |  |  |  |
23 |  |  |  |  | unshift @args, "metaclass" if @args % 2 == 1;
24 |  |  |  |  | my %options = @args;
25 |  |  |  |  |
26 |  |  |  |  | my $meta_name = exists $options{meta_name} ? $options{meta_name} : 'meta';
27 |  |  |  |  | my $metaclass = delete $options{metaclass};
28 |  |  |  |  |
29 |  |  |  |  | unless ( defined $metaclass ) {
30 |  |  |  |  | $metaclass = "Class::MOP::Class";
31 |  |  |  |  | } else {
32 |  |  | 1 | 38µs | load_class($metaclass); # spent 38µs making 1 call to Class::Load::load_class
33 |  |  |  |  | }
34 |  |  |  |  |
35 |  |  | 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 |  |  |  |  | foreach my $key (grep { /_(?:meta)?class$/ } keys %options) {
40 |  |  |  |  | unless ( ref( my $class = $options{$key} ) ) {
41 |  |  |  |  | load_class($class)
42 |  |  |  |  | }
43 |  |  |  |  | }
44 |  |  |  |  |
45 |  |  |  |  | my $package = caller();
46 |  |  |  |  |
47 |  |  |  |  | # create a meta object so we can install &meta
48 |  |  | 20 | 3.20ms | my $meta = $metaclass->initialize($package => %options); # spent 2.15ms making 19 calls to Class::MOP::Class::initialize, avg 113µs/call # spent 1.05ms making 1 call to Moose::Meta::Class::initialize
49 |  |  | 20 | 9.63ms | $meta->_add_meta_method($meta_name) # spent 9.63ms making 20 calls to Class::MOP::Mixin::HasMethods::_add_meta_method, avg 482µs/call
50 |  |  |  |  | if defined $meta_name;
51 |  |  |  |  | }
52 |  |  |  |  |
53 | 1 | 3µs |  |  | 1;
54 |  |  |  |  |
55 |  |  |  |  | # ABSTRACT: a pragma for installing and using Class::MOP metaclasses
56 |  |  |  |  |
- - |  |  |  |  |
59 |  |  |  |  | =pod
60 |  |  |  |  |
61 |  |  |  |  | =head1 NAME
62 |  |  |  |  |
63 |  |  |  |  | metaclass - a pragma for installing and using Class::MOP metaclasses
64 |  |  |  |  |
65 |  |  |  |  | =head1 VERSION
66 |  |  |  |  |
67 |  |  |  |  | version 2.0602
68 |  |  |  |  |
69 |  |  |  |  | =head1 SYNOPSIS
70 |  |  |  |  |
71 |  |  |  |  | package MyClass;
72 |  |  |  |  |
73 |  |  |  |  | # use Class::MOP::Class
74 |  |  |  |  | use metaclass;
75 |  |  |  |  |
76 |  |  |  |  | # ... or use a custom metaclass
77 |  |  |  |  | use metaclass 'MyMetaClass';
78 |  |  |  |  |
79 |  |  |  |  | # ... or use a custom metaclass
80 |  |  |  |  | # and custom attribute and method
81 |  |  |  |  | # metaclasses
82 |  |  |  |  | use metaclass 'MyMetaClass' => (
83 |  |  |  |  | 'attribute_metaclass' => 'MyAttributeMetaClass',
84 |  |  |  |  | 'method_metaclass' => 'MyMethodMetaClass',
85 |  |  |  |  | );
86 |  |  |  |  |
87 |  |  |  |  | # ... or just specify custom attribute
88 |  |  |  |  | # and method classes, and Class::MOP::Class
89 |  |  |  |  | # is the assumed metaclass
90 |  |  |  |  | use metaclass (
91 |  |  |  |  | 'attribute_metaclass' => 'MyAttributeMetaClass',
92 |  |  |  |  | 'method_metaclass' => 'MyMethodMetaClass',
93 |  |  |  |  | );
94 |  |  |  |  |
95 |  |  |  |  | # if we'd rather not install a 'meta' method, we can do this
96 |  |  |  |  | use metaclass meta_name => undef;
97 |  |  |  |  | # or if we'd like it to have a different name,
98 |  |  |  |  | use metaclass meta_name => 'my_meta';
99 |  |  |  |  |
100 |  |  |  |  | =head1 DESCRIPTION
101 |  |  |  |  |
102 |  |  |  |  | This is a pragma to make it easier to use a specific metaclass
103 |  |  |  |  | and a set of custom attribute and method metaclasses. It also
104 |  |  |  |  | installs a C<meta> method to your class as well, unless C<undef>
105 |  |  |  |  | is passed to the C<meta_name> option.
106 |  |  |  |  |
107 |  |  |  |  | Note that if you are using Moose, you most likely do B<not> want
108 |  |  |  |  | to be using this - look into L<Moose::Util::MetaRole> instead.
109 |  |  |  |  |
110 |  |  |  |  | =head1 AUTHOR
111 |  |  |  |  |
112 |  |  |  |  | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
113 |  |  |  |  |
114 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
115 |  |  |  |  |
116 |  |  |  |  | This software is copyright (c) 2012 by Infinity Interactive, Inc..
117 |  |  |  |  |
118 |  |  |  |  | This is free software; you can redistribute it and/or modify it under
119 |  |  |  |  | the same terms as the Perl 5 programming language system itself.
120 |  |  |  |  |
121 |  |  |  |  | =cut
122 |  |  |  |  |
123 |  |  |  |  |
124 |  |  |  |  | __END__