← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:11:21 2013

Filename/usr/lib/perl/5.10/Compress/Zlib.pm
StatementsExecuted 1218 statements in 542ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
5011400ms562msCompress::Zlib::::memGunzip Compress::Zlib::memGunzip
1116.09ms13.2msCompress::Zlib::::BEGIN@11 Compress::Zlib::BEGIN@11
1113.78ms6.21msCompress::Zlib::::BEGIN@12 Compress::Zlib::BEGIN@12
1111.79ms16.7msCompress::Zlib::::BEGIN@14 Compress::Zlib::BEGIN@14
50111.79ms2.85msCompress::Zlib::::_removeGzipHeader Compress::Zlib::_removeGzipHeader
1111.69ms16.4msCompress::Zlib::::BEGIN@13 Compress::Zlib::BEGIN@13
1111.02ms1.74msCompress::Zlib::::BEGIN@9 Compress::Zlib::BEGIN@9
10021516µs516µsCompress::Zlib::::CORE:unpack Compress::Zlib::CORE:unpack (opcode)
11127µs387µsCompress::Zlib::::BEGIN@455 Compress::Zlib::BEGIN@455
11122µs178µsCompress::Zlib::::BEGIN@6 Compress::Zlib::BEGIN@6
11122µs56µsCompress::Zlib::::BEGIN@8 Compress::Zlib::BEGIN@8
11119µs87µsCompress::Zlib::::BEGIN@7 Compress::Zlib::BEGIN@7
11113µs57µsCompress::Zlib::::BEGIN@55 Compress::Zlib::BEGIN@55
11112µs18µsCompress::Zlib::::BEGIN@16 Compress::Zlib::BEGIN@16
11112µs16µsCompress::Zlib::::BEGIN@18 Compress::Zlib::BEGIN@18
11112µs73µsCompress::Zlib::::BEGIN@54 Compress::Zlib::BEGIN@54
11112µs29µsCompress::Zlib::::BEGIN@17 Compress::Zlib::BEGIN@17
11110µs35µsCompress::Zlib::::BEGIN@49 Compress::Zlib::BEGIN@49
1119µs46µsCompress::Zlib::::BEGIN@56 Compress::Zlib::BEGIN@56
1119µs40µsCompress::Zlib::::BEGIN@57 Compress::Zlib::BEGIN@57
1117µs7µsCompress::Zlib::::BEGIN@40 Compress::Zlib::BEGIN@40
0000s0sCompress::Zlib::::AUTOLOAD Compress::Zlib::AUTOLOAD
0000s0sCompress::Zlib::::__ANON__[:50] Compress::Zlib::__ANON__[:50]
0000s0sCompress::Zlib::::_save_gzerr Compress::Zlib::_save_gzerr
0000s0sCompress::Zlib::::_set_gzerr Compress::Zlib::_set_gzerr
0000s0sCompress::Zlib::::compress Compress::Zlib::compress
0000s0sCompress::Zlib::::deflateInit Compress::Zlib::deflateInit
0000s0sCompress::Zlib::gzFile::::gzcloseCompress::Zlib::gzFile::gzclose
0000s0sCompress::Zlib::gzFile::::gzeofCompress::Zlib::gzFile::gzeof
0000s0sCompress::Zlib::gzFile::::gzerrorCompress::Zlib::gzFile::gzerror
0000s0sCompress::Zlib::gzFile::::gzflushCompress::Zlib::gzFile::gzflush
0000s0sCompress::Zlib::gzFile::::gzreadCompress::Zlib::gzFile::gzread
0000s0sCompress::Zlib::gzFile::::gzreadlineCompress::Zlib::gzFile::gzreadline
0000s0sCompress::Zlib::gzFile::::gzseekCompress::Zlib::gzFile::gzseek
0000s0sCompress::Zlib::gzFile::::gzsetparamsCompress::Zlib::gzFile::gzsetparams
0000s0sCompress::Zlib::gzFile::::gztellCompress::Zlib::gzFile::gztell
0000s0sCompress::Zlib::gzFile::::gzwriteCompress::Zlib::gzFile::gzwrite
0000s0sCompress::Zlib::::gzopen Compress::Zlib::gzopen
0000s0sCompress::Zlib::::inflateInit Compress::Zlib::inflateInit
0000s0sCompress::Zlib::::memGzip Compress::Zlib::memGzip
0000s0sCompress::Zlib::::uncompress Compress::Zlib::uncompress
0000s0sZlib::OldDeflate::::deflate Zlib::OldDeflate::deflate
0000s0sZlib::OldDeflate::::flush Zlib::OldDeflate::flush
0000s0sZlib::OldInflate::::inflate Zlib::OldInflate::inflate
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Compress::Zlib;
3
4119µsrequire 5.004 ;
51800nsrequire Exporter;
6338µs2333µs
# spent 178µs (22+156) within Compress::Zlib::BEGIN@6 which was called: # once (22µs+156µs) by Cache::Memcached::BEGIN@1 at line 6
use AutoLoader;
# spent 178µs making 1 call to Compress::Zlib::BEGIN@6 # spent 156µs making 1 call to AutoLoader::import
7356µs2155µs
# spent 87µs (19+68) within Compress::Zlib::BEGIN@7 which was called: # once (19µs+68µs) by Cache::Memcached::BEGIN@1 at line 7
use Carp ;
# spent 87µs making 1 call to Compress::Zlib::BEGIN@7 # spent 68µs making 1 call to Exporter::import
8347µs290µs
# spent 56µs (22+34) within Compress::Zlib::BEGIN@8 which was called: # once (22µs+34µs) by Cache::Memcached::BEGIN@1 at line 8
use IO::Handle ;
# spent 56µs making 1 call to Compress::Zlib::BEGIN@8 # spent 34µs making 1 call to Exporter::import
93170µs21.86ms
# spent 1.74ms (1.02+722µs) within Compress::Zlib::BEGIN@9 which was called: # once (1.02ms+722µs) by Cache::Memcached::BEGIN@1 at line 9
use Scalar::Util qw(dualvar);
# spent 1.74ms making 1 call to Compress::Zlib::BEGIN@9 # spent 114µs making 1 call to Exporter::import
10
113266µs313.5ms
# spent 13.2ms (6.09+7.15) within Compress::Zlib::BEGIN@11 which was called: # once (6.09ms+7.15ms) by Cache::Memcached::BEGIN@1 at line 11
use IO::Compress::Base::Common 2.020 ;
# spent 13.2ms making 1 call to Compress::Zlib::BEGIN@11 # spent 250µs making 1 call to Exporter::import # spent 43µs making 1 call to UNIVERSAL::VERSION
123223µs36.70ms
# spent 6.21ms (3.78+2.43) within Compress::Zlib::BEGIN@12 which was called: # once (3.78ms+2.43ms) by Cache::Memcached::BEGIN@1 at line 12
use Compress::Raw::Zlib 2.020 ;
# spent 6.21ms making 1 call to Compress::Zlib::BEGIN@12 # spent 457µs making 1 call to Exporter::import # spent 27µs making 1 call to UNIVERSAL::VERSION
133243µs316.5ms
# spent 16.4ms (1.69+14.7) within Compress::Zlib::BEGIN@13 which was called: # once (1.69ms+14.7ms) by Cache::Memcached::BEGIN@1 at line 13
use IO::Compress::Gzip 2.020 ;
# spent 16.4ms making 1 call to Compress::Zlib::BEGIN@13 # spent 78µs making 1 call to Exporter::import # spent 22µs making 1 call to UNIVERSAL::VERSION
143188µs316.8ms
# spent 16.7ms (1.79+15.0) within Compress::Zlib::BEGIN@14 which was called: # once (1.79ms+15.0ms) by Cache::Memcached::BEGIN@1 at line 14
use IO::Uncompress::Gunzip 2.020 ;
# spent 16.7ms making 1 call to Compress::Zlib::BEGIN@14 # spent 36µs making 1 call to Exporter::import # spent 16µs making 1 call to UNIVERSAL::VERSION
15
16326µs223µs
# spent 18µs (12+5) within Compress::Zlib::BEGIN@16 which was called: # once (12µs+5µs) by Cache::Memcached::BEGIN@1 at line 16
use strict ;
# spent 18µs making 1 call to Compress::Zlib::BEGIN@16 # spent 5µs making 1 call to strict::import
17328µs245µs
# spent 29µs (12+17) within Compress::Zlib::BEGIN@17 which was called: # once (12µs+17µs) by Cache::Memcached::BEGIN@1 at line 17
use warnings ;
# spent 29µs making 1 call to Compress::Zlib::BEGIN@17 # spent 17µs making 1 call to warnings::import
183115µs219µs
# spent 16µs (12+3) within Compress::Zlib::BEGIN@18 which was called: # once (12µs+3µs) by Cache::Memcached::BEGIN@1 at line 18
use bytes ;
# spent 16µs making 1 call to Compress::Zlib::BEGIN@18 # spent 3µs making 1 call to bytes::import
1911µsour ($VERSION, $XS_VERSION, @ISA, @EXPORT, $AUTOLOAD);
20
211500ns$VERSION = '2.020';
221300ns$XS_VERSION = $VERSION;
23123µs$VERSION = eval $VERSION;
# spent 4µs executing statements in string eval
24
25110µs@ISA = qw(Exporter);
26# Items to export into callers namespace by default. Note: do not export
27# names by default without a very good reason. Use EXPORT_OK instead.
28# Do not simply export all your public functions/methods/constants.
2912µs@EXPORT = qw(
30 deflateInit inflateInit
31
32 compress uncompress
33
34 gzopen $gzerrno
35 );
36
37113µspush @EXPORT, @Compress::Raw::Zlib::EXPORT ;
38
39BEGIN
40
# spent 7µs within Compress::Zlib::BEGIN@40 which was called: # once (7µs+0s) by Cache::Memcached::BEGIN@1 at line 42
{
4118µs *zlib_version = \&Compress::Raw::Zlib::zlib_version;
42184µs17µs}
# spent 7µs making 1 call to Compress::Zlib::BEGIN@40
43
44sub AUTOLOAD {
45 my($constname);
46 ($constname = $AUTOLOAD) =~ s/.*:://;
47 my ($error, $val) = Compress::Raw::Zlib::constant($constname);
48 Carp::croak $error if $error;
493120µs261µs
# spent 35µs (10+25) within Compress::Zlib::BEGIN@49 which was called: # once (10µs+25µs) by Cache::Memcached::BEGIN@1 at line 49
no strict 'refs';
# spent 35µs making 1 call to Compress::Zlib::BEGIN@49 # spent 25µs making 1 call to strict::unimport
50 *{$AUTOLOAD} = sub { $val };
51 goto &{$AUTOLOAD};
52}
53
54362µs2133µs
# spent 73µs (12+61) within Compress::Zlib::BEGIN@54 which was called: # once (12µs+61µs) by Cache::Memcached::BEGIN@1 at line 54
use constant FLAG_APPEND => 1 ;
# spent 73µs making 1 call to Compress::Zlib::BEGIN@54 # spent 61µs making 1 call to constant::import
55334µs2101µs
# spent 57µs (13+44) within Compress::Zlib::BEGIN@55 which was called: # once (13µs+44µs) by Cache::Memcached::BEGIN@1 at line 55
use constant FLAG_CRC => 2 ;
# spent 57µs making 1 call to Compress::Zlib::BEGIN@55 # spent 44µs making 1 call to constant::import
56330µs283µs
# spent 46µs (9+37) within Compress::Zlib::BEGIN@56 which was called: # once (9µs+37µs) by Cache::Memcached::BEGIN@1 at line 56
use constant FLAG_ADLER => 4 ;
# spent 46µs making 1 call to Compress::Zlib::BEGIN@56 # spent 37µs making 1 call to constant::import
5732.00ms271µs
# spent 40µs (9+31) within Compress::Zlib::BEGIN@57 which was called: # once (9µs+31µs) by Cache::Memcached::BEGIN@1 at line 57
use constant FLAG_CONSUME_INPUT => 8 ;
# spent 40µs making 1 call to Compress::Zlib::BEGIN@57 # spent 31µs making 1 call to constant::import
58
591200nsour (@my_z_errmsg);
60
6112µs@my_z_errmsg = (
62 "need dictionary", # Z_NEED_DICT 2
63 "stream end", # Z_STREAM_END 1
64 "", # Z_OK 0
65 "file error", # Z_ERRNO (-1)
66 "stream error", # Z_STREAM_ERROR (-2)
67 "data error", # Z_DATA_ERROR (-3)
68 "insufficient memory", # Z_MEM_ERROR (-4)
69 "buffer error", # Z_BUF_ERROR (-5)
70 "incompatible version",# Z_VERSION_ERROR(-6)
71 );
72
73
74sub _set_gzerr
75{
76 my $value = shift ;
77
78 if ($value == 0) {
79 $Compress::Zlib::gzerrno = 0 ;
80 }
81 elsif ($value == Z_ERRNO() || $value > 2) {
82 $Compress::Zlib::gzerrno = $! ;
83 }
84 else {
85 $Compress::Zlib::gzerrno = dualvar($value+0, $my_z_errmsg[2 - $value]);
86 }
87
88 return $value ;
89}
90
91sub _save_gzerr
92{
93 my $gz = shift ;
94 my $test_eof = shift ;
95
96 my $value = $gz->errorNo() || 0 ;
97
98 if ($test_eof) {
99 #my $gz = $self->[0] ;
100 # gzread uses Z_STREAM_END to denote a successful end
101 $value = Z_STREAM_END() if $gz->eof() && $value == 0 ;
102 }
103
104 _set_gzerr($value) ;
105}
106
107sub gzopen($$)
108{
109 my ($file, $mode) = @_ ;
110
111 my $gz ;
112 my %defOpts = (Level => Z_DEFAULT_COMPRESSION(),
113 Strategy => Z_DEFAULT_STRATEGY(),
114 );
115
116 my $writing ;
117 $writing = ! ($mode =~ /r/i) ;
118 $writing = ($mode =~ /[wa]/i) ;
119
120 $defOpts{Level} = $1 if $mode =~ /(\d)/;
121 $defOpts{Strategy} = Z_FILTERED() if $mode =~ /f/i;
122 $defOpts{Strategy} = Z_HUFFMAN_ONLY() if $mode =~ /h/i;
123 $defOpts{Append} = 1 if $mode =~ /a/i;
124
125 my $infDef = $writing ? 'deflate' : 'inflate';
126 my @params = () ;
127
128 croak "gzopen: file parameter is not a filehandle or filename"
129 unless isaFilehandle $file || isaFilename $file ||
130 (ref $file && ref $file eq 'SCALAR');
131
132 return undef unless $mode =~ /[rwa]/i ;
133
134 _set_gzerr(0) ;
135
136 if ($writing) {
137 $gz = new IO::Compress::Gzip($file, Minimal => 1, AutoClose => 1,
138 %defOpts)
139 or $Compress::Zlib::gzerrno = $IO::Compress::Gzip::GzipError;
140 }
141 else {
142 $gz = new IO::Uncompress::Gunzip($file,
143 Transparent => 1,
144 Append => 0,
145 AutoClose => 1,
146 MultiStream => 1,
147 Strict => 0)
148 or $Compress::Zlib::gzerrno = $IO::Uncompress::Gunzip::GunzipError;
149 }
150
151 return undef
152 if ! defined $gz ;
153
154 bless [$gz, $infDef], 'Compress::Zlib::gzFile';
155}
156
157sub Compress::Zlib::gzFile::gzread
158{
159 my $self = shift ;
160
161 return _set_gzerr(Z_STREAM_ERROR())
162 if $self->[1] ne 'inflate';
163
164 my $len = defined $_[1] ? $_[1] : 4096 ;
165
166 if ($self->gzeof() || $len == 0) {
167 # Zap the output buffer to match ver 1 behaviour.
168 $_[0] = "" ;
169 return 0 ;
170 }
171
172 my $gz = $self->[0] ;
173 my $status = $gz->read($_[0], $len) ;
174 _save_gzerr($gz, 1);
175 return $status ;
176}
177
178sub Compress::Zlib::gzFile::gzreadline
179{
180 my $self = shift ;
181
182 my $gz = $self->[0] ;
183 {
184 # Maintain backward compatibility with 1.x behaviour
185 # It didn't support $/, so this can't either.
186 local $/ = "\n" ;
187 $_[0] = $gz->getline() ;
188 }
189 _save_gzerr($gz, 1);
190 return defined $_[0] ? length $_[0] : 0 ;
191}
192
193sub Compress::Zlib::gzFile::gzwrite
194{
195 my $self = shift ;
196 my $gz = $self->[0] ;
197
198 return _set_gzerr(Z_STREAM_ERROR())
199 if $self->[1] ne 'deflate';
200
201 $] >= 5.008 and (utf8::downgrade($_[0], 1)
202 or croak "Wide character in gzwrite");
203
204 my $status = $gz->write($_[0]) ;
205 _save_gzerr($gz);
206 return $status ;
207}
208
209sub Compress::Zlib::gzFile::gztell
210{
211 my $self = shift ;
212 my $gz = $self->[0] ;
213 my $status = $gz->tell() ;
214 _save_gzerr($gz);
215 return $status ;
216}
217
218sub Compress::Zlib::gzFile::gzseek
219{
220 my $self = shift ;
221 my $offset = shift ;
222 my $whence = shift ;
223
224 my $gz = $self->[0] ;
225 my $status ;
226 eval { $status = $gz->seek($offset, $whence) ; };
227 if ($@)
228 {
229 my $error = $@;
230 $error =~ s/^.*: /gzseek: /;
231 $error =~ s/ at .* line \d+\s*$//;
232 croak $error;
233 }
234 _save_gzerr($gz);
235 return $status ;
236}
237
238sub Compress::Zlib::gzFile::gzflush
239{
240 my $self = shift ;
241 my $f = shift ;
242
243 my $gz = $self->[0] ;
244 my $status = $gz->flush($f) ;
245 my $err = _save_gzerr($gz);
246 return $status ? 0 : $err;
247}
248
249sub Compress::Zlib::gzFile::gzclose
250{
251 my $self = shift ;
252 my $gz = $self->[0] ;
253
254 my $status = $gz->close() ;
255 my $err = _save_gzerr($gz);
256 return $status ? 0 : $err;
257}
258
259sub Compress::Zlib::gzFile::gzeof
260{
261 my $self = shift ;
262 my $gz = $self->[0] ;
263
264 return 0
265 if $self->[1] ne 'inflate';
266
267 my $status = $gz->eof() ;
268 _save_gzerr($gz);
269 return $status ;
270}
271
272sub Compress::Zlib::gzFile::gzsetparams
273{
274 my $self = shift ;
275 croak "Usage: Compress::Zlib::gzFile::gzsetparams(file, level, strategy)"
276 unless @_ eq 2 ;
277
278 my $gz = $self->[0] ;
279 my $level = shift ;
280 my $strategy = shift;
281
282 return _set_gzerr(Z_STREAM_ERROR())
283 if $self->[1] ne 'deflate';
284
285 my $status = *$gz->{Compress}->deflateParams(-Level => $level,
286 -Strategy => $strategy);
287 _save_gzerr($gz);
288 return $status ;
289}
290
291sub Compress::Zlib::gzFile::gzerror
292{
293 my $self = shift ;
294 my $gz = $self->[0] ;
295
296 return $Compress::Zlib::gzerrno ;
297}
298
299
300sub compress($;$)
301{
302 my ($x, $output, $err, $in) =('', '', '', '') ;
303
304 if (ref $_[0] ) {
305 $in = $_[0] ;
306 croak "not a scalar reference" unless ref $in eq 'SCALAR' ;
307 }
308 else {
309 $in = \$_[0] ;
310 }
311
312 $] >= 5.008 and (utf8::downgrade($$in, 1)
313 or croak "Wide character in compress");
314
315 my $level = (@_ == 2 ? $_[1] : Z_DEFAULT_COMPRESSION() );
316
317 $x = new Compress::Raw::Zlib::Deflate -AppendOutput => 1, -Level => $level
318 or return undef ;
319
320 $err = $x->deflate($in, $output) ;
321 return undef unless $err == Z_OK() ;
322
323 $err = $x->flush($output) ;
324 return undef unless $err == Z_OK() ;
325
326 return $output ;
327
328}
329
330sub uncompress($)
331{
332 my ($x, $output, $err, $in) =('', '', '', '') ;
333
334 if (ref $_[0] ) {
335 $in = $_[0] ;
336 croak "not a scalar reference" unless ref $in eq 'SCALAR' ;
337 }
338 else {
339 $in = \$_[0] ;
340 }
341
342 $] >= 5.008 and (utf8::downgrade($$in, 1)
343 or croak "Wide character in uncompress");
344
345 $x = new Compress::Raw::Zlib::Inflate -ConsumeInput => 0 or return undef ;
346
347 $err = $x->inflate($in, $output) ;
348 return undef unless $err == Z_STREAM_END() ;
349
350 return $output ;
351}
352
- -
355sub deflateInit(@)
356{
357 my ($got) = ParseParameters(0,
358 {
359 'Bufsize' => [1, 1, Parse_unsigned, 4096],
360 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()],
361 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()],
362 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()],
363 'MemLevel' => [1, 1, Parse_unsigned, MAX_MEM_LEVEL()],
364 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()],
365 'Dictionary' => [1, 1, Parse_any, ""],
366 }, @_ ) ;
367
368 croak "Compress::Zlib::deflateInit: Bufsize must be >= 1, you specified " .
369 $got->value('Bufsize')
370 unless $got->value('Bufsize') >= 1;
371
372 my $obj ;
373
374 my $status = 0 ;
375 ($obj, $status) =
376 Compress::Raw::Zlib::_deflateInit(0,
377 $got->value('Level'),
378 $got->value('Method'),
379 $got->value('WindowBits'),
380 $got->value('MemLevel'),
381 $got->value('Strategy'),
382 $got->value('Bufsize'),
383 $got->value('Dictionary')) ;
384
385 my $x = ($status == Z_OK() ? bless $obj, "Zlib::OldDeflate" : undef) ;
386 return wantarray ? ($x, $status) : $x ;
387}
388
389sub inflateInit(@)
390{
391 my ($got) = ParseParameters(0,
392 {
393 'Bufsize' => [1, 1, Parse_unsigned, 4096],
394 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()],
395 'Dictionary' => [1, 1, Parse_any, ""],
396 }, @_) ;
397
398
399 croak "Compress::Zlib::inflateInit: Bufsize must be >= 1, you specified " .
400 $got->value('Bufsize')
401 unless $got->value('Bufsize') >= 1;
402
403 my $status = 0 ;
404 my $obj ;
405 ($obj, $status) = Compress::Raw::Zlib::_inflateInit(FLAG_CONSUME_INPUT,
406 $got->value('WindowBits'),
407 $got->value('Bufsize'),
408 $got->value('Dictionary')) ;
409
410 my $x = ($status == Z_OK() ? bless $obj, "Zlib::OldInflate" : undef) ;
411
412 wantarray ? ($x, $status) : $x ;
413}
414
415package Zlib::OldDeflate ;
416
4171200nsour (@ISA);
41818µs@ISA = qw(Compress::Raw::Zlib::deflateStream);
419
420
421sub deflate
422{
423 my $self = shift ;
424 my $output ;
425
426 my $status = $self->SUPER::deflate($_[0], $output) ;
427 wantarray ? ($output, $status) : $output ;
428}
429
430sub flush
431{
432 my $self = shift ;
433 my $output ;
434 my $flag = shift || Compress::Zlib::Z_FINISH();
435 my $status = $self->SUPER::flush($output, $flag) ;
436
437 wantarray ? ($output, $status) : $output ;
438}
439
440package Zlib::OldInflate ;
441
4421200nsour (@ISA);
44316µs@ISA = qw(Compress::Raw::Zlib::inflateStream);
444
445sub inflate
446{
447 my $self = shift ;
448 my $output ;
449 my $status = $self->SUPER::inflate($_[0], $output) ;
450 wantarray ? ($output, $status) : $output ;
451}
452
453package Compress::Zlib ;
454
4553700µs3748µs
# spent 387µs (27+360) within Compress::Zlib::BEGIN@455 which was called: # once (27µs+360µs) by Cache::Memcached::BEGIN@1 at line 455
use IO::Compress::Gzip::Constants 2.020 ;
# spent 387µs making 1 call to Compress::Zlib::BEGIN@455 # spent 335µs making 1 call to Exporter::import # spent 25µs making 1 call to UNIVERSAL::VERSION
456
457sub memGzip($)
458{
459 my $out;
460
461 # if the deflation buffer isn't a reference, make it one
462 my $string = (ref $_[0] ? $_[0] : \$_[0]) ;
463
464 $] >= 5.008 and (utf8::downgrade($$string, 1)
465 or croak "Wide character in memGzip");
466
467 IO::Compress::Gzip::gzip($string, \$out, Minimal => 1)
468 or return undef ;
469
470 return $out;
471}
472
473
474sub _removeGzipHeader($)
475
# spent 2.85ms (1.79+1.07) within Compress::Zlib::_removeGzipHeader which was called 50 times, avg 57µs/call: # 50 times (1.79ms+1.07ms) by Compress::Zlib::memGunzip at line 541, avg 57µs/call
{
4765002.16ms my $string = shift ;
477
478 return Z_DATA_ERROR()
479 if length($$string) < GZIP_MIN_HEADER_SIZE ;
480
48150368µs my ($magic1, $magic2, $method, $flags, $time, $xflags, $oscode) =
# spent 368µs making 50 calls to Compress::Zlib::CORE:unpack, avg 7µs/call
482 unpack ('CCCCVCC', $$string);
483
48450482µs return Z_DATA_ERROR()
# spent 419µs making 49 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:79], avg 9µs/call # spent 62µs making 1 call to Compress::Raw::Zlib::AUTOLOAD
485 unless $magic1 == GZIP_ID1 and $magic2 == GZIP_ID2 and
486 $method == Z_DEFLATED() and !($flags & GZIP_FLG_RESERVED) ;
487 substr($$string, 0, GZIP_MIN_HEADER_SIZE) = '' ;
488
489 # skip extra field
490 if ($flags & GZIP_FLG_FEXTRA)
491 {
492 return Z_DATA_ERROR()
493 if length($$string) < GZIP_FEXTRA_HEADER_SIZE ;
494
495 my ($extra_len) = unpack ('v', $$string);
496 $extra_len += GZIP_FEXTRA_HEADER_SIZE;
497 return Z_DATA_ERROR()
498 if length($$string) < $extra_len ;
499
500 substr($$string, 0, $extra_len) = '';
501 }
502
503 # skip orig name
504 if ($flags & GZIP_FLG_FNAME)
505 {
506 my $name_end = index ($$string, GZIP_NULL_BYTE);
507 return Z_DATA_ERROR()
508 if $name_end == -1 ;
509 substr($$string, 0, $name_end + 1) = '';
510 }
511
512 # skip comment
513 if ($flags & GZIP_FLG_FCOMMENT)
514 {
515 my $comment_end = index ($$string, GZIP_NULL_BYTE);
516 return Z_DATA_ERROR()
517 if $comment_end == -1 ;
518 substr($$string, 0, $comment_end + 1) = '';
519 }
520
521 # skip header crc
522 if ($flags & GZIP_FLG_FHCRC)
523 {
524 return Z_DATA_ERROR()
525 if length ($$string) < GZIP_FHCRC_SIZE ;
526 substr($$string, 0, GZIP_FHCRC_SIZE) = '';
527 }
528
52950214µs return Z_OK();
# spent 198µs making 49 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:79], avg 4µs/call # spent 17µs making 1 call to Compress::Raw::Zlib::AUTOLOAD
530}
531
532
533sub memGunzip($)
534
# spent 562ms (400+163) within Compress::Zlib::memGunzip which was called 50 times, avg 11.2ms/call: # 50 times (400ms+163ms) by Cache::Memcached::__ANON__[/usr/share/perl5/Cache/Memcached.pm:714] at line 698 of Cache/Memcached.pm, avg 11.2ms/call
{
535 # if the buffer isn't a reference, make it one
536650535ms my $string = (ref $_[0] ? $_[0] : \$_[0]);
537
53850133µs $] >= 5.008 and (utf8::downgrade($$string, 1)
# spent 133µs making 50 calls to utf8::downgrade, avg 3µs/call
539 or croak "Wide character in memGunzip");
540
5411002.94ms _removeGzipHeader($string) == Z_OK()
# spent 2.85ms making 50 calls to Compress::Zlib::_removeGzipHeader, avg 57µs/call # spent 86µs making 50 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:79], avg 2µs/call
542 or return undef;
543
544 my $bufsize = length $$string > 4096 ? length $$string : 4096 ;
54510024.2ms my $x = new Compress::Raw::Zlib::Inflate({-WindowBits => - MAX_WBITS(),
# spent 24.0ms making 50 calls to Compress::Raw::Zlib::Inflate::new, avg 481µs/call # spent 183µs making 49 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:79], avg 4µs/call # spent 14µs making 1 call to Compress::Raw::Zlib::AUTOLOAD
546 -Bufsize => $bufsize})
547
548 or return undef;
549
550 my $output = "" ;
5515069.0ms my $status = $x->inflate($string, $output);
# spent 69.0ms making 50 calls to Compress::Raw::Zlib::inflateStream::inflate, avg 1.38ms/call
552 return undef
55350308µs unless $status == Z_STREAM_END();
# spent 269µs making 49 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:79], avg 5µs/call # spent 39µs making 1 call to Compress::Raw::Zlib::AUTOLOAD
554
555 if (length $$string >= 8)
556 {
55750148µs my ($crc, $len) = unpack ("VV", substr($$string, 0, 8));
# spent 148µs making 50 calls to Compress::Zlib::CORE:unpack, avg 3µs/call
558 substr($$string, 0, 8) = '';
559 return undef
5605065.4ms unless $len == length($output) and
# spent 65.4ms making 50 calls to Compress::Raw::Zlib::crc32, avg 1.31ms/call
561 $crc == crc32($output);
562 }
563 else
564 {
565 $$string = '';
566 }
567 return $output;
568}
569
570# Autoload methods go after __END__, and are processed by the autosplit program.
571
572112µs1;
573__END__
 
# spent 516µs within Compress::Zlib::CORE:unpack which was called 100 times, avg 5µs/call: # 50 times (368µs+0s) by Compress::Zlib::_removeGzipHeader at line 481, avg 7µs/call # 50 times (148µs+0s) by Compress::Zlib::memGunzip at line 557, avg 3µs/call
sub Compress::Zlib::CORE:unpack; # opcode