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 |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.82ms | 2.04ms | BEGIN@11 | DateTime::Infinite::
1 | 1 | 1 | 20µs | 24µs | BEGIN@3 | DateTime::Infinite::
2 | 2 | 1 | 13µs | 118µs | instance | FakeLocale::
1 | 1 | 1 | 11µs | 13µs | BEGIN@72 | DateTime::Infinite::Future::
1 | 1 | 1 | 10µs | 12µs | BEGIN@97 | DateTime::Infinite::Past::
1 | 1 | 1 | 10µs | 18µs | BEGIN@4 | DateTime::Infinite::
1 | 1 | 1 | 9µs | 12µs | BEGIN@123 | FakeLocale::
1 | 1 | 1 | 9µs | 21µs | BEGIN@14 | DateTime::Infinite::
1 | 1 | 1 | 9µs | 18µs | BEGIN@73 | DateTime::Infinite::Future::
1 | 1 | 1 | 8µs | 15µs | BEGIN@98 | DateTime::Infinite::Past::
2 | 1 | 1 | 8µs | 8µs | _rd2ymd | DateTime::Infinite::
1 | 1 | 1 | 8µs | 64µs | BEGIN@100 | DateTime::Infinite::Past::
1 | 1 | 1 | 8µs | 66µs | BEGIN@75 | DateTime::Infinite::Future::
1 | 1 | 1 | 8µs | 19µs | BEGIN@166 | FakeLocale::
1 | 1 | 1 | 8µs | 14µs | BEGIN@124 | FakeLocale::
1 | 1 | 1 | 7µs | 7µs | BEGIN@126 | FakeLocale::
1 | 1 | 1 | 6µs | 6µs | BEGIN@8 | DateTime::Infinite::
1 | 1 | 1 | 5µs | 5µs | BEGIN@9 | DateTime::Infinite::
2 | 1 | 1 | 5µs | 5µs | _seconds_as_components | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | new | DateTime::Infinite::Future::
0 | 0 | 0 | 0s | 0s | new | DateTime::Infinite::Past::
0 | 0 | 0 | 0s | 0s | STORABLE_freeze | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | STORABLE_thaw | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | __ANON__[:15] | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | _infinity_string | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | _stringify | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | dmy | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | hms | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | hour_12 | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | hour_12_0 | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | is_finite | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | is_infinite | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | iso8601 | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | mdy | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | ymd | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | AUTOLOAD | FakeLocale::
0 | 0 | 0 | 0s | 0s | __ANON__[:167] | FakeLocale::
0 | 0 | 0 | 0s | 0s | first_day_of_week | FakeLocale::
0 | 0 | 0 | 0s | 0s | id | FakeLocale::
0 | 0 | 0 | 0s | 0s | language | FakeLocale::
0 | 0 | 0 | 0s | 0s | language_id | FakeLocale::
0 | 0 | 0 | 0s | 0s | name | FakeLocale::
0 | 0 | 0 | 0s | 0s | prefers_24_hour_time | FakeLocale::
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 # 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 # 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 # 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 # 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 # 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 # 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 | ||||
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 | ||||
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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # 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 # spent 7µs making 1 call to FakeLocale::BEGIN@126 |
127 | |||||
128 | 1 | 200ns | my $Instance; | ||
129 | |||||
130 | 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 # 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__ |