← Index
NYTProf Performance Profile   « line view »
For script/ponapi
  Run on Wed Feb 10 15:51:26 2016
Reported on Thu Feb 11 09:43:11 2016

Filename/usr/local/share/perl/5.18.2/POSIX/strftime/Compiler.pm
StatementsExecuted 68 statements in 2.64ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111985µs1.25msPOSIX::strftime::Compiler::::BEGIN@7POSIX::strftime::Compiler::BEGIN@7
111539µs580µsPOSIX::strftime::Compiler::::compilePOSIX::strftime::Compiler::compile
11153µs53µsPOSIX::strftime::Compiler::::BEGIN@29POSIX::strftime::Compiler::BEGIN@29
11128µs700µsPOSIX::strftime::Compiler::::strftimePOSIX::strftime::Compiler::strftime
11118µs18µsPOSIX::strftime::Compiler::::__ANON__[:293]POSIX::strftime::Compiler::__ANON__[:293]
11115µs15µsPOSIX::strftime::Compiler::::BEGIN@3POSIX::strftime::Compiler::BEGIN@3
11112µs124µsPOSIX::strftime::Compiler::::BEGIN@14POSIX::strftime::Compiler::BEGIN@14
43111µs11µsPOSIX::strftime::Compiler::::CORE:matchPOSIX::strftime::Compiler::CORE:match (opcode)
11110µs73µsPOSIX::strftime::Compiler::::BEGIN@9POSIX::strftime::Compiler::BEGIN@9
4419µs9µsPOSIX::strftime::Compiler::::CORE:substPOSIX::strftime::Compiler::CORE:subst (opcode)
1116µs18µsPOSIX::strftime::Compiler::::BEGIN@34POSIX::strftime::Compiler::BEGIN@34
1116µs10µsPOSIX::strftime::Compiler::::BEGIN@5POSIX::strftime::Compiler::BEGIN@5
1116µs34µsPOSIX::strftime::Compiler::::BEGIN@6POSIX::strftime::Compiler::BEGIN@6
1115µs14µsPOSIX::strftime::Compiler::::BEGIN@4POSIX::strftime::Compiler::BEGIN@4
1114µs4µsPOSIX::strftime::Compiler::::BEGIN@8POSIX::strftime::Compiler::BEGIN@8
2114µs4µsPOSIX::strftime::Compiler::::CORE:substcontPOSIX::strftime::Compiler::CORE:substcont (opcode)
0000s0sPOSIX::strftime::Compiler::::__ANON__[:283]POSIX::strftime::Compiler::__ANON__[:283]
0000s0sPOSIX::strftime::Compiler::::_tznamePOSIX::strftime::Compiler::_tzname
0000s0sPOSIX::strftime::Compiler::::_tzoffsetPOSIX::strftime::Compiler::_tzoffset
0000s0sPOSIX::strftime::Compiler::::code_refPOSIX::strftime::Compiler::code_ref
0000s0sPOSIX::strftime::Compiler::::isleapPOSIX::strftime::Compiler::isleap
0000s0sPOSIX::strftime::Compiler::::iso_week_daysPOSIX::strftime::Compiler::iso_week_days
0000s0sPOSIX::strftime::Compiler::::isodaysnumPOSIX::strftime::Compiler::isodaysnum
0000s0sPOSIX::strftime::Compiler::::isoweeknumPOSIX::strftime::Compiler::isoweeknum
0000s0sPOSIX::strftime::Compiler::::isoyearnumPOSIX::strftime::Compiler::isoyearnum
0000s0sPOSIX::strftime::Compiler::::newPOSIX::strftime::Compiler::new
0000s0sPOSIX::strftime::Compiler::::to_stringPOSIX::strftime::Compiler::to_string
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package POSIX::strftime::Compiler;
2
3236µs115µs
# spent 15µs within POSIX::strftime::Compiler::BEGIN@3 which was called: # once (15µs+0s) by Apache::LogFormat::Compiler::BEGIN@7 at line 3
use 5.008001;
# spent 15µs making 1 call to POSIX::strftime::Compiler::BEGIN@3
4217µs224µs
# spent 14µs (5+9) within POSIX::strftime::Compiler::BEGIN@4 which was called: # once (5µs+9µs) by Apache::LogFormat::Compiler::BEGIN@7 at line 4
use strict;
# spent 14µs making 1 call to POSIX::strftime::Compiler::BEGIN@4 # spent 9µs making 1 call to strict::import
5217µs213µs
# spent 10µs (6+4) within POSIX::strftime::Compiler::BEGIN@5 which was called: # once (6µs+4µs) by Apache::LogFormat::Compiler::BEGIN@7 at line 5
use warnings;
# spent 10µs making 1 call to POSIX::strftime::Compiler::BEGIN@5 # spent 4µs making 1 call to warnings::import
6222µs262µs
# spent 34µs (6+28) within POSIX::strftime::Compiler::BEGIN@6 which was called: # once (6µs+28µs) by Apache::LogFormat::Compiler::BEGIN@7 at line 6
use Carp;
# spent 34µs making 1 call to POSIX::strftime::Compiler::BEGIN@6 # spent 28µs making 1 call to Exporter::import
72160µs11.25ms
# spent 1.25ms (985µs+266µs) within POSIX::strftime::Compiler::BEGIN@7 which was called: # once (985µs+266µs) by Apache::LogFormat::Compiler::BEGIN@7 at line 7
use Time::Local qw//;
# spent 1.25ms making 1 call to POSIX::strftime::Compiler::BEGIN@7
8220µs14µs
# spent 4µs within POSIX::strftime::Compiler::BEGIN@8 which was called: # once (4µs+0s) by Apache::LogFormat::Compiler::BEGIN@7 at line 8
use POSIX qw//;
# spent 4µs making 1 call to POSIX::strftime::Compiler::BEGIN@8
9272µs2136µs
# spent 73µs (10+63) within POSIX::strftime::Compiler::BEGIN@9 which was called: # once (10µs+63µs) by Apache::LogFormat::Compiler::BEGIN@7 at line 9
use base qw/Exporter/;
# spent 73µs making 1 call to POSIX::strftime::Compiler::BEGIN@9 # spent 63µs making 1 call to base::import
10
111400nsour $VERSION = "0.32";
121800nsour @EXPORT_OK = qw/strftime/;
13
14
# spent 124µs (12+111) within POSIX::strftime::Compiler::BEGIN@14 which was called: # once (12µs+111µs) by Apache::LogFormat::Compiler::BEGIN@7 at line 27
use constant {
15110µs1111µs SEC => 0,
# spent 111µs making 1 call to constant::import
16 MIN => 1,
17 HOUR => 2,
18 DAY => 3,
19 MONTH => 4,
20 YEAR => 5,
21 WDAY => 6,
22 YDAY => 7,
23 ISDST => 8,
24 ISO_WEEK_START_WDAY => 1, # Monday
25 ISO_WEEK1_WDAY => 4, # Thursday
26 YDAY_MINIMUM => -366,
27147µs1124µs};
# spent 124µs making 1 call to POSIX::strftime::Compiler::BEGIN@14
28
29
# spent 53µs within POSIX::strftime::Compiler::BEGIN@29 which was called: # once (53µs+0s) by Apache::LogFormat::Compiler::BEGIN@7 at line 37
BEGIN {
3011µs *tzoffset = \&_tzoffset;
311800ns *tzname = \&_tzname;
32
33252µs if (eval { require Time::TZOffset; 1; }) {
34229µs230µs
# spent 18µs (6+12) within POSIX::strftime::Compiler::BEGIN@34 which was called: # once (6µs+12µs) by Apache::LogFormat::Compiler::BEGIN@7 at line 34
no warnings 'redefine';
# spent 18µs making 1 call to POSIX::strftime::Compiler::BEGIN@34 # spent 12µs making 1 call to warnings::unimport
35 *tzoffset = \&Time::TZOffset::tzoffset;
36 }
3711.39ms153µs}
# spent 53µs making 1 call to POSIX::strftime::Compiler::BEGIN@29
38
39
40# copy from POSIX/strftime/GNU/PP.pm and modify
41139µsmy @offset2zone = qw(
42 -1100 0 SST -1100 0 SST
43 -1000 0 HAST -0900 1 HADT
44 -1000 0 HST -1000 0 HST
45 -0930 0 MART -0930 0 MART
46 -0900 0 AKST -0800 1 AKDT
47 -0900 0 GAMT -0900 0 GAMT
48 -0800 0 PST -0700 1 PDT
49 -0800 0 PST -0800 0 PST
50 -0700 0 MST -0600 1 MDT
51 -0700 0 MST -0700 0 MST
52 -0600 0 CST -0500 1 CDT
53 -0600 0 GALT -0600 0 GALT
54 -0500 0 ECT -0500 0 ECT
55 -0500 0 EST -0400 1 EDT
56 -0500 1 EASST -0600 0 EAST
57 -0430 0 VET -0430 0 VET
58 -0400 0 AMT -0400 0 AMT
59 -0400 0 AST -0300 1 ADT
60 -0330 0 NST -0230 1 NDT
61 -0300 0 ART -0300 0 ART
62 -0300 0 PMST -0200 1 PMDT
63 -0300 1 AMST -0400 0 AMT
64 -0300 1 WARST -0300 1 WARST
65 -0200 0 FNT -0200 0 FNT
66 -0200 1 UYST -0300 0 UYT
67 -0100 0 AZOT +0000 1 AZOST
68 -0100 0 CVT -0100 0 CVT
69 +0000 0 GMT +0000 0 GMT
70 +0000 0 WET +0100 1 WEST
71 +0100 0 CET +0200 1 CEST
72 +0100 0 WAT +0100 0 WAT
73 +0200 0 EET +0200 0 EET
74 +0200 0 IST +0300 1 IDT
75 +0200 1 WAST +0100 0 WAT
76 +0300 0 FET +0300 0 FET
77 +030704 0 zzz +030704 0 zzz
78 +0330 0 IRST +0430 1 IRDT
79 +0400 0 AZT +0500 1 AZST
80 +0400 0 GST +0400 0 GST
81 +0430 0 AFT +0430 0 AFT
82 +0500 0 DAVT +0700 0 DAVT
83 +0500 0 MVT +0500 0 MVT
84 +0530 0 IST +0530 0 IST
85 +0545 0 NPT +0545 0 NPT
86 +0600 0 BDT +0600 0 BDT
87 +0630 0 CCT +0630 0 CCT
88 +0700 0 ICT +0700 0 ICT
89 +0800 0 HKT +0800 0 HKT
90 +0845 0 CWST +0845 0 CWST
91 +0900 0 JST +0900 0 JST
92 +0930 0 CST +0930 0 CST
93 +1000 0 PGT +1000 0 PGT
94 +1030 1 CST +0930 0 CST
95 +1100 0 CAST +0800 0 WST
96 +1100 0 NCT +1100 0 NCT
97 +1100 1 EST +1000 0 EST
98 +1100 1 LHST +1030 0 LHST
99 +1130 0 NFT +1130 0 NFT
100 +1200 0 FJT +1200 0 FJT
101 +1300 0 TKT +1300 0 TKT
102 +1300 1 NZDT +1200 0 NZST
103 +1345 1 CHADT +1245 0 CHAST
104 +1400 0 LINT +1400 0 LINT
105 +1400 1 WSDT +1300 0 WST
106);
107
108sub _tzoffset {
109 my $diff = (exists $ENV{TZ} and $ENV{TZ} =~ m!^(?:GMT|UTC)$!)
110 ? 0
111 : Time::Local::timegm(@_) - Time::Local::timelocal(@_);
112 sprintf '%+03d%02u', $diff/60/60, $diff/60%60;
113}
114
115sub _tzname {
116 return $ENV{TZ} if exists $ENV{TZ} and $ENV{TZ} =~ m!^(?:GMT|UTC)$!;
117
118 my $diff = tzoffset(@_);
119
120 my @t1 = my @t2 = @_;
121 @t1[3,4] = (1, 1); # winter
122 my $diff1 = tzoffset(@t1);
123 @t2[3,4] = (1, 7); # summer
124 my $diff2 = tzoffset(@t2);
125
126 for (my $i=0; $i < @offset2zone; $i += 6) {
127 next unless $offset2zone[$i] eq $diff1 and $offset2zone[$i+3] eq $diff2;
128 return $diff2 eq $diff ? $offset2zone[$i+5] : $offset2zone[$i+2];
129 }
130
131 if ($diff =~ /^([+-])(\d\d)$/) {
132 return sprintf 'GMT%s%d', $1 eq '-' ? '+' : '-', $2;
133 };
134
135 return 'Etc';
136}
137
138sub iso_week_days {
139 my ($yday, $wday) = @_;
140
141 # Add enough to the first operand of % to make it nonnegative.
142 my $big_enough_multiple_of_7 = (int(- YDAY_MINIMUM / 7) + 2) * 7;
143 return ($yday
144 - ($yday - $wday + ISO_WEEK1_WDAY + $big_enough_multiple_of_7) % 7
145 + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
146}
147
148sub isleap {
149 my $year = shift;
150 return ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) ? 1 : 0
151}
152
153sub isodaysnum {
154 my @t = @_;
155
156 my $year = ($t[YEAR] + ($t[YEAR] < 0 ? 1900 % 400 : 1900 % 400 - 400));
157 my $year_adjust = 0;
158 my $days = iso_week_days($t[YDAY], $t[WDAY]);
159
160 if ($days < 0) {
161 # This ISO week belongs to the previous year.
162 $year_adjust = -1;
163 $days = iso_week_days($t[YDAY] + (365 + isleap($year -1)), $t[WDAY]);
164 }
165 else {
166 my $d = iso_week_days($t[YDAY] - (365 + isleap($year)), $t[WDAY]);
167 if ($d >= 0) {
168 # This ISO week belongs to the next year. */
169 $year_adjust = 1;
170 $days = $d;
171 }
172 }
173
174 return ($days, $year_adjust);
175}
176
177sub isoyearnum {
178 my ($days, $year_adjust) = isodaysnum(@_);
179 return $_[YEAR] + 1900 + $year_adjust;
180}
181
182sub isoweeknum {
183 my ($days, $year_adjust) = isodaysnum(@_);
184 return int($days / 7) + 1;
185}
186
187137µsour %FORMAT_CHARS = map { $_ => 1 } split //, q!%aAbBcCdDeFGghHIjklmMnNpPrRsStTuUVwWxXyYzZ!;
188
189118µsour %SPRINTF_CHARS = (
190 '%' => [q!%s!, q!%!],
191 'a' => [q!%s!, q!$weekday_abbr[$_[WDAY]]!],
192 'A' => [q!%s!, q!$weekday_name[$_[WDAY]]!],
193 'b' => [q!%s!, q!$month_abbr[$_[MONTH]]!],
194 'B' => [q!%s!, q!$month_name[$_[MONTH]]!],
195 'c' => [q!%s %s %2d %02d:%02d:%02d %04d!,
196 q!$weekday_abbr[$_[WDAY]], $month_abbr[$_[MONTH]], $_[DAY], $_[HOUR], $_[MIN], $_[SEC], $_[YEAR]+1900!],
197 'C' => [q!%02d!, q!($_[YEAR]+1900)/100!],
198 'd' => [q!%02d!, q!$_[DAY]!],
199 'D' => [q!%02d/%02d/%02d!, q!$_[MONTH]+1,$_[DAY],$_[YEAR]%100!],
200 'e' => [q!%2d!, q!$_[DAY]!],
201 'F' => [q!%04d-%02d-%02d!, q!$_[YEAR]+1900,$_[MONTH]+1,$_[DAY]!],
202 'h' => [q!%s!, q!$month_abbr[$_[MONTH]]!],
203 'H' => [q!%02d!, q!$_[HOUR]!],
204 'I' => [q!%02d!, q!$_[HOUR]%12 || 1!],
205 'j' => [q!%03d!, q!$_[YDAY]+1!],
206 'k' => [q!%2d!, q!$_[HOUR]!],
207 'l' => [q!%2d!, q!$_[HOUR]%12 || 1!],
208 'm' => [q!%02d!, q!$_[MONTH]+1!],
209 'M' => [q!%02d!, q!$_[MIN]!],
210 'n' => [q!%s!, q!"\n"!],
211 'N' => [q!%s!, q!substr(sprintf('%.9f', $_[SEC] - int $_[SEC]), 2)!],
212 'p' => [q!%s!, q!$_[HOUR] > 0 && $_[HOUR] < 13 ? "AM" : "PM"!],
213 'P' => [q!%s!, q!$_[HOUR] > 0 && $_[HOUR] < 13 ? "am" : "pm"!],
214 'r' => [q!%02d:%02d:%02d %s!, q!$_[HOUR]%12 || 1, $_[MIN], $_[SEC], $_[HOUR] > 0 && $_[HOUR] < 13 ? "AM" : "PM"!],
215 'R' => [q!%02d:%02d!, q!$_[HOUR], $_[MIN]!],
216 'S' => [q!%02d!, q!$_[SEC]!],
217 't' => [q!%s!, q!"\t"!],
218 'T' => [q!%02d:%02d:%02d!, q!$_[HOUR], $_[MIN], $_[SEC]!],
219 'u' => [q!%d!, q!$_[WDAY] || 7!],
220 'w' => [q!%d!, q!$_[WDAY]!],
221 'x' => [q!%02d/%02d/%02d!, q!$_[MONTH]+1,$_[DAY],$_[YEAR]%100!],
222 'X' => [q!%02d:%02d:%02d!, q!$_[HOUR], $_[MIN], $_[SEC]!],
223 'y' => [q!%02d!, q!$_[YEAR]%100!],
224 'Y' => [q!%02d!, q!$_[YEAR]+1900!],
225 '%' => [q!%s!, q!'%'!],
226);
227
228225µsif ( eval { require Time::TZOffset; 1 } ) {
229 $SPRINTF_CHARS{z} = [q!%s!,q!Time::TZOffset::tzoffset(@_)!];
230}
231
23217µsour %LOCALE_CHARS = (
233 '%' => [q!'%%'!],
234 'a' => [q!$weekday_abbr[$_[WDAY]]!,1],
235 'A' => [q!$weekday_name[$_[WDAY]]!,1],
236 'b' => [q!$month_abbr[$_[MONTH]]!],
237 'B' => [q!$month_name[$_[MONTH]]!],
238 'c' => [q!$weekday_abbr[$_[WDAY]] . ' ' . $month_abbr[$_[MONTH]] . ' ' . substr(' '.$_[DAY],-2) . ' %H:%M:%S %Y'!,1],
239 'C' => [q!substr('0'.int(($_[YEAR]+1900)/100), -2)!], #century
240 'h' => [q!$month_abbr[$_[MONTH]]!],
241 'N' => [q!substr(sprintf('%.9f', $_[SEC] - int $_[SEC]), 2)!],
242 'n' => [q!"\n"!],
243 'p' => [q!$_[HOUR] > 0 && $_[HOUR] < 13 ? "AM" : "PM"!],
244 'P' => [q!$_[HOUR] > 0 && $_[HOUR] < 13 ? "am" : "pm"!],
245 'r' => [q!sprintf('%02d:%02d:%02d %s',$_[HOUR]%12 || 1, $_[MIN], $_[SEC], $_[HOUR] > 0 && $_[HOUR] < 13 ? "AM" : "PM")!],
246 't' => [q!"\t"!],
247 'x' => [q!'%m/%d/%y'!],
248 'X' => [q!'%H:%M:%S'!],
249 'z' => [q!'%z'!,1],
250 'Z' => [q!'%Z'!,1],
251);
252
25319µs21µsif ( $^O =~ m!^(MSWin32|cygwin)$!i ) {
# spent 1µs making 2 calls to POSIX::strftime::Compiler::CORE:match, avg 700ns/call
254 %LOCALE_CHARS = (
255 %LOCALE_CHARS,
256 'D' => [q!'%m/%d/%y'!],
257 'F' => [q!'%Y-%m-%d'!],
258 'G' => [q!substr('0000'. isoyearnum(@_), -4)!,1],
259 'R' => [q!'%H:%M'!],
260 'T' => [q!'%H:%M:%S'!],
261 'V' => [q!substr('0'.isoweeknum(@_),-2)!,1],
262 'e' => [q!substr(' '.$_[DAY],-2)!],
263 'g' => [q!substr('0'.isoyearnum(@_)%100,-2)!,1],
264 'k' => [q!substr(' '.$_[HOUR],-2)!],
265 'l' => [q!substr(' '.($_[HOUR]%12 || 1),-2)!],
266 's' => [q!int(Time::Local::timegm(@_))!,1],
267 'u' => [q!$_[WDAY] || 7!,1],
268 'z' => [q!tzoffset(@_)!,1],
269 'Z' => [q!tzname(@_)!,1],
270 );
271}
272elsif ( $^O =~ m!^solaris$!i ) {
273 $LOCALE_CHARS{s} = [q!int(Time::Local::timegm(@_))!,1];
274}
275
276my $sprintf_char_handler = sub {
277 my ($char,$args) = @_;
278 return q|! . '%%' .q!| if $char eq ''; #last %
279 return q|! . '%%| . $char . q|' . q!| if ! exists $FORMAT_CHARS{$char}; #escape %%
280 my ($format, $code) = @{$SPRINTF_CHARS{$char}};
281 push @$args, $code;
282 return $format;
28312µs};
284
285
# spent 18µs within POSIX::strftime::Compiler::__ANON__[/usr/local/share/perl/5.18.2/POSIX/strftime/Compiler.pm:293] which was called: # once (18µs+0s) by POSIX::strftime::Compiler::compile at line 329
my $char_handler = sub {
28611µs my ($char,$need9char_ref) = @_;
28711µs return q|! . '%%' .q!| if $char eq ''; #last %
2881900ns return q|! . '%%| . $char . q|' . q!| if ! exists $FORMAT_CHARS{$char}; #escape %%
28913µs return q|! . '%| . $char . q|' . q!| if ! exists $LOCALE_CHARS{$char}; #stay
29013µs my ($code,$flag) = @{$LOCALE_CHARS{$char}};
29111µs $$need9char_ref++ if $flag;
292111µs q|! . | . $code . q| . q!|;
29311µs};
294
295
# spent 580µs (539+41) within POSIX::strftime::Compiler::compile which was called: # once (539µs+41µs) by POSIX::strftime::Compiler::strftime at line 359
sub compile {
29612µs my ($fmt) = @_;
297
29816µs my @weekday_name = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
29914µs my @weekday_abbr = qw(Sun Mon Tue Wed Thu Fri Sat);
30017µs my @month_name = qw(January February March April May June July August September October November December);
301111µs my @month_abbr = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
302
303115µs12µs $fmt =~ s/!/\\!/g;
# spent 2µs making 1 call to POSIX::strftime::Compiler::CORE:subst
30414µs1700ns $fmt =~ s!\%E([cCxXyY])!%$1!g;
# spent 700ns making 1 call to POSIX::strftime::Compiler::CORE:subst
30516µs12µs $fmt =~ s!\%O([deHImMSuUVwWy])!%$1!g;
# spent 2µs making 1 call to POSIX::strftime::Compiler::CORE:subst
306
30711µs my $sprintf_fmt = $fmt;
30811µs my $disable_sprintf=0;
30912µs my $sprintf_code = '';
310116µs19µs while ( $sprintf_fmt =~ m~ (?:\%([\%\+a-zA-Z])) ~gx ) {
# spent 9µs making 1 call to POSIX::strftime::Compiler::CORE:match
311114µs1200ns if ( exists $FORMAT_CHARS{$1} && ! exists $SPRINTF_CHARS{$1} ) {
# spent 200ns making 1 call to POSIX::strftime::Compiler::CORE:match
312 $disable_sprintf++
313 }
314 }
3151100ns if ( !$disable_sprintf ) {
316 my @args;
317 $sprintf_fmt =~ s!
318 (?:
319 \%([\%\+a-zA-Z]|$)
320 )
321 ! $sprintf_char_handler->($1,\@args) !egx;
322 $sprintf_code = q~if ( @_ == 9 ) {
323 return sprintf(q!~ . $sprintf_fmt . q~!,~ . join(",", @args) . q~);
324 }~;
325 }
326
32712µs my $posix_fmt = $fmt;
32812µs my $need9char=0;
329237µs426µs $posix_fmt =~ s!
# spent 18µs making 1 call to POSIX::strftime::Compiler::__ANON__[POSIX/strftime/Compiler.pm:293] # spent 4µs making 1 call to POSIX::strftime::Compiler::CORE:subst # spent 4µs making 2 calls to POSIX::strftime::Compiler::CORE:substcont, avg 2µs/call
330 (?:
331 \%([\%\+a-zA-Z]|$)
332 )
333 ! $char_handler->($1,\$need9char) !egx;
334
3351700ns my $need9char_code='';
33612µs if ( $need9char ) {
337 $need9char_code = q~if ( @_ == 6 ) {
338 my $sec = $_[0];
339 @_ = gmtime Time::Local::timegm(@_);
340 $_[0] = $sec;
341 }~;
342 }
34314µs my $code = q~sub {
344 if ( @_ != 9 && @_ != 6 ) {
345 Carp::croak 'Usage: strftime(sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)';
346 }
347 ~ . $sprintf_code . q~
348 ~ . $need9char_code . q~
349 POSIX::strftime(q!~ . $posix_fmt . q~!,@_);
350 }~;
3511400µs my $sub = eval $code; ## no critic
# spent 102µs executing statements in string eval
# includes 15µs spent executing 1 call to 1 sub defined therein.
3521900ns die $@ ."\n=====\n".$code."\n=====\n" if $@;
353119µs wantarray ? ($sub,$code) : $sub;
354}
355
3561200nsmy %STRFTIME;
357
# spent 700µs (28+671) within POSIX::strftime::Compiler::strftime which was called: # once (28µs+671µs) by Apache::LogFormat::Compiler::__ANON__[(eval 593)[/usr/local/share/perl/5.18.2/Apache/LogFormat/Compiler.pm:151]:21] at line 5 of (eval 593)[Apache/LogFormat/Compiler.pm:151]
sub strftime {
35811µs my $fmt = shift;
359119µs2671µs ($STRFTIME{$fmt} ||= compile($fmt))->(@_);
360}
361
362sub new {
363 my $class = shift;
364 my $fmt = shift;
365 my ($sub,$code) = compile($fmt);
366 bless [$sub,$code], $class;
367}
368
369sub to_string {
370 my $self = shift;
371 $self->[0]->(@_);
372}
373
374sub code_ref {
375 my $self = shift;
376 $self->[0];
377}
378
379135µs1;
380__END__
 
# spent 11µs within POSIX::strftime::Compiler::CORE:match which was called 4 times, avg 3µs/call: # 2 times (1µs+0s) by Apache::LogFormat::Compiler::BEGIN@7 at line 253, avg 700ns/call # once (9µs+0s) by POSIX::strftime::Compiler::compile at line 310 # once (200ns+0s) by POSIX::strftime::Compiler::compile at line 311
sub POSIX::strftime::Compiler::CORE:match; # opcode
# spent 9µs within POSIX::strftime::Compiler::CORE:subst which was called 4 times, avg 2µs/call: # once (4µs+0s) by POSIX::strftime::Compiler::compile at line 329 # once (2µs+0s) by POSIX::strftime::Compiler::compile at line 305 # once (2µs+0s) by POSIX::strftime::Compiler::compile at line 303 # once (700ns+0s) by POSIX::strftime::Compiler::compile at line 304
sub POSIX::strftime::Compiler::CORE:subst; # opcode
# spent 4µs within POSIX::strftime::Compiler::CORE:substcont which was called 2 times, avg 2µs/call: # 2 times (4µs+0s) by POSIX::strftime::Compiler::compile at line 329, avg 2µs/call
sub POSIX::strftime::Compiler::CORE:substcont; # opcode