← 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:13 2010

Filename/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/MouseX/Getopt/OptionTypeMap.pm
StatementsExecuted 122 statements in 1.03ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2211219µs279µsMouseX::Getopt::OptionTypeMap::::get_option_typeMouseX::Getopt::OptionTypeMap::get_option_type
2211205µs272µsMouseX::Getopt::OptionTypeMap::::has_option_typeMouseX::Getopt::OptionTypeMap::has_option_type
11118µs18µsMouseX::Getopt::OptionTypeMap::::BEGIN@2MouseX::Getopt::OptionTypeMap::BEGIN@2
11113µs432µsMouseX::Getopt::OptionTypeMap::::BEGIN@10MouseX::Getopt::OptionTypeMap::BEGIN@10
11113µs74µsMouseX::Getopt::OptionTypeMap::::BEGIN@75MouseX::Getopt::OptionTypeMap::BEGIN@75
11112µs69µsMouseX::Getopt::OptionTypeMap::::BEGIN@11MouseX::Getopt::OptionTypeMap::BEGIN@11
11111µs55µsMouseX::Getopt::OptionTypeMap::::BEGIN@76MouseX::Getopt::OptionTypeMap::BEGIN@76
1115µs5µsMouseX::Getopt::OptionTypeMap::::BEGIN@5MouseX::Getopt::OptionTypeMap::BEGIN@5
0000s0sMouseX::Getopt::OptionTypeMap::::add_option_type_to_mapMouseX::Getopt::OptionTypeMap::add_option_type_to_map
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MouseX::Getopt::OptionTypeMap;
2
# spent 18µs within MouseX::Getopt::OptionTypeMap::BEGIN@2 which was called: # once (18µs+0s) by MouseX::Getopt::Basic::BEGIN@12 at line 4
BEGIN {
3116µs $MouseX::Getopt::OptionTypeMap::AUTHORITY = 'cpan:STEVAN';
4127µs118µs}
# spent 18µs making 1 call to MouseX::Getopt::OptionTypeMap::BEGIN@2
5
# spent 5µs within MouseX::Getopt::OptionTypeMap::BEGIN@5 which was called: # once (5µs+0s) by MouseX::Getopt::Basic::BEGIN@12 at line 7
BEGIN {
616µs $MouseX::Getopt::OptionTypeMap::VERSION = '0.33';
7120µs15µs}
# spent 5µs making 1 call to MouseX::Getopt::OptionTypeMap::BEGIN@5
8# ABSTRACT: Storage for the option to type mappings
9
10231µs2851µs
# spent 432µs (13+419) within MouseX::Getopt::OptionTypeMap::BEGIN@10 which was called: # once (13µs+419µs) by MouseX::Getopt::Basic::BEGIN@12 at line 10
use Mouse 'confess', 'blessed';
# spent 432µs making 1 call to MouseX::Getopt::OptionTypeMap::BEGIN@10 # spent 419µs making 1 call to Mouse::Exporter::do_import
112284µs2126µs
# spent 69µs (12+57) within MouseX::Getopt::OptionTypeMap::BEGIN@11 which was called: # once (12µs+57µs) by MouseX::Getopt::Basic::BEGIN@12 at line 11
use Mouse::Util::TypeConstraints 'find_type_constraint';
# spent 69µs making 1 call to MouseX::Getopt::OptionTypeMap::BEGIN@11 # spent 57µs making 1 call to Mouse::Exporter::do_import
12
1314µsmy %option_type_map = (
14 'Bool' => '!',
15 'Str' => '=s',
16 'Int' => '=i',
17 'Num' => '=f',
18 'ArrayRef' => '=s@',
19 'HashRef' => '=s%',
20);
21
22
# spent 272µs (205+67) within MouseX::Getopt::OptionTypeMap::has_option_type which was called 22 times, avg 12µs/call: # 22 times (205µs+67µs) by MouseX::Getopt::Basic::_attrs_to_options at line 209 of MouseX/Getopt/Basic.pm, avg 12µs/call
sub has_option_type {
232229µs my (undef, $type_or_name) = @_;
24
2522258µs4467µs return 1 if exists $option_type_map{blessed($type_or_name) ? $type_or_name->name : $type_or_name};
# spent 35µs making 22 calls to Scalar::Util::blessed, avg 2µs/call # spent 32µs making 22 calls to Mouse::Meta::TypeConstraint::name, avg 1µs/call
26
27 my $current = blessed($type_or_name) ? $type_or_name : find_type_constraint($type_or_name);
28
29 (defined $current)
30 || confess "Could not find the type constraint for '$type_or_name'";
31
32 while (my $parent = $current->parent) {
33 return 1 if exists $option_type_map{$parent->name};
34 $current = $parent;
35 }
36
37 return 0;
38}
39
40
# spent 279µs (219+60) within MouseX::Getopt::OptionTypeMap::get_option_type which was called 22 times, avg 13µs/call: # 22 times (219µs+60µs) by MouseX::Getopt::Basic::_attrs_to_options at line 209 of MouseX/Getopt/Basic.pm, avg 13µs/call
sub get_option_type {
412227µs my (undef, $type_or_name) = @_;
42
4322183µs4460µs my $name = blessed($type_or_name) ? $type_or_name->name : $type_or_name;
# spent 31µs making 22 calls to Scalar::Util::blessed, avg 1µs/call # spent 29µs making 22 calls to Mouse::Meta::TypeConstraint::name, avg 1µs/call
44
452286µs return $option_type_map{$name} if exists $option_type_map{$name};
46
47 my $current = ref $type_or_name ? $type_or_name : find_type_constraint($type_or_name);
48
49 (defined $current)
50 || confess "Could not find the type constraint for '$type_or_name'";
51
52 while ( $current = $current->parent ) {
53 return $option_type_map{$current->name}
54 if exists $option_type_map{$current->name};
55 }
56
57 return;
58}
59
60sub add_option_type_to_map {
61 my (undef, $type_name, $option_string) = @_;
62 (defined $type_name && defined $option_string)
63 || confess "You must supply both a type name and an option string";
64
65 if ( blessed($type_name) ) {
66 $type_name = $type_name->name;
67 } else {
68 (find_type_constraint($type_name))
69 || confess "The type constraint '$type_name' does not exist";
70 }
71
72 $option_type_map{$type_name} = $option_string;
73}
74
75233µs2136µs
# spent 74µs (13+62) within MouseX::Getopt::OptionTypeMap::BEGIN@75 which was called: # once (13µs+62µs) by MouseX::Getopt::Basic::BEGIN@12 at line 75
no Mouse::Util::TypeConstraints;
# spent 74µs making 1 call to MouseX::Getopt::OptionTypeMap::BEGIN@75 # spent 62µs making 1 call to Mouse::Exporter::do_unimport
76221µs298µs
# spent 55µs (11+44) within MouseX::Getopt::OptionTypeMap::BEGIN@76 which was called: # once (11µs+44µs) by MouseX::Getopt::Basic::BEGIN@12 at line 76
no Mouse;
# spent 55µs making 1 call to MouseX::Getopt::OptionTypeMap::BEGIN@76 # spent 44µs making 1 call to Mouse::Exporter::do_unimport
77
7814µs1;
79
80
81__END__