← Index
NYTProf Performance Profile   « line view »
For /usr/sbin/pkg_info
  Run on Mon Aug 7 09:39:31 2017
Reported on Mon Aug 7 09:40:21 2017

Filename/usr/libdata/perl5/amd64-openbsd/IO/Uncompress/Gunzip.pm
StatementsExecuted 15518 statements in 55.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
8011118ms476msIO::Uncompress::Gunzip::::_readGzipHeaderIO::Uncompress::Gunzip::_readGzipHeader
40117.80ms11.0sIO::Uncompress::Gunzip::::newIO::Uncompress::Gunzip::new
80222.25ms10.1sIO::Uncompress::Gunzip::::ckMagicIO::Uncompress::Gunzip::ckMagic
1111.60ms43.8msIO::Uncompress::Gunzip::::BEGIN@12IO::Uncompress::Gunzip::BEGIN@12
1111.07ms3.00msIO::Uncompress::Gunzip::::BEGIN@16IO::Uncompress::Gunzip::BEGIN@16
40111.05ms1.05msIO::Uncompress::Gunzip::::getExtraParamsIO::Uncompress::Gunzip::getExtraParams
8011967µs1.20msIO::Uncompress::Gunzip::::isGzipMagicIO::Uncompress::Gunzip::isGzipMagic
111873µs1.23msIO::Uncompress::Gunzip::::BEGIN@17IO::Uncompress::Gunzip::BEGIN@17
8022778µs477msIO::Uncompress::Gunzip::::readHeaderIO::Uncompress::Gunzip::readHeader
111637µs642µsIO::Uncompress::Gunzip::::BEGIN@10IO::Uncompress::Gunzip::BEGIN@10
4011627µs1.91msIO::Uncompress::Gunzip::::ckParamsIO::Uncompress::Gunzip::ckParams
4111588µs663µsIO::Uncompress::Gunzip::::chkTrailerIO::Uncompress::Gunzip::chkTrailer
20131467µs467µsIO::Uncompress::Gunzip::::CORE:unpackIO::Uncompress::Gunzip::CORE:unpack (opcode)
11176µs138µsIO::Uncompress::Gunzip::::BEGIN@9IO::Uncompress::Gunzip::BEGIN@9
11162µs99µsIO::Uncompress::Gunzip::::BEGIN@8IO::Uncompress::Gunzip::BEGIN@8
11130µs37µsIO::Uncompress::Gunzip::::BEGIN@14IO::Uncompress::Gunzip::BEGIN@14
11114µs144µsIO::Uncompress::Gunzip::::BEGIN@15IO::Uncompress::Gunzip::BEGIN@15
0000s0sIO::Uncompress::Gunzip::::_readFullGzipHeaderIO::Uncompress::Gunzip::_readFullGzipHeader
0000s0sIO::Uncompress::Gunzip::::gunzipIO::Uncompress::Gunzip::gunzip
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package IO::Uncompress::Gunzip ;
3
417µsrequire 5.006 ;
5
6# for RFC1952
7
82144µs2137µs
# spent 99µs (62+37) within IO::Uncompress::Gunzip::BEGIN@8 which was called: # once (62µs+37µs) by OpenBSD::PackageRepository::uncompress at line 8
use strict ;
# spent 99µs making 1 call to IO::Uncompress::Gunzip::BEGIN@8 # spent 37µs making 1 call to strict::import
92103µs2200µs
# spent 138µs (76+62) within IO::Uncompress::Gunzip::BEGIN@9 which was called: # once (76µs+62µs) by OpenBSD::PackageRepository::uncompress at line 9
use warnings;
# spent 138µs making 1 call to IO::Uncompress::Gunzip::BEGIN@9 # spent 62µs making 1 call to warnings::import
102652µs2646µs
# spent 642µs (637+4) within IO::Uncompress::Gunzip::BEGIN@10 which was called: # once (637µs+4µs) by OpenBSD::PackageRepository::uncompress at line 10
use bytes;
# spent 642µs making 1 call to IO::Uncompress::Gunzip::BEGIN@10 # spent 4µs making 1 call to bytes::import
11
123312µs343.9ms
# spent 43.8ms (1.60+42.2) within IO::Uncompress::Gunzip::BEGIN@12 which was called: # once (1.60ms+42.2ms) by OpenBSD::PackageRepository::uncompress at line 12
use IO::Uncompress::RawInflate 2.069 ;
# spent 43.8ms making 1 call to IO::Uncompress::Gunzip::BEGIN@12 # spent 25µs making 1 call to Exporter::import # spent 9µs making 1 call to UNIVERSAL::VERSION
13
14363µs244µs
# spent 37µs (30+7) within IO::Uncompress::Gunzip::BEGIN@14 which was called: # once (30µs+7µs) by OpenBSD::PackageRepository::uncompress at line 14
use Compress::Raw::Zlib 2.069 () ;
# spent 37µs making 1 call to IO::Uncompress::Gunzip::BEGIN@14 # spent 7µs making 1 call to UNIVERSAL::VERSION
15343µs3274µs
# spent 144µs (14+130) within IO::Uncompress::Gunzip::BEGIN@15 which was called: # once (14µs+130µs) by OpenBSD::PackageRepository::uncompress at line 15
use IO::Compress::Base::Common 2.069 qw(:Status );
# spent 144µs making 1 call to IO::Uncompress::Gunzip::BEGIN@15 # spent 123µs making 1 call to Exporter::import # spent 7µs making 1 call to UNIVERSAL::VERSION
163147µs33.32ms
# spent 3.00ms (1.07+1.93) within IO::Uncompress::Gunzip::BEGIN@16 which was called: # once (1.07ms+1.93ms) by OpenBSD::PackageRepository::uncompress at line 16
use IO::Compress::Gzip::Constants 2.069 ;
# spent 3.00ms making 1 call to IO::Uncompress::Gunzip::BEGIN@16 # spent 304µs making 1 call to Exporter::import # spent 9µs making 1 call to UNIVERSAL::VERSION
1731.12ms21.24ms
# spent 1.23ms (873µs+360µs) within IO::Uncompress::Gunzip::BEGIN@17 which was called: # once (873µs+360µs) by OpenBSD::PackageRepository::uncompress at line 17
use IO::Compress::Zlib::Extra 2.069 ;
# spent 1.23ms making 1 call to IO::Uncompress::Gunzip::BEGIN@17 # spent 7µs making 1 call to UNIVERSAL::VERSION
18
1911µsrequire Exporter ;
20
21our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GunzipError);
22
23110µs@ISA = qw( Exporter IO::Uncompress::RawInflate );
2411µs@EXPORT_OK = qw( $GunzipError gunzip );
2511µs%EXPORT_TAGS = %IO::Uncompress::RawInflate::DEFLATE_CONSTANTS ;
2612µspush @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
2714µs122µsExporter::export_ok_tags('all');
# spent 22µs making 1 call to Exporter::export_ok_tags
28
291800ns$GunzipError = '';
30
311600ns$VERSION = '2.069_001';
32
33sub new
34
# spent 11.0s (7.80ms+11.0) within IO::Uncompress::Gunzip::new which was called 40 times, avg 275ms/call: # 40 times (7.80ms+11.0s) by OpenBSD::PackageRepository::uncompress at line 404 of OpenBSD/PackageRepository.pm, avg 275ms/call
{
3540552µs my $class = shift ;
36401.07ms $GunzipError = '';
37403.74ms4025.3ms my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$GunzipError);
# spent 25.3ms making 40 calls to IO::Compress::Base::Common::createSelfTiedObject, avg 632µs/call
38
39402.13ms4011.0s $obj->_create(undef, 0, @_);
# spent 11.0s making 40 calls to IO::Uncompress::Base::_create, avg 274ms/call
40}
41
42sub gunzip
43{
44 my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$GunzipError);
45 return $obj->_inf(@_) ;
46}
47
48sub getExtraParams
49
# spent 1.05ms within IO::Uncompress::Gunzip::getExtraParams which was called 40 times, avg 26µs/call: # 40 times (1.05ms+0s) by IO::Uncompress::Base::checkParams at line 350 of IO/Uncompress/Base.pm, avg 26µs/call
{
50409.26ms return ( 'parseextra' => [IO::Compress::Base::Common::Parse_boolean, 0] ) ;
51}
52
53sub ckParams
54
# spent 1.91ms (627µs+1.28) within IO::Uncompress::Gunzip::ckParams which was called 40 times, avg 48µs/call: # 40 times (627µs+1.28ms) by IO::Uncompress::Base::_create at line 411 of IO/Uncompress/Base.pm, avg 48µs/call
{
554047µs my $self = shift ;
564044µs my $got = shift ;
57
58 # gunzip always needs crc32
5940647µs401.28ms $got->setValue('crc32' => 1);
# spent 1.28ms making 40 calls to IO::Compress::Base::Parameters::setValue, avg 32µs/call
60
6140194µs return 1;
62}
63
64sub ckMagic
65
# spent 10.1s (2.25ms+10.1) within IO::Uncompress::Gunzip::ckMagic which was called 80 times, avg 127ms/call: # 40 times (1.20ms+10.1s) by IO::Uncompress::RawInflate::mkUncomp at line 87 of IO/Uncompress/RawInflate.pm, avg 254ms/call # 40 times (1.05ms+1.21ms) by IO::Uncompress::Base::gotoNextStream at line 1040 of IO/Uncompress/Base.pm, avg 57µs/call
{
668099µs my $self = shift;
67
688068µs my $magic ;
69801.25ms8010.1s $self->smartReadExact(\$magic, GZIP_ID_SIZE);
# spent 10.1s making 80 calls to IO::Uncompress::Base::smartReadExact, avg 127ms/call
70
7180215µs *$self->{HeaderPending} = $magic ;
72
7380421µs return $self->HeaderError("Minimum header size is " .
74 GZIP_MIN_HEADER_SIZE . " bytes")
75 if length $magic != GZIP_ID_SIZE ;
76
7780395µs801.20ms return $self->HeaderError("Bad Magic")
# spent 1.20ms making 80 calls to IO::Uncompress::Gunzip::isGzipMagic, avg 15µs/call
78 if ! isGzipMagic($magic) ;
79
8080150µs *$self->{Type} = 'rfc1952';
81
8280446µs return $magic ;
83}
84
85sub readHeader
86
# spent 477ms (778µs+476) within IO::Uncompress::Gunzip::readHeader which was called 80 times, avg 5.97ms/call: # 40 times (452µs+474ms) by IO::Uncompress::RawInflate::mkUncomp at line 90 of IO/Uncompress/RawInflate.pm, avg 11.9ms/call # 40 times (326µs+2.50ms) by IO::Uncompress::Base::gotoNextStream at line 1056 of IO/Uncompress/Base.pm, avg 71µs/call
{
878085µs my $self = shift;
888082µs my $magic = shift;
89
9080922µs80476ms return $self->_readGzipHeader($magic);
# spent 476ms making 80 calls to IO::Uncompress::Gunzip::_readGzipHeader, avg 5.96ms/call
91}
92
93sub chkTrailer
94
# spent 663µs (588+75) within IO::Uncompress::Gunzip::chkTrailer which was called 41 times, avg 16µs/call: # 41 times (588µs+75µs) by IO::Uncompress::Base::_raw_read at line 954 of IO/Uncompress/Base.pm, avg 16µs/call
{
954140µs my $self = shift;
964144µs my $trailer = shift;
97
98 # Check CRC & ISIZE
9941260µs4175µs my ($CRC32, $ISIZE) = unpack("V V", $trailer) ;
# spent 75µs making 41 calls to IO::Uncompress::Gunzip::CORE:unpack, avg 2µs/call
1004170µs *$self->{Info}{CRC32} = $CRC32;
1014163µs *$self->{Info}{ISIZE} = $ISIZE;
102
1034149µs if (*$self->{Strict}) {
104 return $self->TrailerError("CRC mismatch")
105 if $CRC32 != *$self->{Uncomp}->crc32() ;
106
107 my $exp_isize = *$self->{UnCompSize}->get32bit();
108 return $self->TrailerError("ISIZE mismatch. Got $ISIZE"
109 . ", expected $exp_isize")
110 if $ISIZE != $exp_isize ;
111 }
112
11341176µs return STATUS_OK;
114}
115
116sub isGzipMagic
117
# spent 1.20ms (967µs+237µs) within IO::Uncompress::Gunzip::isGzipMagic which was called 80 times, avg 15µs/call: # 80 times (967µs+237µs) by IO::Uncompress::Gunzip::ckMagic at line 77, avg 15µs/call
{
1188086µs my $buffer = shift ;
1198084µs return 0 if length $buffer < GZIP_ID_SIZE ;
12080657µs80237µs my ($id1, $id2) = unpack("C C", $buffer) ;
# spent 237µs making 80 calls to IO::Uncompress::Gunzip::CORE:unpack, avg 3µs/call
12180465µs return $id1 == GZIP_ID1 && $id2 == GZIP_ID2 ;
122}
123
124sub _readFullGzipHeader($)
125{
126 my ($self) = @_ ;
127 my $magic = '' ;
128
129 $self->smartReadExact(\$magic, GZIP_ID_SIZE);
130
131 *$self->{HeaderPending} = $magic ;
132
133 return $self->HeaderError("Minimum header size is " .
134 GZIP_MIN_HEADER_SIZE . " bytes")
135 if length $magic != GZIP_ID_SIZE ;
136
137
138 return $self->HeaderError("Bad Magic")
139 if ! isGzipMagic($magic) ;
140
141 my $status = $self->_readGzipHeader($magic);
142 delete *$self->{Transparent} if ! defined $status ;
143 return $status ;
144}
145
146sub _readGzipHeader($)
147
# spent 476ms (118+358) within IO::Uncompress::Gunzip::_readGzipHeader which was called 80 times, avg 5.96ms/call: # 80 times (118ms+358ms) by IO::Uncompress::Gunzip::readHeader at line 90, avg 5.96ms/call
{
1488098µs my ($self, $magic) = @_ ;
1498065µs my ($HeaderCRC) ;
15080105µs my ($buffer) = '' ;
151
15280361µs803.49ms $self->smartReadExact(\$buffer, GZIP_MIN_HEADER_SIZE - GZIP_ID_SIZE)
# spent 3.49ms making 80 calls to IO::Uncompress::Base::smartReadExact, avg 44µs/call
153 or return $self->HeaderError("Minimum header size is " .
154 GZIP_MIN_HEADER_SIZE . " bytes") ;
155
15680146µs my $keep = $magic . $buffer ;
15780130µs *$self->{HeaderPending} = $keep ;
158
159 # now split out the various parts
16080499µs80155µs my ($cm, $flag, $mtime, $xfl, $os) = unpack("C C V C C", $buffer) ;
# spent 155µs making 80 calls to IO::Uncompress::Gunzip::CORE:unpack, avg 2µs/call
161
1628078µs $cm == GZIP_CM_DEFLATED
163 or return $self->HeaderError("Not Deflate (CM is $cm)") ;
164
165 # check for use of reserved bits
1668094µs return $self->HeaderError("Use of Reserved Bits in FLG field.")
167 if $flag & GZIP_FLG_RESERVED ;
168
1698071µs my $EXTRA ;
17080177µs my @EXTRA = () ;
1718077µs if ($flag & GZIP_FLG_FEXTRA) {
172 $EXTRA = "" ;
173 $self->smartReadExact(\$buffer, GZIP_FEXTRA_HEADER_SIZE)
174 or return $self->TruncatedHeader("FEXTRA Length") ;
175
176 my ($XLEN) = unpack("v", $buffer) ;
177 $self->smartReadExact(\$EXTRA, $XLEN)
178 or return $self->TruncatedHeader("FEXTRA Body");
179 $keep .= $buffer . $EXTRA ;
180
181 if ($XLEN && *$self->{'ParseExtra'}) {
182 my $bad = IO::Compress::Zlib::Extra::parseRawExtra($EXTRA,
183 \@EXTRA, 1, 1);
184 return $self->HeaderError($bad)
185 if defined $bad;
186 }
187 }
188
1898077µs my $origname ;
1908073µs if ($flag & GZIP_FLG_FNAME) {
191 $origname = "" ;
192 while (1) {
193 $self->smartReadExact(\$buffer, 1)
194 or return $self->TruncatedHeader("FNAME");
195 last if $buffer eq GZIP_NULL_BYTE ;
196 $origname .= $buffer
197 }
198 $keep .= $origname . GZIP_NULL_BYTE ;
199
200 return $self->HeaderError("Non ISO 8859-1 Character found in Name")
201 if *$self->{Strict} && $origname =~ /$GZIP_FNAME_INVALID_CHAR_RE/o ;
202 }
203
2048065µs my $comment ;
20580111µs if ($flag & GZIP_FLG_FCOMMENT) {
2064047µs $comment = "";
2074040µs while (1) {
208400012.9ms4000355ms $self->smartReadExact(\$buffer, 1)
# spent 355ms making 4000 calls to IO::Uncompress::Base::smartReadExact, avg 89µs/call
209 or return $self->TruncatedHeader("FCOMMENT");
21040003.00ms last if $buffer eq GZIP_NULL_BYTE ;
21139606.05ms $comment .= $buffer
212 }
21340363µs $keep .= $comment . GZIP_NULL_BYTE ;
214
215 return $self->HeaderError("Non ISO 8859-1 Character found in Comment")
2164052µs if *$self->{Strict} && $comment =~ /$GZIP_FCOMMENT_INVALID_CHAR_RE/o ;
217 }
218
2198079µs if ($flag & GZIP_FLG_FHCRC) {
220 $self->smartReadExact(\$buffer, GZIP_FHCRC_SIZE)
221 or return $self->TruncatedHeader("FHCRC");
222
223 $HeaderCRC = unpack("v", $buffer) ;
224 my $crc16 = Compress::Raw::Zlib::crc32($keep) & 0xFF ;
225
226 return $self->HeaderError("CRC16 mismatch.")
227 if *$self->{Strict} && $crc16 != $HeaderCRC;
228
229 $keep .= $buffer ;
230 }
231
232 # Assume compression method is deflated for xfl tests
233 #if ($xfl) {
234 #}
235
23680112µs *$self->{Type} = 'rfc1952';
237
238 return {
239 'Type' => 'rfc1952',
240 'FingerprintLength' => 2,
241 'HeaderLength' => length $keep,
242 'TrailerLength' => GZIP_TRAILER_SIZE,
243 'Header' => $keep,
244 'isMinimalHeader' => $keep eq GZIP_MINIMUM_HEADER ? 1 : 0,
245
246 'MethodID' => $cm,
247 'MethodName' => $cm == GZIP_CM_DEFLATED ? "Deflated" : "Unknown" ,
248 'TextFlag' => $flag & GZIP_FLG_FTEXT ? 1 : 0,
249 'HeaderCRCFlag' => $flag & GZIP_FLG_FHCRC ? 1 : 0,
250 'NameFlag' => $flag & GZIP_FLG_FNAME ? 1 : 0,
251 'CommentFlag' => $flag & GZIP_FLG_FCOMMENT ? 1 : 0,
252 'ExtraFlag' => $flag & GZIP_FLG_FEXTRA ? 1 : 0,
253 'Name' => $origname,
254 'Comment' => $comment,
255 'Time' => $mtime,
256 'OsID' => $os,
257 'OsName' => defined $GZIP_OS_Names{$os}
258803.91ms ? $GZIP_OS_Names{$os} : "Unknown",
259 'HeaderCRC' => $HeaderCRC,
260 'Flags' => $flag,
261 'ExtraFlags' => $xfl,
262 'ExtraFieldRaw' => $EXTRA,
263 'ExtraField' => [ @EXTRA ],
264
265
266 #'CompSize'=> $compsize,
267 #'CRC32'=> $CRC32,
268 #'OrigSize'=> $ISIZE,
269 }
270}
271
272
27318µs1;
274
275__END__
 
# spent 467µs within IO::Uncompress::Gunzip::CORE:unpack which was called 201 times, avg 2µs/call: # 80 times (237µs+0s) by IO::Uncompress::Gunzip::isGzipMagic at line 120, avg 3µs/call # 80 times (155µs+0s) by IO::Uncompress::Gunzip::_readGzipHeader at line 160, avg 2µs/call # 41 times (75µs+0s) by IO::Uncompress::Gunzip::chkTrailer at line 99, avg 2µs/call
sub IO::Uncompress::Gunzip::CORE:unpack; # opcode