← Index
NYTProf Performance Profile   « line view »
For /Users/brian/bin/perls/cpan5.26.1
  Run on Sat Dec 30 01:41:10 2017
Reported on Sat Dec 30 01:44:15 2017

Filename/usr/local/perls/perl-5.26.1/lib/5.26.1/IO/Uncompress/RawInflate.pm
StatementsExecuted 52 statements in 3.49ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1119.00ms9.75msIO::Uncompress::RawInflate::::BEGIN@11IO::Uncompress::RawInflate::BEGIN@11
1111.33ms1.68msIO::Uncompress::RawInflate::::BEGIN@12IO::Uncompress::RawInflate::BEGIN@12
311204µs7.10msIO::Uncompress::RawInflate::::mkUncompIO::Uncompress::RawInflate::mkUncomp
11125µs28µsIO::Uncompress::RawInflate::::BEGIN@4IO::Uncompress::RawInflate::BEGIN@4
11117µs233µsIO::Uncompress::RawInflate::::BEGIN@8IO::Uncompress::RawInflate::BEGIN@8
11113µs147µsIO::Uncompress::RawInflate::::BEGIN@9IO::Uncompress::RawInflate::BEGIN@9
11111µs19µsIO::Uncompress::RawInflate::::BEGIN@5IO::Uncompress::RawInflate::BEGIN@5
1119µs12µsIO::Uncompress::RawInflate::::BEGIN@6IO::Uncompress::RawInflate::BEGIN@6
0000s0sIO::Uncompress::RawInflate::::_isRawIO::Uncompress::RawInflate::_isRaw
0000s0sIO::Uncompress::RawInflate::::_isRawxIO::Uncompress::RawInflate::_isRawx
0000s0sIO::Uncompress::RawInflate::::chkTrailerIO::Uncompress::RawInflate::chkTrailer
0000s0sIO::Uncompress::RawInflate::::ckMagicIO::Uncompress::RawInflate::ckMagic
0000s0sIO::Uncompress::RawInflate::::ckParamsIO::Uncompress::RawInflate::ckParams
0000s0sIO::Uncompress::RawInflate::::createDeflateIO::Uncompress::RawInflate::createDeflate
0000s0sIO::Uncompress::RawInflate::::getExtraParamsIO::Uncompress::RawInflate::getExtraParams
0000s0sIO::Uncompress::RawInflate::::inflateSyncIO::Uncompress::RawInflate::inflateSync
0000s0sIO::Uncompress::RawInflate::::newIO::Uncompress::RawInflate::new
0000s0sIO::Uncompress::RawInflate::::rawinflateIO::Uncompress::RawInflate::rawinflate
0000s0sIO::Uncompress::RawInflate::::readHeaderIO::Uncompress::RawInflate::readHeader
0000s0sIO::Uncompress::RawInflate::::scanIO::Uncompress::RawInflate::scan
0000s0sIO::Uncompress::RawInflate::::zapIO::Uncompress::RawInflate::zap
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package IO::Uncompress::RawInflate ;
2# for RFC1951
3
4238µs231µs
# spent 28µs (25+3) within IO::Uncompress::RawInflate::BEGIN@4 which was called: # once (25µs+3µs) by IO::Uncompress::Gunzip::BEGIN@12 at line 4
use strict ;
# spent 28µs making 1 call to IO::Uncompress::RawInflate::BEGIN@4 # spent 3µs making 1 call to strict::import
5229µs227µs
# spent 19µs (11+8) within IO::Uncompress::RawInflate::BEGIN@5 which was called: # once (11µs+8µs) by IO::Uncompress::Gunzip::BEGIN@12 at line 5
use warnings;
# spent 19µs making 1 call to IO::Uncompress::RawInflate::BEGIN@5 # spent 8µs making 1 call to warnings::import
6240µs215µs
# spent 12µs (9+3) within IO::Uncompress::RawInflate::BEGIN@6 which was called: # once (9µs+3µs) by IO::Uncompress::Gunzip::BEGIN@12 at line 6
use bytes;
# spent 12µs making 1 call to IO::Uncompress::RawInflate::BEGIN@6 # spent 3µs making 1 call to bytes::import
7
8359µs3449µs
# spent 233µs (17+216) within IO::Uncompress::RawInflate::BEGIN@8 which was called: # once (17µs+216µs) by IO::Uncompress::Gunzip::BEGIN@12 at line 8
use Compress::Raw::Zlib 2.074 ;
# spent 233µs making 1 call to IO::Uncompress::RawInflate::BEGIN@8 # spent 204µs making 1 call to Exporter::import # spent 12µs making 1 call to version::_VERSION
9356µs3281µs
# spent 147µs (13+134) within IO::Uncompress::RawInflate::BEGIN@9 which was called: # once (13µs+134µs) by IO::Uncompress::Gunzip::BEGIN@12 at line 9
use IO::Compress::Base::Common 2.074 qw(:Status );
# spent 147µs making 1 call to IO::Uncompress::RawInflate::BEGIN@9 # spent 125µs making 1 call to Exporter::import # spent 9µs making 1 call to version::_VERSION
10
113568µs39.79ms
# spent 9.75ms (9.00+752µs) within IO::Uncompress::RawInflate::BEGIN@11 which was called: # once (9.00ms+752µs) by IO::Uncompress::Gunzip::BEGIN@12 at line 11
use IO::Uncompress::Base 2.074 ;
# spent 9.75ms making 1 call to IO::Uncompress::RawInflate::BEGIN@11 # spent 25µs making 1 call to Exporter::import # spent 14µs making 1 call to version::_VERSION
1232.40ms21.69ms
# spent 1.68ms (1.33+358µs) within IO::Uncompress::RawInflate::BEGIN@12 which was called: # once (1.33ms+358µs) by IO::Uncompress::Gunzip::BEGIN@12 at line 12
use IO::Uncompress::Adapter::Inflate 2.074 ;
# spent 1.68ms making 1 call to IO::Uncompress::RawInflate::BEGIN@12 # spent 11µs making 1 call to version::_VERSION
13
1411µsrequire Exporter ;
15our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $RawInflateError);
16
1711µs$VERSION = '2.074';
1811µs$RawInflateError = '';
19
20113µs@ISA = qw(IO::Uncompress::Base Exporter);
2111µs@EXPORT_OK = qw( $RawInflateError rawinflate ) ;
2211µs%DEFLATE_CONSTANTS = ();
2312µs%EXPORT_TAGS = %IO::Uncompress::Base::EXPORT_TAGS ;
2411µspush @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
2515µs134µsExporter::export_ok_tags('all');
# spent 34µs making 1 call to Exporter::export_ok_tags
26
27#{
28# # Execute at runtime
29# my %bad;
30# for my $module (qw(Compress::Raw::Zlib IO::Compress::Base::Common IO::Uncompress::Base IO::Uncompress::Adapter::Inflate))
31# {
32# my $ver = ${ $module . "::VERSION"} ;
33#
34# $bad{$module} = $ver
35# if $ver ne $VERSION;
36# }
37#
38# if (keys %bad)
39# {
40# my $string = join "\n", map { "$_ $bad{$_}" } keys %bad;
41# die caller(0)[0] . "needs version $VERSION mismatch\n$string\n";
42# }
43#}
44
45sub new
46{
47 my $class = shift ;
48 my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$RawInflateError);
49 $obj->_create(undef, 0, @_);
50}
51
52sub rawinflate
53{
54 my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$RawInflateError);
55 return $obj->_inf(@_);
56}
57
58sub getExtraParams
59{
60 return ();
61}
62
63sub ckParams
64{
65 my $self = shift ;
66 my $got = shift ;
67
68 return 1;
69}
70
71sub mkUncomp
72
# spent 7.10ms (204µs+6.89) within IO::Uncompress::RawInflate::mkUncomp which was called 3 times, avg 2.37ms/call: # 3 times (204µs+6.89ms) by IO::Uncompress::Base::_create at line 489 of IO/Uncompress/Base.pm, avg 2.37ms/call
{
73312µs my $self = shift ;
7432µs my $got = shift ;
75
763163µs122.80ms my ($obj, $errstr, $errno) = IO::Uncompress::Adapter::Inflate::mkUncompObject(
# spent 2.78ms making 3 calls to IO::Uncompress::Adapter::Inflate::mkUncompObject, avg 928µs/call # spent 19µs making 9 calls to IO::Compress::Base::Parameters::getValue, avg 2µs/call
77 $got->getValue('crc32'),
78 $got->getValue('adler32'),
79 $got->getValue('scan'),
80 );
81
8231µs return $self->saveErrorString(undef, $errstr, $errno)
83 if ! defined $obj;
84
8534µs *$self->{Uncomp} = $obj;
86
87312µs3976µs my $magic = $self->ckMagic()
# spent 976µs making 3 calls to IO::Uncompress::Gunzip::ckMagic, avg 325µs/call
88 or return 0;
89
90345µs33.12ms *$self->{Info} = $self->readHeader($magic)
# spent 3.12ms making 3 calls to IO::Uncompress::Gunzip::readHeader, avg 1.04ms/call
91 or return undef ;
92
93318µs return 1;
94
95}
96
97
98sub ckMagic
99{
100 my $self = shift;
101
102 return $self->_isRaw() ;
103}
104
105sub readHeader
106{
107 my $self = shift;
108 my $magic = shift ;
109
110 return {
111 'Type' => 'rfc1951',
112 'FingerprintLength' => 0,
113 'HeaderLength' => 0,
114 'TrailerLength' => 0,
115 'Header' => ''
116 };
117}
118
119sub chkTrailer
120{
121 return STATUS_OK ;
122}
123
124sub _isRaw
125{
126 my $self = shift ;
127
128 my $got = $self->_isRawx(@_);
129
130 if ($got) {
131 *$self->{Pending} = *$self->{HeaderPending} ;
132 }
133 else {
134 $self->pushBack(*$self->{HeaderPending});
135 *$self->{Uncomp}->reset();
136 }
137 *$self->{HeaderPending} = '';
138
139 return $got ;
140}
141
142sub _isRawx
143{
144 my $self = shift ;
145 my $magic = shift ;
146
147 $magic = '' unless defined $magic ;
148
149 my $buffer = '';
150
151 $self->smartRead(\$buffer, *$self->{BlockSize}) >= 0
152 or return $self->saveErrorString(undef, "No data to read");
153
154 my $temp_buf = $magic . $buffer ;
155 *$self->{HeaderPending} = $temp_buf ;
156 $buffer = '';
157 my $status = *$self->{Uncomp}->uncompr(\$temp_buf, \$buffer, $self->smartEof()) ;
158
159 return $self->saveErrorString(undef, *$self->{Uncomp}{Error}, STATUS_ERROR)
160 if $status == STATUS_ERROR;
161
162 $self->pushBack($temp_buf) ;
163
164 return $self->saveErrorString(undef, "unexpected end of file", STATUS_ERROR)
165 if $self->smartEof() && $status != STATUS_ENDSTREAM;
166
167 #my $buf_len = *$self->{Uncomp}->uncompressedBytes();
168 my $buf_len = length $buffer;
169
170 if ($status == STATUS_ENDSTREAM) {
171 if (*$self->{MultiStream}
172 && (length $temp_buf || ! $self->smartEof())){
173 *$self->{NewStream} = 1 ;
174 *$self->{EndStream} = 0 ;
175 }
176 else {
177 *$self->{EndStream} = 1 ;
178 }
179 }
180 *$self->{HeaderPending} = $buffer ;
181 *$self->{InflatedBytesRead} = $buf_len ;
182 *$self->{TotalInflatedBytesRead} += $buf_len ;
183 *$self->{Type} = 'rfc1951';
184
185 $self->saveStatus(STATUS_OK);
186
187 return {
188 'Type' => 'rfc1951',
189 'HeaderLength' => 0,
190 'TrailerLength' => 0,
191 'Header' => ''
192 };
193}
194
195
196sub inflateSync
197{
198 my $self = shift ;
199
200 # inflateSync is a no-op in Plain mode
201 return 1
202 if *$self->{Plain} ;
203
204 return 0 if *$self->{Closed} ;
205 #return G_EOF if !length *$self->{Pending} && *$self->{EndStream} ;
206 return 0 if ! length *$self->{Pending} && *$self->{EndStream} ;
207
208 # Disable CRC check
209 *$self->{Strict} = 0 ;
210
211 my $status ;
212 while (1)
213 {
214 my $temp_buf ;
215
216 if (length *$self->{Pending} )
217 {
218 $temp_buf = *$self->{Pending} ;
219 *$self->{Pending} = '';
220 }
221 else
222 {
223 $status = $self->smartRead(\$temp_buf, *$self->{BlockSize}) ;
224 return $self->saveErrorString(0, "Error Reading Data")
225 if $status < 0 ;
226
227 if ($status == 0 ) {
228 *$self->{EndStream} = 1 ;
229 return $self->saveErrorString(0, "unexpected end of file", STATUS_ERROR);
230 }
231 }
232
233 $status = *$self->{Uncomp}->sync($temp_buf) ;
234
235 if ($status == STATUS_OK)
236 {
237 *$self->{Pending} .= $temp_buf ;
238 return 1 ;
239 }
240
241 last unless $status == STATUS_ERROR ;
242 }
243
244 return 0;
245}
246
247#sub performScan
248#{
249# my $self = shift ;
250#
251# my $status ;
252# my $end_offset = 0;
253#
254# $status = $self->scan()
255# #or return $self->saveErrorString(undef, "Error Scanning: $$error_ref", $self->errorNo) ;
256# or return $self->saveErrorString(G_ERR, "Error Scanning: $status")
257#
258# $status = $self->zap($end_offset)
259# or return $self->saveErrorString(G_ERR, "Error Zapping: $status");
260# #or return $self->saveErrorString(undef, "Error Zapping: $$error_ref", $self->errorNo) ;
261#
262# #(*$obj->{Deflate}, $status) = $inf->createDeflate();
263#
264## *$obj->{Header} = *$inf->{Info}{Header};
265## *$obj->{UnCompSize_32bit} =
266## *$obj->{BytesWritten} = *$inf->{UnCompSize_32bit} ;
267## *$obj->{CompSize_32bit} = *$inf->{CompSize_32bit} ;
268#
269#
270## if ( $outType eq 'buffer')
271## { substr( ${ *$self->{Buffer} }, $end_offset) = '' }
272## elsif ($outType eq 'handle' || $outType eq 'filename') {
273## *$self->{FH} = *$inf->{FH} ;
274## delete *$inf->{FH};
275## *$obj->{FH}->flush() ;
276## *$obj->{Handle} = 1 if $outType eq 'handle';
277##
278## #seek(*$obj->{FH}, $end_offset, SEEK_SET)
279## *$obj->{FH}->seek($end_offset, SEEK_SET)
280## or return $obj->saveErrorString(undef, $!, $!) ;
281## }
282#
283#}
284
285sub scan
286{
287 my $self = shift ;
288
289 return 1 if *$self->{Closed} ;
290 return 1 if !length *$self->{Pending} && *$self->{EndStream} ;
291
292 my $buffer = '' ;
293 my $len = 0;
294
295 $len = $self->_raw_read(\$buffer, 1)
296 while ! *$self->{EndStream} && $len >= 0 ;
297
298 #return $len if $len < 0 ? $len : 0 ;
299 return $len < 0 ? 0 : 1 ;
300}
301
302sub zap
303{
304 my $self = shift ;
305
306 my $headerLength = *$self->{Info}{HeaderLength};
307 my $block_offset = $headerLength + *$self->{Uncomp}->getLastBlockOffset();
308 $_[0] = $headerLength + *$self->{Uncomp}->getEndOffset();
309 #printf "# End $_[0], headerlen $headerLength \n";;
310 #printf "# block_offset $block_offset %x\n", $block_offset;
311 my $byte ;
312 ( $self->smartSeek($block_offset) &&
313 $self->smartRead(\$byte, 1) )
314 or return $self->saveErrorString(0, $!, $!);
315
316 #printf "#byte is %x\n", unpack('C*',$byte);
317 *$self->{Uncomp}->resetLastBlockByte($byte);
318 #printf "#to byte is %x\n", unpack('C*',$byte);
319
320 ( $self->smartSeek($block_offset) &&
321 $self->smartWrite($byte) )
322 or return $self->saveErrorString(0, $!, $!);
323
324 #$self->smartSeek($end_offset, 1);
325
326 return 1 ;
327}
328
329sub createDeflate
330{
331 my $self = shift ;
332 my ($def, $status) = *$self->{Uncomp}->createDeflateStream(
333 -AppendOutput => 1,
334 -WindowBits => - MAX_WBITS,
335 -CRC32 => *$self->{Params}->getValue('crc32'),
336 -ADLER32 => *$self->{Params}->getValue('adler32'),
337 );
338
339 return wantarray ? ($status, $def) : $def ;
340}
341
342
343110µs1;
344
345__END__