Filename | /usr/local/lib/perl/5.14.2/DateTime/Infinite.pm |
Statements | Executed 86 statements in 2.77ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 29µs | 37µs | BEGIN@6 | DateTime::Infinite::
2 | 2 | 1 | 21µs | 9.22ms | instance | FakeLocale::
1 | 1 | 1 | 20µs | 27µs | BEGIN@44 | DateTime::Infinite::Future::
1 | 1 | 1 | 18µs | 25µs | BEGIN@72 | DateTime::Infinite::Past::
1 | 1 | 1 | 17µs | 23µs | BEGIN@98 | FakeLocale::
1 | 1 | 1 | 17µs | 112µs | BEGIN@12 | DateTime::Infinite::
1 | 1 | 1 | 17µs | 29µs | BEGIN@7 | DateTime::Infinite::
1 | 1 | 1 | 16µs | 31µs | BEGIN@45 | DateTime::Infinite::Future::
1 | 1 | 1 | 15µs | 29µs | BEGIN@73 | DateTime::Infinite::Past::
1 | 1 | 1 | 15µs | 115µs | BEGIN@47 | DateTime::Infinite::Future::
1 | 1 | 1 | 15µs | 38µs | BEGIN@141 | FakeLocale::
1 | 1 | 1 | 14µs | 36µs | BEGIN@15 | DateTime::Infinite::
1 | 1 | 1 | 14µs | 102µs | BEGIN@75 | DateTime::Infinite::Past::
1 | 1 | 1 | 14µs | 27µs | BEGIN@99 | FakeLocale::
1 | 1 | 1 | 12µs | 12µs | BEGIN@101 | FakeLocale::
2 | 1 | 1 | 11µs | 11µs | _rd2ymd | DateTime::Infinite::
1 | 1 | 1 | 9µs | 9µs | BEGIN@10 | DateTime::Infinite::
1 | 1 | 1 | 9µs | 9µs | BEGIN@9 | DateTime::Infinite::
2 | 1 | 1 | 7µs | 7µ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__[:16] | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | _stringify | 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 | AUTOLOAD | FakeLocale::
0 | 0 | 0 | 0s | 0s | __ANON__[:142] | 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 | 2µs | $DateTime::Infinite::VERSION = '1.04'; | ||
4 | } | ||||
5 | |||||
6 | 2 | 67µs | 2 | 45µs | # spent 37µs (29+8) within DateTime::Infinite::BEGIN@6 which was called:
# once (29µs+8µs) by Value::Convertor::BEGIN@61 at line 6 # spent 37µs making 1 call to DateTime::Infinite::BEGIN@6
# spent 8µs making 1 call to strict::import |
7 | 2 | 49µs | 2 | 41µs | # spent 29µs (17+12) within DateTime::Infinite::BEGIN@7 which was called:
# once (17µs+12µs) by Value::Convertor::BEGIN@61 at line 7 # spent 29µs making 1 call to DateTime::Infinite::BEGIN@7
# spent 12µs making 1 call to warnings::import |
8 | |||||
9 | 2 | 45µs | 1 | 9µs | # spent 9µs within DateTime::Infinite::BEGIN@9 which was called:
# once (9µs+0s) by Value::Convertor::BEGIN@61 at line 9 # spent 9µs making 1 call to DateTime::Infinite::BEGIN@9 |
10 | 2 | 52µs | 1 | 9µs | # spent 9µs within DateTime::Infinite::BEGIN@10 which was called:
# once (9µs+0s) by Value::Convertor::BEGIN@61 at line 10 # spent 9µs making 1 call to DateTime::Infinite::BEGIN@10 |
11 | |||||
12 | 2 | 79µs | 2 | 207µs | # spent 112µs (17+95) within DateTime::Infinite::BEGIN@12 which was called:
# once (17µs+95µs) by Value::Convertor::BEGIN@61 at line 12 # spent 112µs making 1 call to DateTime::Infinite::BEGIN@12
# spent 95µs making 1 call to base::import |
13 | |||||
14 | 1 | 2µs | foreach my $m (qw( set set_time_zone truncate )) { | ||
15 | 2 | 448µs | 2 | 57µs | # spent 36µs (14+21) within DateTime::Infinite::BEGIN@15 which was called:
# once (14µs+21µs) by Value::Convertor::BEGIN@61 at line 15 # spent 36µs making 1 call to DateTime::Infinite::BEGIN@15
# spent 21µs making 1 call to strict::unimport |
16 | 6 | 37µs | *{"DateTime::Infinite::$m"} = sub { return $_[0] }; | ||
17 | } | ||||
18 | |||||
19 | sub is_finite {0} | ||||
20 | sub is_infinite {1} | ||||
21 | |||||
22 | # spent 11µs within DateTime::Infinite::_rd2ymd which was called 2 times, avg 6µs/call:
# 2 times (11µs+0s) by DateTime::_calc_local_components at line 451 of DateTime.pm, avg 6µs/call | ||||
23 | 2 | 18µs | return $_[2] ? ( $_[1] ) x 7 : ( $_[1] ) x 3; | ||
24 | } | ||||
25 | |||||
26 | # spent 7µs within DateTime::Infinite::_seconds_as_components which was called 2 times, avg 4µs/call:
# 2 times (7µs+0s) by DateTime::_calc_local_components at line 456 of DateTime.pm, avg 4µs/call | ||||
27 | 2 | 20µs | return ( $_[1] ) x 3; | ||
28 | } | ||||
29 | |||||
30 | sub _stringify { | ||||
31 | $_[0]->{utc_rd_days} == DateTime::INFINITY | ||||
32 | ? DateTime::INFINITY . '' | ||||
33 | : DateTime::NEG_INFINITY . ''; | ||||
34 | } | ||||
35 | |||||
36 | sub STORABLE_freeze {return} | ||||
37 | sub STORABLE_thaw {return} | ||||
38 | |||||
39 | package DateTime::Infinite::Future; | ||||
40 | { | ||||
41 | 2 | 1µs | $DateTime::Infinite::Future::VERSION = '1.04'; | ||
42 | } | ||||
43 | |||||
44 | 2 | 50µs | 2 | 33µs | # spent 27µs (20+7) within DateTime::Infinite::Future::BEGIN@44 which was called:
# once (20µs+7µs) by Value::Convertor::BEGIN@61 at line 44 # spent 27µs making 1 call to DateTime::Infinite::Future::BEGIN@44
# spent 7µs making 1 call to strict::import |
45 | 2 | 60µs | 2 | 46µs | # spent 31µs (16+15) within DateTime::Infinite::Future::BEGIN@45 which was called:
# once (16µs+15µs) by Value::Convertor::BEGIN@61 at line 45 # spent 31µs making 1 call to DateTime::Infinite::Future::BEGIN@45
# spent 15µs making 1 call to warnings::import |
46 | |||||
47 | 2 | 239µs | 2 | 214µs | # spent 115µs (15+100) within DateTime::Infinite::Future::BEGIN@47 which was called:
# once (15µs+100µs) by Value::Convertor::BEGIN@61 at line 47 # spent 115µs making 1 call to DateTime::Infinite::Future::BEGIN@47
# spent 100µs making 1 call to base::import |
48 | |||||
49 | { | ||||
50 | 2 | 156µs | 2 | 9.34ms | my $Pos = bless { # spent 9.21ms making 1 call to FakeLocale::instance
# spent 127µs making 1 call to DateTime::TimeZone::new |
51 | utc_rd_days => DateTime::INFINITY, | ||||
52 | utc_rd_secs => DateTime::INFINITY, | ||||
53 | local_rd_days => DateTime::INFINITY, | ||||
54 | local_rd_secs => DateTime::INFINITY, | ||||
55 | rd_nanosecs => DateTime::INFINITY, | ||||
56 | tz => DateTime::TimeZone->new( name => 'floating' ), | ||||
57 | locale => FakeLocale->instance(), | ||||
58 | }, | ||||
59 | __PACKAGE__; | ||||
60 | |||||
61 | 1 | 6µs | 1 | 68µs | $Pos->_calc_utc_rd; # spent 68µs making 1 call to DateTime::_calc_utc_rd |
62 | 1 | 7µs | 1 | 92µs | $Pos->_calc_local_rd; # spent 92µs making 1 call to DateTime::_calc_local_rd |
63 | |||||
64 | sub new {$Pos} | ||||
65 | } | ||||
66 | |||||
67 | package DateTime::Infinite::Past; | ||||
68 | { | ||||
69 | 2 | 2µs | $DateTime::Infinite::Past::VERSION = '1.04'; | ||
70 | } | ||||
71 | |||||
72 | 2 | 50µs | 2 | 31µs | # spent 25µs (18+6) within DateTime::Infinite::Past::BEGIN@72 which was called:
# once (18µs+6µs) by Value::Convertor::BEGIN@61 at line 72 # spent 25µs making 1 call to DateTime::Infinite::Past::BEGIN@72
# spent 6µs making 1 call to strict::import |
73 | 2 | 62µs | 2 | 43µs | # spent 29µs (15+14) within DateTime::Infinite::Past::BEGIN@73 which was called:
# once (15µs+14µs) by Value::Convertor::BEGIN@61 at line 73 # spent 29µs making 1 call to DateTime::Infinite::Past::BEGIN@73
# spent 14µs making 1 call to warnings::import |
74 | |||||
75 | 2 | 206µs | 2 | 191µs | # spent 102µs (14+88) within DateTime::Infinite::Past::BEGIN@75 which was called:
# once (14µs+88µs) by Value::Convertor::BEGIN@61 at line 75 # spent 102µs making 1 call to DateTime::Infinite::Past::BEGIN@75
# spent 88µs making 1 call to base::import |
76 | |||||
77 | { | ||||
78 | 2 | 147µs | 2 | 69µs | my $Neg = bless { # spent 67µs making 1 call to DateTime::TimeZone::new
# spent 2µs making 1 call to FakeLocale::instance |
79 | utc_rd_days => DateTime::NEG_INFINITY, | ||||
80 | utc_rd_secs => DateTime::NEG_INFINITY, | ||||
81 | local_rd_days => DateTime::NEG_INFINITY, | ||||
82 | local_rd_secs => DateTime::NEG_INFINITY, | ||||
83 | rd_nanosecs => DateTime::NEG_INFINITY, | ||||
84 | tz => DateTime::TimeZone->new( name => 'floating' ), | ||||
85 | locale => FakeLocale->instance(), | ||||
86 | }, | ||||
87 | __PACKAGE__; | ||||
88 | |||||
89 | 1 | 6µs | 1 | 31µs | $Neg->_calc_utc_rd; # spent 31µs making 1 call to DateTime::_calc_utc_rd |
90 | 1 | 7µs | 1 | 66µs | $Neg->_calc_local_rd; # spent 66µs making 1 call to DateTime::_calc_local_rd |
91 | |||||
92 | sub new {$Neg} | ||||
93 | } | ||||
94 | |||||
95 | package # hide from PAUSE | ||||
96 | FakeLocale; | ||||
97 | |||||
98 | 2 | 46µs | 2 | 29µs | # spent 23µs (17+6) within FakeLocale::BEGIN@98 which was called:
# once (17µs+6µs) by Value::Convertor::BEGIN@61 at line 98 # spent 23µs making 1 call to FakeLocale::BEGIN@98
# spent 6µs making 1 call to strict::import |
99 | 2 | 46µs | 2 | 41µs | # spent 27µs (14+14) within FakeLocale::BEGIN@99 which was called:
# once (14µs+14µs) by Value::Convertor::BEGIN@61 at line 99 # spent 27µs making 1 call to FakeLocale::BEGIN@99
# spent 14µs making 1 call to warnings::import |
100 | |||||
101 | 2 | 314µs | 1 | 12µs | # spent 12µs within FakeLocale::BEGIN@101 which was called:
# once (12µs+0s) by Value::Convertor::BEGIN@61 at line 101 # spent 12µs making 1 call to FakeLocale::BEGIN@101 |
102 | |||||
103 | 1 | 200ns | my $Instance; | ||
104 | |||||
105 | sub instance { | ||||
106 | 2 | 23µs | 1 | 9.19ms | return $Instance ||= bless { locale => DateTime::Locale->load('en_US') }, # spent 9.19ms making 1 call to DateTime::Locale::load |
107 | __PACKAGE__; | ||||
108 | } | ||||
109 | |||||
110 | sub id { | ||||
111 | return 'infinite'; | ||||
112 | } | ||||
113 | |||||
114 | sub language_id { | ||||
115 | return 'infinite'; | ||||
116 | } | ||||
117 | |||||
118 | sub name { | ||||
119 | 'Fake locale for Infinite DateTime objects'; | ||||
120 | } | ||||
121 | |||||
122 | sub language { | ||||
123 | 'Fake locale for Infinite DateTime objects'; | ||||
124 | } | ||||
125 | |||||
126 | 1 | 5µs | my @methods = qw( | ||
127 | script_id | ||||
128 | territory_id | ||||
129 | variant_id | ||||
130 | script | ||||
131 | territory | ||||
132 | variant | ||||
133 | native_name | ||||
134 | native_language | ||||
135 | native_script | ||||
136 | native_territory | ||||
137 | native_variant | ||||
138 | ); | ||||
139 | |||||
140 | 1 | 2µs | for my $meth (@methods) { | ||
141 | 2 | 409µs | 2 | 61µs | # spent 38µs (15+23) within FakeLocale::BEGIN@141 which was called:
# once (15µs+23µs) by Value::Convertor::BEGIN@61 at line 141 # spent 38µs making 1 call to FakeLocale::BEGIN@141
# spent 23µs making 1 call to strict::unimport |
142 | 22 | 73µs | *{$meth} = sub { undef }; | ||
143 | } | ||||
144 | |||||
145 | # Totally arbitrary | ||||
146 | sub first_day_of_week { | ||||
147 | return 1; | ||||
148 | } | ||||
149 | |||||
150 | sub prefers_24_hour_time { | ||||
151 | return 0; | ||||
152 | } | ||||
153 | |||||
154 | 1 | 200ns | our $AUTOLOAD; | ||
155 | sub AUTOLOAD { | ||||
156 | my $self = shift; | ||||
157 | |||||
158 | my ($meth) = $AUTOLOAD =~ /::(\w+)$/; | ||||
159 | |||||
160 | if ( $meth =~ /format/ && $meth !~ /^(?:day|month|quarter)/ ) { | ||||
161 | return $self->{locale}->$meth(@_); | ||||
162 | } | ||||
163 | |||||
164 | return []; | ||||
165 | } | ||||
166 | |||||
167 | 1 | 36µs | 1; | ||
168 | |||||
169 | # ABSTRACT: Infinite past and future DateTime objects | ||||
170 | |||||
171 | __END__ |