← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/hailo
  Run on Thu Oct 21 22:50:37 2010
Reported on Thu Oct 21 22:52:07 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 1062 statements in 3.95ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
126331.53ms1.78msMouse::Meta::Role::::does_roleMouse::Meta::Role::does_role (recurses: max depth 3, inclusive time 446µs)
14221.11ms17.1msMouse::Meta::Role::::applyMouse::Meta::Role::apply (recurses: max depth 1, inclusive time 1.36ms)
311842µs6.20msMouse::Meta::Role::::combineMouse::Meta::Role::combine
2022324µs573µsMouse::Meta::Role::::add_required_methodsMouse::Meta::Role::add_required_methods
1311296µs474µsMouse::Meta::Role::::_construct_metaMouse::Meta::Role::_construct_meta
3433248µs248µsMouse::Meta::Role::::add_attributeMouse::Meta::Role::add_attribute
7022102µs102µsMouse::Meta::Role::::get_rolesMouse::Meta::Role::get_roles (xsub)
31132µs626µsMouse::Meta::Role::::create_anon_roleMouse::Meta::Role::create_anon_role
91132µs32µsMouse::Meta::Role::::get_required_method_listMouse::Meta::Role::get_required_method_list
72228µs28µsMouse::Meta::Role::::add_around_method_modifierMouse::Meta::Role::add_around_method_modifier (xsub)
11124µs100µsMouse::Meta::Role::::BEGIN@2Mouse::Meta::Role::BEGIN@2
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µs2176µs
# spent 100µs (24+76) within Mouse::Meta::Role::BEGIN@2 which was called: # once (24µs+76µs) by Mouse::BEGIN@15 at line 2
use Mouse::Util qw(:meta); # enables strict and warnings
# spent 100µs making 1 call to Mouse::Meta::Role::BEGIN@2 # spent 76µs making 1 call to Mouse::Exporter::do_import
3
42563µ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
515µsour @ISA = qw(Mouse::Meta::Module);
6
7sub method_metaclass;
8
9
# spent 474µs (296+178) within Mouse::Meta::Role::_construct_meta which was called 13 times, avg 36µs/call: # 13 times (296µs+178µs) by Mouse::Meta::Module::initialize at line 29 of Mouse/Meta/Module.pm, avg 36µs/call
sub _construct_meta {
10117323µ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;
20134µs10241µs if($class ne __PACKAGE__){
# spent 104µs making 3 calls to Mouse::Meta::Class::_initialize_object, avg 35µs/call # spent 73µs making 3 calls to Mouse::Util::meta, avg 24µs/call # spent 57µs making 1 call to Mouse::Meta::Class::_calculate_all_attributes # spent 3µs making 1 call to Mouse::Meta::Class::strict_constructor # spent 2µs making 1 call to Mouse::Meta::Class::is_immutable # spent 1µs making 1 call to Mouse::Meta::Class::is_anon_class
21 $self->meta->_initialize_object($self, \%args);
22 }
23 return $self;
24}
25
26
# spent 626µs (32+594) within Mouse::Meta::Role::create_anon_role which was called 3 times, avg 209µs/call: # 3 times (32µs+594µs) by Mouse::Meta::Role::Composite::new at line 16 of Mouse/Meta/Role/Composite.pm, avg 209µs/call
sub create_anon_role{
27632µs my $self = shift;
283594µs return $self->create(undef, @_);
# spent 594µs making 3 calls to Mouse::Meta::Module::create, avg 198µ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 32µs within Mouse::Meta::Role::get_required_method_list which was called 9 times, avg 4µs/call: # 9 times (32µ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{
43945µs return @{ $_[0]->{required_methods} };
44}
45
46
# spent 573µs (324+249) within Mouse::Meta::Role::add_required_methods which was called 20 times, avg 29µs/call: # 11 times (181µs+223µs) by Mouse::Role::requires at line 100 of Mouse/Role.pm, avg 37µs/call # 9 times (142µs+26µs) by Mouse::Meta::Role::Application::check_required_methods at line 89 of Mouse/Meta/Role/Application.pm, avg 19µs/call
sub add_required_methods {
4780218µs my($self, @methods) = @_;
48 my %required = map{ $_ => 1 } @{$self->{required_methods}};
4921101µs21249µs push @{$self->{required_methods}}, grep{ !$required{$_}++ && !$self->has_method($_) } @methods;
# spent 223µs making 11 calls to Mouse::Meta::Module::has_method, avg 20µs/call # spent 26µ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 248µs within Mouse::Meta::Role::add_attribute which was called 34 times, avg 7µs/call: # 14 times (122µs+0s) by Mouse::Role::has at line 44 of Mouse/Role.pm, avg 9µs/call # 10 times (63µs+0s) by Mouse::Meta::Role::Application::apply_attributes at line 156 of Mouse/Meta/Role/Application.pm, avg 6µs/call # 10 times (62µs+0s) by Mouse::Meta::Role::Composite::add_attribute at line 84 of Mouse/Meta/Role/Composite.pm, avg 6µs/call
sub add_attribute {
59136283µs my $self = shift;
60 my $name = shift;
61
62 $self->{attributes}->{$name} = (@_ == 1) ? $_[0] : { @_ };
63 return;
64}
65
66
# spent 17.1ms (1.11+16.0) within Mouse::Meta::Role::apply which was called 14 times, avg 1.22ms/call: # 8 times (1.01ms+11.6ms) by Mouse::Util::apply_all_roles at line 307 of Mouse/Util.pm, avg 1.58ms/call # 6 times (91µs+4.41ms) by Mouse::Meta::Role::Composite::new at line 21 of Mouse/Meta/Role/Composite.pm, avg 750µs/call
sub apply {
6756294µs my $self = shift;
68 my $consumer = shift;
69
70 require 'Mouse/Meta/Role/Application.pm';
712816.0ms return Mouse::Meta::Role::Application->new(@_)->apply($self, $consumer);
# spent 17.0ms making 14 calls to Mouse::Meta::Role::Application::apply, avg 1.21ms/call, recursion: max depth 1, sum of overlapping time 1.29ms # spent 308µs making 14 calls to Mouse::Meta::Role::Application::new, avg 22µs/call
72}
73
74
# spent 6.20ms (842µs+5.35) within Mouse::Meta::Role::combine which was called 3 times, avg 2.07ms/call: # 3 times (842µs+5.35ms) by Mouse::Util::apply_all_roles at line 310 of Mouse/Util.pm, avg 2.07ms/call
sub combine {
759175µs my($self, @role_specs) = @_;
76
77 require 'Mouse/Meta/Role/Composite.pm';
7835.27ms return Mouse::Meta::Role::Composite->new(roles => \@role_specs);
# spent 5.27ms making 3 calls to Mouse::Meta::Role::Composite::new, avg 1.76ms/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 1.78ms (1.53+259µs) within Mouse::Meta::Role::does_role which was called 126 times, avg 14µs/call: # 89 times (963µs+409µs) by Mouse::Meta::Class::does_role at line 455 of Mouse/Meta/Class.pm, avg 15µs/call # 26 times (314µs+-314µs) by Mouse::Meta::Role::does_role at line 120, avg 0s/call # 11 times (248µs+164µs) by Mouse::Meta::Role::Application::_append_roles at line 194 of Mouse/Meta/Role/Application.pm, avg 37µs/call
sub does_role {
1095961.70ms my ($self, $role_name) = @_;
110
111 (defined $role_name)
112 || $self->throw_error("You must supply a role name to look for");
113
1141116µs $role_name = $role_name->name if ref $role_name;
# spent 16µs making 11 calls to Mouse::Meta::Module::name, avg 1µs/call
115
116 # if we are it,.. then return true
117126166µs return 1 if $role_name eq $self->name;
# spent 166µs making 126 calls to Mouse::Meta::Module::name, avg 1µs/call
118 # otherwise.. check our children
1195376µs for my $role (@{ $self->get_roles }) {
# spent 76µs making 53 calls to Mouse::Meta::Role::get_roles, avg 1µs/call
12026150µs260s return 1 if $role->does_role($role_name);
# spent 446µs making 26 calls to Mouse::Meta::Role::does_role, avg 17µs/call, recursion: max depth 3, sum of overlapping time 446µs
121 }
122 return 0;
123}
124
12514µs1;
126__END__
 
# spent 28µs within Mouse::Meta::Role::add_around_method_modifier which was called 7 times, avg 4µs/call: # 4 times (14µs+0s) by Mouse::Meta::Role::Application::apply_modifiers at line 182 of Mouse/Meta/Role/Application.pm, avg 3µs/call # 3 times (14µs+0s) by Mouse::Role::around at line 71 of Mouse/Role.pm, avg 5µs/call
sub Mouse::Meta::Role::add_around_method_modifier; # xsub
# spent 102µs within Mouse::Meta::Role::get_roles which was called 70 times, avg 1µs/call: # 53 times (76µs+0s) by Mouse::Meta::Role::does_role at line 119, avg 1µs/call # 17 times (25µ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