Profile of DateTime/Infinite.pm

← Index
NYTProf Performance Profile «line view»
For -e
Run on Thu Jun 30 16:16:00 2016
Reported on Thu Jun 30 16:16:08 2016

Filename | /home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/DateTime/Infinite.pm
Statements | Executed 66 statements in 1.77ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 1.82ms | 2.04ms | DateTime::Infinite::::BEGIN@11 DateTime::Infinite::BEGIN@11
1 | 1 | 1 | 20µs | 24µs | DateTime::Infinite::::BEGIN@3 DateTime::Infinite::BEGIN@3
2 | 2 | 1 | 13µs | 118µs | FakeLocale::::instance FakeLocale::instance
1 | 1 | 1 | 11µs | 13µs | DateTime::Infinite::Future::::BEGIN@72DateTime::Infinite::Future::BEGIN@72
1 | 1 | 1 | 10µs | 12µs | DateTime::Infinite::Past::::BEGIN@97 DateTime::Infinite::Past::BEGIN@97
1 | 1 | 1 | 10µs | 18µs | DateTime::Infinite::::BEGIN@4 DateTime::Infinite::BEGIN@4
1 | 1 | 1 | 9µs | 12µs | FakeLocale::::BEGIN@123 FakeLocale::BEGIN@123
1 | 1 | 1 | 9µs | 21µs | DateTime::Infinite::::BEGIN@14 DateTime::Infinite::BEGIN@14
1 | 1 | 1 | 9µs | 18µs | DateTime::Infinite::Future::::BEGIN@73DateTime::Infinite::Future::BEGIN@73
1 | 1 | 1 | 8µs | 15µs | DateTime::Infinite::Past::::BEGIN@98 DateTime::Infinite::Past::BEGIN@98
2 | 1 | 1 | 8µs | 8µs | DateTime::Infinite::::_rd2ymd DateTime::Infinite::_rd2ymd
1 | 1 | 1 | 8µs | 64µs | DateTime::Infinite::Past::::BEGIN@100 DateTime::Infinite::Past::BEGIN@100
1 | 1 | 1 | 8µs | 66µs | DateTime::Infinite::Future::::BEGIN@75DateTime::Infinite::Future::BEGIN@75
1 | 1 | 1 | 8µs | 19µs | FakeLocale::::BEGIN@166 FakeLocale::BEGIN@166
1 | 1 | 1 | 8µs | 14µs | FakeLocale::::BEGIN@124 FakeLocale::BEGIN@124
1 | 1 | 1 | 7µs | 7µs | FakeLocale::::BEGIN@126 FakeLocale::BEGIN@126
1 | 1 | 1 | 6µs | 6µs | DateTime::Infinite::::BEGIN@8 DateTime::Infinite::BEGIN@8
1 | 1 | 1 | 5µs | 5µs | DateTime::Infinite::::BEGIN@9 DateTime::Infinite::BEGIN@9
2 | 1 | 1 | 5µs | 5µs | DateTime::Infinite::::_seconds_as_components DateTime::Infinite::_seconds_as_components
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::Future::::newDateTime::Infinite::Future::new
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::Past::::new DateTime::Infinite::Past::new
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::STORABLE_freeze DateTime::Infinite::STORABLE_freeze
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::STORABLE_thaw DateTime::Infinite::STORABLE_thaw
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::__ANON__[:15] DateTime::Infinite::__ANON__[:15]
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::_infinity_string DateTime::Infinite::_infinity_string
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::_stringify DateTime::Infinite::_stringify
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::dmy DateTime::Infinite::dmy
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::hms DateTime::Infinite::hms
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::hour_12 DateTime::Infinite::hour_12
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::hour_12_0 DateTime::Infinite::hour_12_0
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::is_finite DateTime::Infinite::is_finite
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::is_infinite DateTime::Infinite::is_infinite
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::iso8601 DateTime::Infinite::iso8601
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::mdy DateTime::Infinite::mdy
0 | 0 | 0 | 0s | 0s | DateTime::Infinite::::ymd DateTime::Infinite::ymd
0 | 0 | 0 | 0s | 0s | FakeLocale::::AUTOLOAD FakeLocale::AUTOLOAD
0 | 0 | 0 | 0s | 0s | FakeLocale::::__ANON__[:167] FakeLocale::__ANON__[:167]
0 | 0 | 0 | 0s | 0s | FakeLocale::::first_day_of_week FakeLocale::first_day_of_week
0 | 0 | 0 | 0s | 0s | FakeLocale::::id FakeLocale::id
0 | 0 | 0 | 0s | 0s | FakeLocale::::language FakeLocale::language
0 | 0 | 0 | 0s | 0s | FakeLocale::::language_id FakeLocale::language_id
0 | 0 | 0 | 0s | 0s | FakeLocale::::name FakeLocale::name
0 | 0 | 0 | 0s | 0s | FakeLocale::::prefers_24_hour_time FakeLocale::prefers_24_hour_time

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package DateTime::Infinite;
2 |  |  |  |  |
3 | 2 | 33µs | 2 | 28µs | # spent 24µs (20+4) within DateTime::Infinite::BEGIN@3 which was called: # once (20µs+4µs) by DateTime::Format::Alami::parse_datetime at line 3 use strict; # spent 24µs making 1 call to DateTime::Infinite::BEGIN@3 # spent 4µs making 1 call to strict::import
4 | 2 | 45µs | 2 | 27µs | # spent 18µs (10+9) within DateTime::Infinite::BEGIN@4 which was called: # once (10µs+9µs) by DateTime::Format::Alami::parse_datetime at line 4 use warnings; # spent 18µs making 1 call to DateTime::Infinite::BEGIN@4 # spent 9µs making 1 call to warnings::import
5 |  |  |  |  |
6 | 1 | 700ns |  |  | our $VERSION = '1.27';
7 |  |  |  |  |
8 | 2 | 26µs | 1 | 6µs | # spent 6µs within DateTime::Infinite::BEGIN@8 which was called: # once (6µs+0s) by DateTime::Format::Alami::parse_datetime at line 8 use DateTime; # spent 6µs making 1 call to DateTime::Infinite::BEGIN@8
9 | 2 | 29µs | 1 | 5µs | # spent 5µs within DateTime::Infinite::BEGIN@9 which was called: # once (5µs+0s) by DateTime::Format::Alami::parse_datetime at line 9 use DateTime::TimeZone; # spent 5µs making 1 call to DateTime::Infinite::BEGIN@9
10 |  |  |  |  |
11 | 2 | 343µs | 2 | 2.18ms | # spent 2.04ms (1.82+223µs) within DateTime::Infinite::BEGIN@11 which was called: # once (1.82ms+223µs) by DateTime::Format::Alami::parse_datetime at line 11 use base qw(DateTime); # spent 2.04ms making 1 call to DateTime::Infinite::BEGIN@11 # spent 131µs making 1 call to base::import
12 |  |  |  |  |
13 | 1 | 1µs |  |  | foreach my $m (qw( set set_time_zone truncate )) {
14 | 2 | 357µs | 2 | 34µs | # spent 21µs (9+12) within DateTime::Infinite::BEGIN@14 which was called: # once (9µs+12µs) by DateTime::Format::Alami::parse_datetime at line 14 no strict 'refs'; # spent 21µs making 1 call to DateTime::Infinite::BEGIN@14 # spent 12µs making 1 call to strict::unimport
15 | 3 | 35µs |  |  | *{"DateTime::Infinite::$m"} = sub { return $_[0] };
16 |  |  |  |  | }
17 |  |  |  |  |
18 |  |  |  |  | sub is_finite {0}
19 |  |  |  |  | sub is_infinite {1}
20 |  |  |  |  |
21 |  |  |  |  | # spent 8µs within DateTime::Infinite::_rd2ymd which was called 2 times, avg 4µs/call: # 2 times (8µs+0s) by DateTime::_calc_local_components at line 471 of DateTime.pm, avg 4µs/call sub _rd2ymd {
22 | 2 | 17µs |  |  | return $_[2] ? ( $_[1] ) x 7 : ( $_[1] ) x 3;
23 |  |  |  |  | }
24 |  |  |  |  |
25 |  |  |  |  | # spent 5µs within DateTime::Infinite::_seconds_as_components which was called 2 times, avg 3µs/call: # 2 times (5µs+0s) by DateTime::_calc_local_components at line 477 of DateTime.pm, avg 3µs/call sub _seconds_as_components {
26 | 2 | 11µs |  |  | return ( $_[1] ) x 3;
27 |  |  |  |  | }
28 |  |  |  |  |
29 |  |  |  |  | sub ymd {
30 |  |  |  |  | return $_[0]->iso8601;
31 |  |  |  |  | }
32 |  |  |  |  |
33 |  |  |  |  | sub mdy {
34 |  |  |  |  | return $_[0]->iso8601;
35 |  |  |  |  | }
36 |  |  |  |  |
37 |  |  |  |  | sub dmy {
38 |  |  |  |  | return $_[0]->iso8601;
39 |  |  |  |  | }
40 |  |  |  |  |
41 |  |  |  |  | sub hms {
42 |  |  |  |  | return $_[0]->iso8601;
43 |  |  |  |  | }
44 |  |  |  |  |
45 |  |  |  |  | sub hour_12 {
46 |  |  |  |  | return $_[0]->_infinity_string;
47 |  |  |  |  | }
48 |  |  |  |  |
49 |  |  |  |  | sub hour_12_0 {
50 |  |  |  |  | return $_[0]->_infinity_string;
51 |  |  |  |  | }
52 |  |  |  |  |
53 |  |  |  |  | sub iso8601 {
54 |  |  |  |  | return $_[0]->_infinity_string;
55 |  |  |  |  | }
56 |  |  |  |  |
57 |  |  |  |  | sub _stringify {
58 |  |  |  |  | return $_[0]->_infinity_string;
59 |  |  |  |  | }
60 |  |  |  |  |
61 |  |  |  |  | sub _infinity_string {
62 |  |  |  |  | return $_[0]->{utc_rd_days} == DateTime::INFINITY
63 |  |  |  |  | ? DateTime::INFINITY . ''
64 |  |  |  |  | : DateTime::NEG_INFINITY . '';
65 |  |  |  |  | }
66 |  |  |  |  |
67 |  |  |  |  | sub STORABLE_freeze {return}
68 |  |  |  |  | sub STORABLE_thaw {return}
69 |  |  |  |  |
70 |  |  |  |  | package DateTime::Infinite::Future;
71 |  |  |  |  |
72 | 2 | 30µs | 2 | 16µs | # spent 13µs (11+2) within DateTime::Infinite::Future::BEGIN@72 which was called: # once (11µs+2µs) by DateTime::Format::Alami::parse_datetime at line 72 use strict; # spent 13µs making 1 call to DateTime::Infinite::Future::BEGIN@72 # spent 2µs making 1 call to strict::import
73 | 2 | 32µs | 2 | 27µs | # spent 18µs (9+9) within DateTime::Infinite::Future::BEGIN@73 which was called: # once (9µs+9µs) by DateTime::Format::Alami::parse_datetime at line 73 use warnings; # spent 18µs making 1 call to DateTime::Infinite::Future::BEGIN@73 # spent 9µs making 1 call to warnings::import
74 |  |  |  |  |
75 | 2 | 104µs | 2 | 124µs | # spent 66µs (8+58) within DateTime::Infinite::Future::BEGIN@75 which was called: # once (8µs+58µs) by DateTime::Format::Alami::parse_datetime at line 75 use base qw(DateTime::Infinite); # spent 66µs making 1 call to DateTime::Infinite::Future::BEGIN@75 # spent 58µs making 1 call to base::import
76 |  |  |  |  |
77 |  |  |  |  | {
78 | 1 | 13µs | 2 | 211µs | my $Pos = bless { # spent 113µs making 1 call to FakeLocale::instance # spent 98µs making 1 call to DateTime::TimeZone::new
79 |  |  |  |  | utc_rd_days => DateTime::INFINITY,
80 |  |  |  |  | utc_rd_secs => DateTime::INFINITY,
81 |  |  |  |  | local_rd_days => DateTime::INFINITY,
82 |  |  |  |  | local_rd_secs => DateTime::INFINITY,
83 |  |  |  |  | rd_nanosecs => DateTime::INFINITY,
84 |  |  |  |  | tz => DateTime::TimeZone->new( name => 'floating' ),
85 |  |  |  |  | locale => FakeLocale->instance(),
86 |  |  |  |  | },
87 |  |  |  |  | __PACKAGE__;
88 |  |  |  |  |
89 | 1 | 6µs | 1 | 107µs | $Pos->_calc_utc_rd; # spent 107µs making 1 call to DateTime::_calc_utc_rd
90 | 1 | 5µs | 1 | 70µs | $Pos->_calc_local_rd; # spent 70µs making 1 call to DateTime::_calc_local_rd
91 |  |  |  |  |
92 |  |  |  |  | sub new {$Pos}
93 |  |  |  |  | }
94 |  |  |  |  |
95 | 1 | 2µs |  |  | package DateTime::Infinite::Past;
96 |  |  |  |  |
97 | 2 | 32µs | 2 | 14µs | # spent 12µs (10+2) within DateTime::Infinite::Past::BEGIN@97 which was called: # once (10µs+2µs) by DateTime::Format::Alami::parse_datetime at line 97 use strict; # spent 12µs making 1 call to DateTime::Infinite::Past::BEGIN@97 # spent 2µs making 1 call to strict::import
98 | 2 | 34µs | 2 | 22µs | # spent 15µs (8+7) within DateTime::Infinite::Past::BEGIN@98 which was called: # once (8µs+7µs) by DateTime::Format::Alami::parse_datetime at line 98 use warnings; # spent 15µs making 1 call to DateTime::Infinite::Past::BEGIN@98 # spent 7µs making 1 call to warnings::import
99 |  |  |  |  |
100 | 2 | 106µs | 2 | 120µs | # spent 64µs (8+56) within DateTime::Infinite::Past::BEGIN@100 which was called: # once (8µs+56µs) by DateTime::Format::Alami::parse_datetime at line 100 use base qw(DateTime::Infinite); # spent 64µs making 1 call to DateTime::Infinite::Past::BEGIN@100 # spent 56µs making 1 call to base::import
101 |  |  |  |  |
102 |  |  |  |  | {
103 | 1 | 8µs | 2 | 47µs | my $Neg = bless { # spent 42µs making 1 call to DateTime::TimeZone::new # spent 5µs making 1 call to FakeLocale::instance
104 |  |  |  |  | utc_rd_days => DateTime::NEG_INFINITY,
105 |  |  |  |  | utc_rd_secs => DateTime::NEG_INFINITY,
106 |  |  |  |  | local_rd_days => DateTime::NEG_INFINITY,
107 |  |  |  |  | local_rd_secs => DateTime::NEG_INFINITY,
108 |  |  |  |  | rd_nanosecs => DateTime::NEG_INFINITY,
109 |  |  |  |  | tz => DateTime::TimeZone->new( name => 'floating' ),
110 |  |  |  |  | locale => FakeLocale->instance(),
111 |  |  |  |  | },
112 |  |  |  |  | __PACKAGE__;
113 |  |  |  |  |
114 | 1 | 4µs | 1 | 90µs | $Neg->_calc_utc_rd; # spent 90µs making 1 call to DateTime::_calc_utc_rd
115 | 1 | 4µs | 1 | 77µs | $Neg->_calc_local_rd; # spent 77µs making 1 call to DateTime::_calc_local_rd
116 |  |  |  |  |
117 |  |  |  |  | sub new {$Neg}
118 |  |  |  |  | }
119 |  |  |  |  |
120 |  |  |  |  | package # hide from PAUSE
121 | 1 | 2µs |  |  | FakeLocale;
122 |  |  |  |  |
123 | 2 | 25µs | 2 | 14µs | # spent 12µs (9+2) within FakeLocale::BEGIN@123 which was called: # once (9µs+2µs) by DateTime::Format::Alami::parse_datetime at line 123 use strict; # spent 12µs making 1 call to FakeLocale::BEGIN@123 # spent 2µs making 1 call to strict::import
124 | 2 | 24µs | 2 | 20µs | # spent 14µs (8+6) within FakeLocale::BEGIN@124 which was called: # once (8µs+6µs) by DateTime::Format::Alami::parse_datetime at line 124 use warnings; # spent 14µs making 1 call to FakeLocale::BEGIN@124 # spent 6µs making 1 call to warnings::import
125 |  |  |  |  |
126 | 2 | 142µs | 1 | 7µs | # spent 7µs within FakeLocale::BEGIN@126 which was called: # once (7µs+0s) by DateTime::Format::Alami::parse_datetime at line 126 use DateTime::Locale; # spent 7µs making 1 call to FakeLocale::BEGIN@126
127 |  |  |  |  |
128 | 1 | 200ns |  |  | my $Instance;
129 |  |  |  |  |
130 |  |  |  |  | # spent 118µs (13+105) within FakeLocale::instance which was called 2 times, avg 59µs/call: # once (8µs+105µs) by DateTime::Format::Alami::parse_datetime at line 78 # once (5µs+0s) by DateTime::Format::Alami::parse_datetime at line 103 sub instance {
131 | 2 | 15µs | 1 | 105µs | return $Instance ||= bless { locale => DateTime::Locale->load('en_US') }, # spent 105µs making 1 call to DateTime::Locale::load
132 |  |  |  |  | __PACKAGE__;
133 |  |  |  |  | }
134 |  |  |  |  |
135 |  |  |  |  | sub id {
136 |  |  |  |  | return 'infinite';
137 |  |  |  |  | }
138 |  |  |  |  |
139 |  |  |  |  | sub language_id {
140 |  |  |  |  | return 'infinite';
141 |  |  |  |  | }
142 |  |  |  |  |
143 |  |  |  |  | sub name {
144 |  |  |  |  | 'Fake locale for Infinite DateTime objects';
145 |  |  |  |  | }
146 |  |  |  |  |
147 |  |  |  |  | sub language {
148 |  |  |  |  | 'Fake locale for Infinite DateTime objects';
149 |  |  |  |  | }
150 |  |  |  |  |
151 | 1 | 3µs |  |  | my @methods = qw(
152 |  |  |  |  | script_id
153 |  |  |  |  | territory_id
154 |  |  |  |  | variant_id
155 |  |  |  |  | script
156 |  |  |  |  | territory
157 |  |  |  |  | variant
158 |  |  |  |  | native_name
159 |  |  |  |  | native_language
160 |  |  |  |  | native_script
161 |  |  |  |  | native_territory
162 |  |  |  |  | native_variant
163 |  |  |  |  | );
164 |  |  |  |  |
165 | 1 | 900ns |  |  | for my $meth (@methods) {
166 | 2 | 217µs | 2 | 30µs | # spent 19µs (8+11) within FakeLocale::BEGIN@166 which was called: # once (8µs+11µs) by DateTime::Format::Alami::parse_datetime at line 166 no strict 'refs'; # spent 19µs making 1 call to FakeLocale::BEGIN@166 # spent 11µs making 1 call to strict::unimport
167 | 11 | 42µs |  |  | *{$meth} = sub {undef};
168 |  |  |  |  | }
169 |  |  |  |  |
170 |  |  |  |  | # Totally arbitrary
171 |  |  |  |  | sub first_day_of_week {
172 |  |  |  |  | return 1;
173 |  |  |  |  | }
174 |  |  |  |  |
175 |  |  |  |  | sub prefers_24_hour_time {
176 |  |  |  |  | return 0;
177 |  |  |  |  | }
178 |  |  |  |  |
179 |  |  |  |  | our $AUTOLOAD;
180 |  |  |  |  |
181 |  |  |  |  | sub AUTOLOAD {
182 |  |  |  |  | my $self = shift;
183 |  |  |  |  |
184 |  |  |  |  | my ($meth) = $AUTOLOAD =~ /::(\w+)$/;
185 |  |  |  |  |
186 |  |  |  |  | if ( $meth =~ /format/ && $meth !~ /^(?:day|month|quarter)/ ) {
187 |  |  |  |  | return $self->{locale}->$meth(@_);
188 |  |  |  |  | }
189 |  |  |  |  |
190 |  |  |  |  | return [];
191 |  |  |  |  | }
192 |  |  |  |  |
193 | 1 | 20µs |  |  | 1;
194 |  |  |  |  |
195 |  |  |  |  | # ABSTRACT: Infinite past and future DateTime objects
196 |  |  |  |  |
197 |  |  |  |  | __END__