← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 01.HTTP.t
  Run on Tue May 4 15:25:55 2010
Reported on Tue May 4 15:26:23 2010

File /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/metaclass.pm
Statements Executed 263
Statement Execution Time 13.0ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
202020421µs3.17msmetaclass::::importmetaclass::import
11114µs16µsmetaclass::::BEGIN@4metaclass::BEGIN@4
1118µs22µsmetaclass::::BEGIN@5metaclass::BEGIN@5
1117µs36µsmetaclass::::BEGIN@7metaclass::BEGIN@7
1117µs30µsmetaclass::::BEGIN@8metaclass::BEGIN@8
1114µs4µ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
4321µs219µs
# spent 16µs (14+3) within metaclass::BEGIN@4 which was called # once (14µs+3µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 4
use strict;
# spent 16µs making 1 call to metaclass::BEGIN@4 # spent 3µs making 1 call to strict::import
5323µs236µs
# spent 22µs (8+14) within metaclass::BEGIN@5 which was called # once (8µs+14µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 5
use warnings;
# spent 22µs making 1 call to metaclass::BEGIN@5 # spent 14µs making 1 call to warnings::import
6
7323µs266µs
# spent 36µs (7+29) within metaclass::BEGIN@7 which was called # once (7µs+29µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 7
use Carp 'confess';
# spent 36µs making 1 call to metaclass::BEGIN@7 # spent 30µs making 1 call to Exporter::import
8343µs252µs
# spent 30µs (7+23) within metaclass::BEGIN@8 which was called # once (7µs+23µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 8
use Scalar::Util 'blessed';
# spent 30µs making 1 call to metaclass::BEGIN@8 # spent 23µs making 1 call to Exporter::import
9
1013µsour $VERSION = '0.98';
11138µs$VERSION = eval $VERSION;
121700nsour $AUTHORITY = 'cpan:STEVAN';
13
14312.0ms14µs
# spent 4µs within metaclass::BEGIN@14 which was called # once (4µs+0s) by Moose::Meta::TypeConstraint::BEGIN@6 at line 14
use Class::MOP;
# spent 4µs making 1 call to metaclass::BEGIN@14
15
16
# spent 3.17ms (421µs+2.75) within metaclass::import which was called 20 times, avg 158µs/call: # once (51µs+1.04ms) by Moose::Object::BEGIN@13 at line 15 of if.pm # once (30µs+124µs) by Moose::Meta::Role::Composite::BEGIN@5 at line 5 of Moose/Meta/Role/Composite.pm # once (30µs+121µs) by Moose::Meta::Role::BEGIN@6 at line 6 of Moose/Meta/Role.pm # once (29µs+111µs) by Moose::Meta::TypeConstraint::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint.pm # once (20µs+100µs) by Moose::Meta::TypeConstraint::Union::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Union.pm # once (20µs+96µs) by Moose::Meta::TypeConstraint::Class::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Class.pm # once (17µs+96µs) by Moose::Meta::TypeConstraint::Registry::BEGIN@6 at line 6 of Moose/Meta/TypeConstraint/Registry.pm # once (18µs+91µs) by Moose::Meta::Role::Application::BEGIN@5 at line 5 of Moose/Meta/Role/Application.pm # once (22µs+85µs) by Moose::Meta::Role::Method::Required::BEGIN@6 at line 6 of Moose/Meta/Role/Method/Required.pm # once (25µs+80µs) by Moose::Meta::Role::Application::RoleSummation::BEGIN@5 at line 5 of Moose/Meta/Role/Application/RoleSummation.pm # once (16µs+86µs) by Moose::Meta::TypeCoercion::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion.pm # once (16µs+83µs) by Moose::Meta::TypeConstraint::Role::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Role.pm # once (16µs+82µs) by Moose::Meta::TypeConstraint::Enum::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Enum.pm # once (16µs+82µs) by Moose::Meta::TypeConstraint::DuckType::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/DuckType.pm # once (16µs+79µs) by Moose::Meta::Role::Application::ToClass::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToClass.pm # once (16µs+79µs) by Moose::Meta::Role::Application::ToRole::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToRole.pm # once (17µs+79µs) by Moose::Meta::Role::Application::ToInstance::BEGIN@5 at line 5 of Moose/Meta/Role/Application/ToInstance.pm # once (16µs+77µs) by Moose::Meta::TypeConstraint::Parameterized::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Parameterized.pm # once (16µs+77µs) by Moose::Meta::TypeConstraint::Parameterizable::BEGIN@5 at line 5 of Moose/Meta/TypeConstraint/Parameterizable.pm # once (15µs+75µs) by Moose::Meta::TypeCoercion::Union::BEGIN@6 at line 6 of Moose/Meta/TypeCoercion/Union.pm
sub import {
172026µs my ( $class, @args ) = @_;
18
192017µs unshift @args, "metaclass" if @args % 2 == 1;
202017µs my %options = @args;
21
222011µs my $metaclass = delete $options{metaclass};
23
242015µs unless ( defined $metaclass ) {
25 $metaclass = "Class::MOP::Class";
26 } else {
2712µs144µs Class::MOP::load_class($metaclass);
# spent 44µs making 1 call to Class::MOP::load_class
28 }
29
3020108µs2031µs ($metaclass->isa('Class::MOP::Class'))
# spent 31µs making 20 calls to UNIVERSAL::isa, avg 2µs/call
31 || confess "The metaclass ($metaclass) must be derived from Class::MOP::Class";
32
33 # make sure the custom metaclasses get loaded
342040µs foreach my $key (grep { /_(?:meta)?class$/ } keys %options) {
35 unless ( ref( my $class = $options{$key} ) ) {
36 Class::MOP::load_class($class)
37 }
38 }
39
402011µs my $package = caller();
41
42 # create a meta object so we can install &meta
432036µs201.95ms my $meta = $metaclass->initialize($package => %options);
# spent 991µs making 19 calls to Class::MOP::Class::initialize, avg 52µs/call # spent 960µs 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.
5043356µs86331µs $metaclass->initialize((blessed($_[0]) || $_[0]) => %options)
# spent 306µs making 43 calls to Class::MOP::Class::initialize, avg 7µs/call # spent 25µs making 43 calls to Scalar::Util::blessed, avg 579ns/call
5120161µs20720µs });
# spent 720µs making 20 calls to Class::MOP::Mixin::HasMethods::add_method, avg 36µ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