Filename | /usr/local/lib/perl/5.14.2/DateTime/Infinite.pm |
Statements | Executed 86 statements in 1.19ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 16µs | 19µs | BEGIN@98 | FakeLocale::
1 | 1 | 1 | 14µs | 17µs | BEGIN@6 | DateTime::Infinite::
2 | 2 | 1 | 9µs | 4.12ms | instance | FakeLocale::
1 | 1 | 1 | 9µs | 18µs | BEGIN@141 | FakeLocale::
1 | 1 | 1 | 8µs | 11µs | BEGIN@44 | DateTime::Infinite::Future::
1 | 1 | 1 | 8µs | 14µs | BEGIN@7 | DateTime::Infinite::
1 | 1 | 1 | 7µs | 10µs | BEGIN@72 | DateTime::Infinite::Past::
1 | 1 | 1 | 7µs | 50µs | BEGIN@12 | DateTime::Infinite::
1 | 1 | 1 | 6µs | 14µs | BEGIN@45 | DateTime::Infinite::Future::
1 | 1 | 1 | 6µs | 12µs | BEGIN@73 | DateTime::Infinite::Past::
1 | 1 | 1 | 6µs | 45µs | BEGIN@75 | DateTime::Infinite::Past::
1 | 1 | 1 | 6µs | 12µs | BEGIN@99 | FakeLocale::
1 | 1 | 1 | 6µs | 52µs | BEGIN@47 | DateTime::Infinite::Future::
1 | 1 | 1 | 6µs | 16µs | BEGIN@15 | DateTime::Infinite::
1 | 1 | 1 | 5µs | 5µs | BEGIN@101 | FakeLocale::
2 | 1 | 1 | 5µs | 5µs | _rd2ymd | DateTime::Infinite::
1 | 1 | 1 | 4µs | 4µs | BEGIN@9 | DateTime::Infinite::
1 | 1 | 1 | 4µs | 4µs | BEGIN@10 | 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__[: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 | 900ns | $DateTime::Infinite::VERSION = '1.04'; | ||
4 | } | ||||
5 | |||||
6 | 2 | 29µs | 2 | 21µs | # spent 17µs (14+4) within DateTime::Infinite::BEGIN@6 which was called:
# once (14µs+4µs) by Value::Convertor::BEGIN@61 at line 6 # spent 17µs making 1 call to DateTime::Infinite::BEGIN@6
# spent 4µs making 1 call to strict::import |
7 | 2 | 23µs | 2 | 21µs | # spent 14µs (8+7) within DateTime::Infinite::BEGIN@7 which was called:
# once (8µs+7µs) by Value::Convertor::BEGIN@61 at line 7 # spent 14µs making 1 call to DateTime::Infinite::BEGIN@7
# spent 7µs making 1 call to warnings::import |
8 | |||||
9 | 2 | 19µs | 1 | 4µs | # spent 4µs within DateTime::Infinite::BEGIN@9 which was called:
# once (4µs+0s) by Value::Convertor::BEGIN@61 at line 9 # spent 4µs making 1 call to DateTime::Infinite::BEGIN@9 |
10 | 2 | 22µs | 1 | 4µs | # spent 4µs within DateTime::Infinite::BEGIN@10 which was called:
# once (4µs+0s) by Value::Convertor::BEGIN@61 at line 10 # spent 4µs making 1 call to DateTime::Infinite::BEGIN@10 |
11 | |||||
12 | 2 | 34µs | 2 | 92µs | # spent 50µs (7+43) within DateTime::Infinite::BEGIN@12 which was called:
# once (7µs+43µs) by Value::Convertor::BEGIN@61 at line 12 # spent 50µs making 1 call to DateTime::Infinite::BEGIN@12
# spent 43µs making 1 call to base::import |
13 | |||||
14 | 1 | 1µs | foreach my $m (qw( set set_time_zone truncate )) { | ||
15 | 2 | 186µs | 2 | 26µs | # spent 16µs (6+10) within DateTime::Infinite::BEGIN@15 which was called:
# once (6µs+10µs) by Value::Convertor::BEGIN@61 at line 15 # spent 16µs making 1 call to DateTime::Infinite::BEGIN@15
# spent 10µs making 1 call to strict::unimport |
16 | 6 | 16µs | *{"DateTime::Infinite::$m"} = sub { return $_[0] }; | ||
17 | } | ||||
18 | |||||
19 | sub is_finite {0} | ||||
20 | sub is_infinite {1} | ||||
21 | |||||
22 | # spent 5µs within DateTime::Infinite::_rd2ymd which was called 2 times, avg 2µs/call:
# 2 times (5µs+0s) by DateTime::_calc_local_components at line 451 of DateTime.pm, avg 2µs/call | ||||
23 | 2 | 7µs | return $_[2] ? ( $_[1] ) x 7 : ( $_[1] ) x 3; | ||
24 | } | ||||
25 | |||||
26 | # spent 3µs within DateTime::Infinite::_seconds_as_components which was called 2 times, avg 2µs/call:
# 2 times (3µs+0s) by DateTime::_calc_local_components at line 456 of DateTime.pm, avg 2µs/call | ||||
27 | 2 | 10µ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 | 500ns | $DateTime::Infinite::Future::VERSION = '1.04'; | ||
42 | } | ||||
43 | |||||
44 | 2 | 21µs | 2 | 14µs | # spent 11µs (8+3) within DateTime::Infinite::Future::BEGIN@44 which was called:
# once (8µs+3µs) by Value::Convertor::BEGIN@61 at line 44 # spent 11µs making 1 call to DateTime::Infinite::Future::BEGIN@44
# spent 3µs making 1 call to strict::import |
45 | 2 | 23µs | 2 | 22µs | # spent 14µs (6+8) within DateTime::Infinite::Future::BEGIN@45 which was called:
# once (6µs+8µs) by Value::Convertor::BEGIN@61 at line 45 # spent 14µs making 1 call to DateTime::Infinite::Future::BEGIN@45
# spent 8µs making 1 call to warnings::import |
46 | |||||
47 | 2 | 103µs | 2 | 98µs | # spent 52µs (6+46) within DateTime::Infinite::Future::BEGIN@47 which was called:
# once (6µs+46µs) by Value::Convertor::BEGIN@61 at line 47 # spent 52µs making 1 call to DateTime::Infinite::Future::BEGIN@47
# spent 46µs making 1 call to base::import |
48 | |||||
49 | { | ||||
50 | 4 | 73µs | 2 | 4.17ms | my $Pos = bless { # spent 4.12ms making 1 call to FakeLocale::instance
# spent 55µ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 | 38µs | $Pos->_calc_utc_rd; # spent 38µs making 1 call to DateTime::_calc_utc_rd | ||
62 | 1 | 40µs | $Pos->_calc_local_rd; # spent 40µs making 1 call to DateTime::_calc_local_rd | ||
63 | |||||
64 | sub new {$Pos} | ||||
65 | } | ||||
66 | |||||
67 | package DateTime::Infinite::Past; | ||||
68 | { | ||||
69 | 2 | 600ns | $DateTime::Infinite::Past::VERSION = '1.04'; | ||
70 | } | ||||
71 | |||||
72 | 2 | 21µs | 2 | 13µs | # spent 10µs (7+3) within DateTime::Infinite::Past::BEGIN@72 which was called:
# once (7µs+3µs) by Value::Convertor::BEGIN@61 at line 72 # spent 10µs making 1 call to DateTime::Infinite::Past::BEGIN@72
# spent 3µs making 1 call to strict::import |
73 | 2 | 27µs | 2 | 18µs | # spent 12µs (6+6) within DateTime::Infinite::Past::BEGIN@73 which was called:
# once (6µs+6µs) by Value::Convertor::BEGIN@61 at line 73 # spent 12µs making 1 call to DateTime::Infinite::Past::BEGIN@73
# spent 6µs making 1 call to warnings::import |
74 | |||||
75 | 2 | 87µs | 2 | 84µs | # spent 45µs (6+39) within DateTime::Infinite::Past::BEGIN@75 which was called:
# once (6µs+39µs) by Value::Convertor::BEGIN@61 at line 75 # spent 45µs making 1 call to DateTime::Infinite::Past::BEGIN@75
# spent 39µs making 1 call to base::import |
76 | |||||
77 | { | ||||
78 | 4 | 69µs | 2 | 30µs | my $Neg = bless { # spent 29µs making 1 call to DateTime::TimeZone::new
# spent 1µ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 | 14µs | $Neg->_calc_utc_rd; # spent 14µs making 1 call to DateTime::_calc_utc_rd | ||
90 | 1 | 29µs | $Neg->_calc_local_rd; # spent 29µ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 | 21µs | 2 | 22µs | # spent 19µs (16+3) within FakeLocale::BEGIN@98 which was called:
# once (16µs+3µs) by Value::Convertor::BEGIN@61 at line 98 # spent 19µs making 1 call to FakeLocale::BEGIN@98
# spent 3µs making 1 call to strict::import |
99 | 2 | 20µs | 2 | 18µs | # spent 12µs (6+6) within FakeLocale::BEGIN@99 which was called:
# once (6µs+6µs) by Value::Convertor::BEGIN@61 at line 99 # spent 12µs making 1 call to FakeLocale::BEGIN@99
# spent 6µs making 1 call to warnings::import |
100 | |||||
101 | 2 | 139µs | 1 | 5µs | # spent 5µs within FakeLocale::BEGIN@101 which was called:
# once (5µs+0s) by Value::Convertor::BEGIN@61 at line 101 # spent 5µs making 1 call to FakeLocale::BEGIN@101 |
102 | |||||
103 | 1 | 100ns | my $Instance; | ||
104 | |||||
105 | sub instance { | ||||
106 | 2 | 10µs | 1 | 4.11ms | return $Instance ||= bless { locale => DateTime::Locale->load('en_US') }, # spent 4.11ms 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 | 2µ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 | 900ns | for my $meth (@methods) { | ||
141 | 2 | 176µs | 2 | 28µs | # spent 18µs (9+10) within FakeLocale::BEGIN@141 which was called:
# once (9µs+10µs) by Value::Convertor::BEGIN@61 at line 141 # spent 18µs making 1 call to FakeLocale::BEGIN@141
# spent 10µs making 1 call to strict::unimport |
142 | 22 | 32µ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 | 100ns | 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 | 15µs | 1; | ||
168 | |||||
169 | # ABSTRACT: Infinite past and future DateTime objects | ||||
170 | |||||
171 | __END__ |