← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/bin/epoll_server.pl
  Run on Wed Jan 5 05:34:33 2011
Reported on Wed Jan 5 05:38:05 2011

File /usr/lib/perl5/vendor_perl/5.10.1/i386-linux-thread-multi/metaclass.pm
Statements Executed 275
Statement Execution Time 6.08ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2020201.83ms20.8msmetaclass::::importmetaclass::import
11152µs64µsmetaclass::::BEGIN@4metaclass::BEGIN@4
11132µs150µsmetaclass::::BEGIN@7metaclass::BEGIN@7
11131µs197µsmetaclass::::BEGIN@5metaclass::BEGIN@5
11130µs130µsmetaclass::::BEGIN@8metaclass::BEGIN@8
11120µs20µsmetaclass::::BEGIN@14metaclass::BEGIN@14
0000s0smetaclass::::__ANON__[:51]metaclass::__ANON__[:51]
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package metaclass;
3
4382µs276µs
# spent 64µs (52+12) within metaclass::BEGIN@4 which was called # once (52µs+12µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 4
use strict;
# spent 64µs making 1 call to metaclass::BEGIN@4 # spent 12µs making 1 call to strict::import
53274µs2363µs
# spent 197µs (31+166) within metaclass::BEGIN@5 which was called # once (31µs+166µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 5
use warnings;
# spent 197µs making 1 call to metaclass::BEGIN@5 # spent 166µs making 1 call to warnings::import
6
73128µs2269µs
# spent 150µs (32+119) within metaclass::BEGIN@7 which was called # once (32µs+119µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 7
use Carp 'confess';
# spent 150µs making 1 call to metaclass::BEGIN@7 # spent 119µs making 1 call to Exporter::import
83217µs2231µs
# spent 130µs (30+101) within metaclass::BEGIN@8 which was called # once (30µs+101µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 8
use Scalar::Util 'blessed';
# spent 130µs making 1 call to metaclass::BEGIN@8 # spent 101µs making 1 call to Exporter::import
9
1013µsour $VERSION = '1.00';
11149µs$VERSION = eval $VERSION;
1212µsour $AUTHORITY = 'cpan:STEVAN';
13
143730µs120µs
# spent 20µs within metaclass::BEGIN@14 which was called # once (20µs+0s) by Moose::Meta::TypeConstraint::BEGIN@6 at line 14
use Class::MOP;
# spent 20µs making 1 call to metaclass::BEGIN@14
15
16
# spent 20.8ms (1.83+19.0) within metaclass::import which was called 20 times, avg 1.04ms/call: # once (132µs+6.94ms) by Moose::Object::BEGIN@13 at line 15 of if.pm # once (116µs+1.80ms) by Moose::Meta::Role::Application::ToInstance::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToInstance.pm # once (77µs+1.51ms) by Moose::Meta::Role::BEGIN@6 at line 6 of Moose/Meta/Role.pm # once (88µs+811µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint.pm # once (173µs+678µs) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (71µs+581µs) by Moose::Meta::TypeConstraint::Enum::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Enum.pm # once (121µs+515µs) by Moose::Meta::Role::Composite::BEGIN@5 at line 5 of Moose/Meta/Role/Composite.pm # once (80µs+545µs) by Moose::Meta::TypeCoercion::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion.pm # once (73µs+552µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Parameterized.pm # once (136µs+468µs) by Moose::Meta::TypeConstraint::Class::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Class.pm # once (82µs+511µs) by Moose::Meta::TypeConstraint::Union::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Union.pm # once (85µs+505µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Registry.pm # once (65µs+525µs) by Moose::Meta::TypeCoercion::Union::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion/Union.pm # once (71µs+510µs) by Moose::Meta::Role::Application::ToRole::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToRole.pm # once (81µs+491µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@5 at line 5 of Moose/Meta/Role/Application/RoleSummation.pm # once (117µs+443µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/DuckType.pm # once (75µs+481µs) by Moose::Meta::Role::Application::ToClass::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToClass.pm # once (72µs+464µs) by Moose::Meta::Role::Application::BEGIN@5 at line 5 of Moose/Meta/Role/Application.pm # once (76µs+412µs) by Moose::Meta::TypeConstraint::Role::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Role.pm # once (39µs+227µs) by Moose::Meta::Role::Method::Required::BEGIN@6 at line 6 of Moose/Meta/Role/Method/Required.pm
sub import {
172002.02ms my ( $class, @args ) = @_;
18
19 unshift @args, "metaclass" if @args % 2 == 1;
20 my %options = @args;
21
22 my $metaclass = delete $options{metaclass};
23
2419µs unless ( defined $metaclass ) {
25 $metaclass = "Class::MOP::Class";
26 } else {
27 Class::MOP::load_class($metaclass);
# spent 209µs making 1 call to Class::MOP::load_class
28 }
29
30 ($metaclass->isa('Class::MOP::Class'))
# spent 199µs making 20 calls to UNIVERSAL::isa, avg 10µs/call
31 || confess "The metaclass ($metaclass) must be derived from Class::MOP::Class";
32
33 # make sure the custom metaclasses get loaded
34 foreach my $key (grep { /_(?:meta)?class$/ } keys %options) {
35 unless ( ref( my $class = $options{$key} ) ) {
36 Class::MOP::load_class($class)
37 }
38 }
39
40 my $package = caller();
41
42 # create a meta object so we can install &meta
43 my $meta = $metaclass->initialize($package => %options);
# spent 8.13ms making 19 calls to Class::MOP::Class::initialize, avg 428µs/call # spent 6.39ms making 1 call to Moose::Meta::Class::initialize
44 $meta->add_method('meta' => sub {
45 # we must re-initialize so that it
46 # works as expected in subclasses,
47 # since metaclass instances are
48 # singletons, this is not really a
49 # big deal anyway.
50552.56ms1103.34ms $metaclass->initialize((blessed($_[0]) || $_[0]) => %options)
# spent 2.94ms making 55 calls to Class::MOP::Class::initialize, avg 53µs/call # spent 408µs making 55 calls to Scalar::Util::blessed, avg 7µs/call
51 });
# spent 4.04ms making 20 calls to Class::MOP::Mixin::HasMethods::add_method, avg 202µs/call
52}
53
54110µs1;
55
56__END__
57
58=pod
59
60=head1 NAME
61
62metaclass - a pragma for installing and using Class::MOP metaclasses
63
64=head1 SYNOPSIS
65
66 package MyClass;
67
68 # use Class::MOP::Class
69 use metaclass;
70
71 # ... or use a custom metaclass
72 use metaclass 'MyMetaClass';
73
74 # ... or use a custom metaclass
75 # and custom attribute and method
76 # metaclasses
77 use metaclass 'MyMetaClass' => (
78 'attribute_metaclass' => 'MyAttributeMetaClass',
79 'method_metaclass' => 'MyMethodMetaClass',
80 );
81
82 # ... or just specify custom attribute
83 # and method classes, and Class::MOP::Class
84 # is the assumed metaclass
85 use metaclass (
86 'attribute_metaclass' => 'MyAttributeMetaClass',
87 'method_metaclass' => 'MyMethodMetaClass',
88 );
89
90=head1 DESCRIPTION
91
92This is a pragma to make it easier to use a specific metaclass
93and a set of custom attribute and method metaclasses. It also
94installs a C<meta> method to your class as well.
95
96=head1 AUTHORS
97
98Stevan Little E<lt>stevan@iinteractive.comE<gt>
99
100=head1 COPYRIGHT AND LICENSE
101
102Copyright 2006-2010 by Infinity Interactive, Inc.
103
104L<http://www.iinteractive.com>
105
106This library is free software; you can redistribute it and/or modify
107it under the same terms as Perl itself.
108
109=cut