← Index
NYTProf Performance Profile   « block view • line view • sub view »
For reply.pl
  Run on Thu Oct 21 22:40:13 2010
Reported on Thu Oct 21 22:44:39 2010

Filename/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/x86_64-linux/Mouse/Meta/Role.pm
StatementsExecuted 464 statements in 2.28ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
311836µs7.76msMouse::Meta::Role::::combineMouse::Meta::Role::combine
3333534µs617µsMouse::Meta::Role::::does_roleMouse::Meta::Role::does_role (recurses: max depth 1, inclusive time 251µs)
1722306µs565µsMouse::Meta::Role::::add_required_methodsMouse::Meta::Role::add_required_methods
711181µs372µsMouse::Meta::Role::::_construct_metaMouse::Meta::Role::_construct_meta
1822144µs144µsMouse::Meta::Role::::add_attributeMouse::Meta::Role::add_attribute
61190µs4.82msMouse::Meta::Role::::applyMouse::Meta::Role::apply
332245µs45µsMouse::Meta::Role::::get_rolesMouse::Meta::Role::get_roles (xsub)
31130µs658µsMouse::Meta::Role::::create_anon_roleMouse::Meta::Role::create_anon_role
11125µs105µsMouse::Meta::Role::::BEGIN@2Mouse::Meta::Role::BEGIN@2
61122µs22µsMouse::Meta::Role::::get_required_method_listMouse::Meta::Role::get_required_method_list
1116µs6µsMouse::Meta::Role::::BEGIN@4Mouse::Meta::Role::BEGIN@4
0000s0sMouse::Meta::Role::::add_override_method_modifierMouse::Meta::Role::add_override_method_modifier
0000s0sMouse::Meta::Role::::calculate_all_rolesMouse::Meta::Role::calculate_all_roles
0000s0sMouse::Meta::Role::::get_override_method_modifierMouse::Meta::Role::get_override_method_modifier
0000s0sMouse::Meta::Role::::requires_methodMouse::Meta::Role::requires_method
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Mouse::Meta::Role;
2228µs2185µs
# spent 105µs (25+80) within Mouse::Meta::Role::BEGIN@2 which was called: # once (25µs+80µs) by Mouse::BEGIN@15 at line 2
use Mouse::Util qw(:meta); # enables strict and warnings
# spent 105µs making 1 call to Mouse::Meta::Role::BEGIN@2 # spent 80µs making 1 call to Mouse::Exporter::do_import
3
42567µs16µs
# spent 6µs within Mouse::Meta::Role::BEGIN@4 which was called: # once (6µs+0s) by Mouse::BEGIN@15 at line 4
use Mouse::Meta::Module;
# spent 6µs making 1 call to Mouse::Meta::Role::BEGIN@4
516µsour @ISA = qw(Mouse::Meta::Module);
6
7sub method_metaclass;
8
9
# spent 372µs (181+191) within Mouse::Meta::Role::_construct_meta which was called 7 times, avg 53µs/call: # 7 times (181µs+191µs) by Mouse::Meta::Module::initialize at line 29 of Mouse/Meta/Module.pm, avg 53µs/call
sub _construct_meta {
1063206µs my $class = shift;
11
12 my %args = @_;
13
14 $args{methods} = {};
15 $args{attributes} = {};
16 $args{required_methods} = [];
17 $args{roles} = [];
18
19 my $self = bless \%args, ref($class) || $class;
20138µs10257µs if($class ne __PACKAGE__){
# spent 108µs making 3 calls to Mouse::Meta::Class::_initialize_object, avg 36µs/call # spent 83µs making 3 calls to Mouse::Util::meta, avg 28µs/call # spent 58µs making 1 call to Mouse::Meta::Class::_calculate_all_attributes # spent 3µs making 1 call to Mouse::Meta::Class::strict_constructor # spent 3µs making 1 call to Mouse::Meta::Class::is_anon_class # spent 2µs making 1 call to Mouse::Meta::Class::is_immutable
21 $self->meta->_initialize_object($self, \%args);
22 }
23 return $self;
24}
25
26
# spent 658µs (30+627) within Mouse::Meta::Role::create_anon_role which was called 3 times, avg 219µs/call: # 3 times (30µs+627µs) by Mouse::Meta::Role::Composite::new at line 16 of Mouse/Meta/Role/Composite.pm, avg 219µs/call
sub create_anon_role{
27629µs my $self = shift;
283627µs return $self->create(undef, @_);
# spent 627µs making 3 calls to Mouse::Meta::Module::create, avg 209µs/call
29}
30
31sub is_anon_role;
32
33sub get_roles;
34
35sub calculate_all_roles {
36 my $self = shift;
37 my %seen;
38 return grep { !$seen{ $_->name }++ }
39 ($self, map { $_->calculate_all_roles } @{ $self->get_roles });
40}
41
42
# spent 22µs within Mouse::Meta::Role::get_required_method_list which was called 6 times, avg 4µs/call: # 6 times (22µs+0s) by Mouse::Meta::Role::Application::check_required_methods at line 89 of Mouse/Meta/Role/Application.pm, avg 4µs/call
sub get_required_method_list{
43628µs return @{ $_[0]->{required_methods} };
44}
45
46
# spent 565µs (306+259) within Mouse::Meta::Role::add_required_methods which was called 17 times, avg 33µs/call: # 11 times (192µs+234µs) by Mouse::Role::requires at line 100 of Mouse/Role.pm, avg 39µs/call # 6 times (114µs+25µs) by Mouse::Meta::Role::Application::check_required_methods at line 89 of Mouse/Meta/Role/Application.pm, avg 23µs/call
sub add_required_methods {
4768195µs my($self, @methods) = @_;
48 my %required = map{ $_ => 1 } @{$self->{required_methods}};
4921104µs21259µs push @{$self->{required_methods}}, grep{ !$required{$_}++ && !$self->has_method($_) } @methods;
# spent 234µs making 11 calls to Mouse::Meta::Module::has_method, avg 21µs/call # spent 25µs making 10 calls to Mouse::Meta::Role::Composite::has_method, avg 3µs/call
50 return;
51}
52
53sub requires_method {
54 my($self, $name) = @_;
55 return scalar( grep{ $_ eq $name } @{ $self->{required_methods} } ) != 0;
56}
57
58
# spent 144µs within Mouse::Meta::Role::add_attribute which was called 18 times, avg 8µs/call: # 10 times (63µs+0s) by Mouse::Meta::Role::Composite::add_attribute at line 84 of Mouse/Meta/Role/Composite.pm, avg 6µs/call # 8 times (81µs+0s) by Mouse::Role::has at line 44 of Mouse/Role.pm, avg 10µs/call
sub add_attribute {
5972162µs my $self = shift;
60 my $name = shift;
61
62 $self->{attributes}->{$name} = (@_ == 1) ? $_[0] : { @_ };
63 return;
64}
65
66
# spent 4.82ms (90µs+4.73) within Mouse::Meta::Role::apply which was called 6 times, avg 803µs/call: # 6 times (90µs+4.73ms) by Mouse::Meta::Role::Composite::new at line 21 of Mouse/Meta/Role/Composite.pm, avg 803µs/call
sub apply {
672487µs my $self = shift;
68 my $consumer = shift;
69
70 require 'Mouse/Meta/Role/Application.pm';
71124.73ms return Mouse::Meta::Role::Application->new(@_)->apply($self, $consumer);
# spent 4.59ms making 6 calls to Mouse::Meta::Role::Application::apply, avg 766µs/call # spent 136µs making 6 calls to Mouse::Meta::Role::Application::new, avg 23µs/call
72}
73
74
# spent 7.76ms (836µs+6.92) within Mouse::Meta::Role::combine which was called 3 times, avg 2.59ms/call: # 3 times (836µs+6.92ms) by Mouse::Util::apply_all_roles at line 310 of Mouse/Util.pm, avg 2.59ms/call
sub combine {
759200µs my($self, @role_specs) = @_;
76
77 require 'Mouse/Meta/Role/Composite.pm';
7835.63ms return Mouse::Meta::Role::Composite->new(roles => \@role_specs);
# spent 5.63ms making 3 calls to Mouse::Meta::Role::Composite::new, avg 1.88ms/call
79}
80
81sub add_before_method_modifier;
82sub add_around_method_modifier;
83sub add_after_method_modifier;
84
85sub get_before_method_modifiers;
86sub get_around_method_modifiers;
87sub get_after_method_modifiers;
88
89sub add_override_method_modifier{
90 my($self, $method_name, $method) = @_;
91
92 if($self->has_method($method_name)){
93 # This error happens in the override keyword or during role composition,
94 # so I added a message, "A local method of ...", only for compatibility (gfx)
95 $self->throw_error("Cannot add an override of method '$method_name' "
96 . "because there is a local version of '$method_name'"
97 . "(A local method of the same name as been found)");
98 }
99
100 $self->{override_method_modifiers}->{$method_name} = $method;
101}
102
103sub get_override_method_modifier {
104 my ($self, $method_name) = @_;
105 return $self->{override_method_modifiers}->{$method_name};
106}
107
108
# spent 617µs (534+83) within Mouse::Meta::Role::does_role which was called 33 times, avg 19µs/call: # 18 times (216µs+-216µs) by Mouse::Meta::Role::does_role at line 120, avg 0s/call # 9 times (178µs+206µs) by Mouse::Meta::Class::does_role at line 455 of Mouse/Meta/Class.pm, avg 43µs/call # 6 times (140µs+93µs) by Mouse::Meta::Role::Application::_append_roles at line 194 of Mouse/Meta/Role/Application.pm, avg 39µs/call
sub does_role {
109171529µs my ($self, $role_name) = @_;
110
111 (defined $role_name)
112 || $self->throw_error("You must supply a role name to look for");
113
11469µs $role_name = $role_name->name if ref $role_name;
# spent 9µs making 6 calls to Mouse::Meta::Module::name, avg 1µs/call
115
116 # if we are it,.. then return true
1173342µs return 1 if $role_name eq $self->name;
# spent 42µs making 33 calls to Mouse::Meta::Module::name, avg 1µs/call
118 # otherwise.. check our children
1192431µs for my $role (@{ $self->get_roles }) {
# spent 31µs making 24 calls to Mouse::Meta::Role::get_roles, avg 1µs/call
1201897µs180s return 1 if $role->does_role($role_name);
# spent 251µs making 18 calls to Mouse::Meta::Role::does_role, avg 14µs/call, recursion: max depth 1, sum of overlapping time 251µs
121 }
122 return 0;
123}
124
12513µs1;
126__END__
 
# spent 45µs within Mouse::Meta::Role::get_roles which was called 33 times, avg 1µs/call: # 24 times (31µs+0s) by Mouse::Meta::Role::does_role at line 119, avg 1µs/call # 9 times (13µs+0s) by Mouse::Meta::Role::Application::_append_roles at line 193 of Mouse/Meta/Role/Application.pm, avg 1µs/call
sub Mouse::Meta::Role::get_roles; # xsub