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.40ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.21ms | 1.37ms | BEGIN@11 | DateTime::Infinite::
1 | 1 | 1 | 15µs | 18µs | BEGIN@3 | DateTime::Infinite::
1 | 1 | 1 | 11µs | 12µs | BEGIN@97 | DateTime::Infinite::Past::
1 | 1 | 1 | 10µs | 28µs | BEGIN@14 | DateTime::Infinite::
1 | 1 | 1 | 9µs | 12µs | BEGIN@72 | DateTime::Infinite::Future::
1 | 1 | 1 | 8µs | 20µs | BEGIN@73 | DateTime::Infinite::Future::
2 | 2 | 1 | 7µs | 79µs | instance | FakeLocale::
1 | 1 | 1 | 7µs | 16µs | BEGIN@4 | DateTime::Infinite::
1 | 1 | 1 | 7µs | 9µs | BEGIN@123 | FakeLocale::
1 | 1 | 1 | 7µs | 12µs | BEGIN@98 | DateTime::Infinite::Past::
1 | 1 | 1 | 6µs | 58µs | BEGIN@75 | DateTime::Infinite::Future::
1 | 1 | 1 | 6µs | 12µs | BEGIN@124 | FakeLocale::
1 | 1 | 1 | 6µs | 16µs | BEGIN@166 | FakeLocale::
1 | 1 | 1 | 6µs | 48µs | BEGIN@100 | DateTime::Infinite::Past::
2 | 1 | 1 | 5µs | 5µs | _rd2ymd | DateTime::Infinite::
1 | 1 | 1 | 5µs | 5µs | BEGIN@126 | FakeLocale::
1 | 1 | 1 | 5µs | 5µs | BEGIN@8 | DateTime::Infinite::
1 | 1 | 1 | 4µs | 4µs | BEGIN@9 | DateTime::Infinite::
2 | 1 | 1 | 3µs | 3µ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 | 24µs | 2 | 21µs | # spent 18µs (15+3) within DateTime::Infinite::BEGIN@3 which was called:
# once (15µs+3µs) by DateTime::Format::Alami::parse_datetime at line 3 # spent 18µs making 1 call to DateTime::Infinite::BEGIN@3
# spent 3µs making 1 call to strict::import |
4 | 2 | 31µs | 2 | 25µs | # spent 16µs (7+9) within DateTime::Infinite::BEGIN@4 which was called:
# once (7µs+9µs) by DateTime::Format::Alami::parse_datetime at line 4 # spent 16µs making 1 call to DateTime::Infinite::BEGIN@4
# spent 9µs making 1 call to warnings::import |
5 | |||||
6 | 1 | 900ns | our $VERSION = '1.27'; | ||
7 | |||||
8 | 2 | 19µs | 1 | 5µs | # spent 5µs within DateTime::Infinite::BEGIN@8 which was called:
# once (5µs+0s) by DateTime::Format::Alami::parse_datetime at line 8 # spent 5µs making 1 call to DateTime::Infinite::BEGIN@8 |
9 | 2 | 21µs | 1 | 4µs | # spent 4µs within DateTime::Infinite::BEGIN@9 which was called:
# once (4µs+0s) by DateTime::Format::Alami::parse_datetime at line 9 # spent 4µs making 1 call to DateTime::Infinite::BEGIN@9 |
10 | |||||
11 | 2 | 308µs | 2 | 1.47ms | # spent 1.37ms (1.21+164µs) within DateTime::Infinite::BEGIN@11 which was called:
# once (1.21ms+164µs) by DateTime::Format::Alami::parse_datetime at line 11 # spent 1.37ms making 1 call to DateTime::Infinite::BEGIN@11
# spent 98µs making 1 call to base::import |
12 | |||||
13 | 1 | 800ns | foreach my $m (qw( set set_time_zone truncate )) { | ||
14 | 2 | 293µs | 2 | 45µs | # spent 28µs (10+17) within DateTime::Infinite::BEGIN@14 which was called:
# once (10µs+17µs) by DateTime::Format::Alami::parse_datetime at line 14 # spent 28µs making 1 call to DateTime::Infinite::BEGIN@14
# spent 17µs making 1 call to strict::unimport |
15 | 3 | 13µs | *{"DateTime::Infinite::$m"} = sub { return $_[0] }; | ||
16 | } | ||||
17 | |||||
18 | sub is_finite {0} | ||||
19 | sub is_infinite {1} | ||||
20 | |||||
21 | # spent 5µs within DateTime::Infinite::_rd2ymd which was called 2 times, avg 3µs/call:
# 2 times (5µs+0s) by DateTime::_calc_local_components at line 471 of DateTime.pm, avg 3µs/call | ||||
22 | 2 | 8µs | return $_[2] ? ( $_[1] ) x 7 : ( $_[1] ) x 3; | ||
23 | } | ||||
24 | |||||
25 | # spent 3µs within DateTime::Infinite::_seconds_as_components which was called 2 times, avg 1µs/call:
# 2 times (3µs+0s) by DateTime::_calc_local_components at line 477 of DateTime.pm, avg 1µs/call | ||||
26 | 2 | 6µ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 | 23µs | 2 | 14µs | # spent 12µs (9+2) within DateTime::Infinite::Future::BEGIN@72 which was called:
# once (9µs+2µs) by DateTime::Format::Alami::parse_datetime at line 72 # spent 12µs making 1 call to DateTime::Infinite::Future::BEGIN@72
# spent 2µs making 1 call to strict::import |
73 | 2 | 24µs | 2 | 32µs | # spent 20µs (8+12) within DateTime::Infinite::Future::BEGIN@73 which was called:
# once (8µs+12µs) by DateTime::Format::Alami::parse_datetime at line 73 # spent 20µs making 1 call to DateTime::Infinite::Future::BEGIN@73
# spent 12µs making 1 call to warnings::import |
74 | |||||
75 | 2 | 82µs | 2 | 110µs | # spent 58µs (6+52) within DateTime::Infinite::Future::BEGIN@75 which was called:
# once (6µs+52µs) by DateTime::Format::Alami::parse_datetime at line 75 # spent 58µs making 1 call to DateTime::Infinite::Future::BEGIN@75
# spent 52µs making 1 call to base::import |
76 | |||||
77 | { | ||||
78 | 1 | 9µs | 2 | 147µs | my $Pos = bless { # spent 76µs making 1 call to FakeLocale::instance
# spent 71µ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 | 4µs | 1 | 73µs | $Pos->_calc_utc_rd; # spent 73µs making 1 call to DateTime::_calc_utc_rd |
90 | 1 | 3µs | 1 | 44µs | $Pos->_calc_local_rd; # spent 44µs making 1 call to DateTime::_calc_local_rd |
91 | |||||
92 | sub new {$Pos} | ||||
93 | } | ||||
94 | |||||
95 | 1 | 1µs | package DateTime::Infinite::Past; | ||
96 | |||||
97 | 2 | 20µs | 2 | 14µs | # spent 12µs (11+2) within DateTime::Infinite::Past::BEGIN@97 which was called:
# once (11µ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 | 22µs | 2 | 17µs | # spent 12µs (7+5) within DateTime::Infinite::Past::BEGIN@98 which was called:
# once (7µs+5µs) by DateTime::Format::Alami::parse_datetime at line 98 # spent 12µs making 1 call to DateTime::Infinite::Past::BEGIN@98
# spent 5µs making 1 call to warnings::import |
99 | |||||
100 | 2 | 86µs | 2 | 89µs | # spent 48µs (6+41) within DateTime::Infinite::Past::BEGIN@100 which was called:
# once (6µs+41µs) by DateTime::Format::Alami::parse_datetime at line 100 # spent 48µs making 1 call to DateTime::Infinite::Past::BEGIN@100
# spent 41µs making 1 call to base::import |
101 | |||||
102 | { | ||||
103 | 1 | 5µs | 2 | 25µs | my $Neg = bless { # spent 22µs making 1 call to DateTime::TimeZone::new
# spent 3µ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 | 3µs | 1 | 42µs | $Neg->_calc_utc_rd; # spent 42µs making 1 call to DateTime::_calc_utc_rd |
115 | 1 | 2µs | 1 | 26µs | $Neg->_calc_local_rd; # spent 26µs making 1 call to DateTime::_calc_local_rd |
116 | |||||
117 | sub new {$Neg} | ||||
118 | } | ||||
119 | |||||
120 | package # hide from PAUSE | ||||
121 | 1 | 700ns | FakeLocale; | ||
122 | |||||
123 | 2 | 21µs | 2 | 11µs | # spent 9µs (7+2) within FakeLocale::BEGIN@123 which was called:
# once (7µs+2µs) by DateTime::Format::Alami::parse_datetime at line 123 # spent 9µs making 1 call to FakeLocale::BEGIN@123
# spent 2µs making 1 call to strict::import |
124 | 2 | 32µs | 2 | 17µs | # spent 12µs (6+5) within FakeLocale::BEGIN@124 which was called:
# once (6µs+5µs) by DateTime::Format::Alami::parse_datetime at line 124 # spent 12µs making 1 call to FakeLocale::BEGIN@124
# spent 5µs making 1 call to warnings::import |
125 | |||||
126 | 2 | 110µs | 1 | 5µs | # spent 5µs within FakeLocale::BEGIN@126 which was called:
# once (5µs+0s) by DateTime::Format::Alami::parse_datetime at line 126 # spent 5µs making 1 call to FakeLocale::BEGIN@126 |
127 | |||||
128 | 1 | 200ns | my $Instance; | ||
129 | |||||
130 | sub instance { | ||||
131 | 2 | 9µs | 1 | 72µs | return $Instance ||= bless { locale => DateTime::Locale->load('en_US') }, # spent 72µ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 | 1µ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 | 600ns | for my $meth (@methods) { | ||
166 | 2 | 181µs | 2 | 25µs | # spent 16µs (6+10) within FakeLocale::BEGIN@166 which was called:
# once (6µs+10µs) by DateTime::Format::Alami::parse_datetime at line 166 # spent 16µs making 1 call to FakeLocale::BEGIN@166
# spent 10µs making 1 call to strict::unimport |
167 | 11 | 23µ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 | 11µs | 1; | ||
194 | |||||
195 | # ABSTRACT: Infinite past and future DateTime objects | ||||
196 | |||||
197 | __END__ |