← Index
NYTProf Performance Profile   « line view »
For /usr/sbin/pkg_info
  Run on Fri Aug 4 10:12:01 2017
Reported on Fri Aug 4 10:12:17 2017

Filename/usr/libdata/perl5/amd64-openbsd/IO/Uncompress/Gunzip.pm
StatementsExecuted 737 statements in 4.50ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.63ms55.7msIO::Uncompress::Gunzip::::BEGIN@12IO::Uncompress::Gunzip::BEGIN@12
2111.23ms7.60msIO::Uncompress::Gunzip::::_readGzipHeaderIO::Uncompress::Gunzip::_readGzipHeader
1111.14ms8.25msIO::Uncompress::Gunzip::::BEGIN@16IO::Uncompress::Gunzip::BEGIN@16
111974µs1.38msIO::Uncompress::Gunzip::::BEGIN@17IO::Uncompress::Gunzip::BEGIN@17
111851µs857µsIO::Uncompress::Gunzip::::BEGIN@10IO::Uncompress::Gunzip::BEGIN@10
211161µs363msIO::Uncompress::Gunzip::::newIO::Uncompress::Gunzip::new
111116µs160µsIO::Uncompress::Gunzip::::BEGIN@8IO::Uncompress::Gunzip::BEGIN@8
21155µs349msIO::Uncompress::Gunzip::::ckMagicIO::Uncompress::Gunzip::ckMagic
11150µs103µsIO::Uncompress::Gunzip::::BEGIN@9IO::Uncompress::Gunzip::BEGIN@9
21129µs7.63msIO::Uncompress::Gunzip::::readHeaderIO::Uncompress::Gunzip::readHeader
21128µs46µsIO::Uncompress::Gunzip::::isGzipMagicIO::Uncompress::Gunzip::isGzipMagic
63124µs24µsIO::Uncompress::Gunzip::::CORE:unpackIO::Uncompress::Gunzip::CORE:unpack (opcode)
21124µs26µsIO::Uncompress::Gunzip::::chkTrailerIO::Uncompress::Gunzip::chkTrailer
21121µs21µsIO::Uncompress::Gunzip::::getExtraParamsIO::Uncompress::Gunzip::getExtraParams
21120µs57µsIO::Uncompress::Gunzip::::ckParamsIO::Uncompress::Gunzip::ckParams
11114µs153µsIO::Uncompress::Gunzip::::BEGIN@15IO::Uncompress::Gunzip::BEGIN@15
11112µs18µsIO::Uncompress::Gunzip::::BEGIN@14IO::Uncompress::Gunzip::BEGIN@14
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
418µsrequire 5.006 ;
5
6# for RFC1952
7
82165µs2205µs
# spent 160µs (116+44) within IO::Uncompress::Gunzip::BEGIN@8 which was called: # once (116µs+44µs) by OpenBSD::PackageRepository::uncompress at line 8
use strict ;
# spent 160µs making 1 call to IO::Uncompress::Gunzip::BEGIN@8 # spent 44µs making 1 call to strict::import
92112µs2157µs
# spent 103µs (50+53) within IO::Uncompress::Gunzip::BEGIN@9 which was called: # once (50µs+53µs) by OpenBSD::PackageRepository::uncompress at line 9
use warnings;
# spent 103µs making 1 call to IO::Uncompress::Gunzip::BEGIN@9 # spent 53µs making 1 call to warnings::import
102897µs2862µs
# spent 857µs (851+6) within IO::Uncompress::Gunzip::BEGIN@10 which was called: # once (851µs+6µs) by OpenBSD::PackageRepository::uncompress at line 10
use bytes;
# spent 857µs making 1 call to IO::Uncompress::Gunzip::BEGIN@10 # spent 6µs making 1 call to bytes::import
11
123340µs355.7ms
# spent 55.7ms (1.63+54.1) within IO::Uncompress::Gunzip::BEGIN@12 which was called: # once (1.63ms+54.1ms) by OpenBSD::PackageRepository::uncompress at line 12
use IO::Uncompress::RawInflate 2.069 ;
# spent 55.7ms making 1 call to IO::Uncompress::Gunzip::BEGIN@12 # spent 25µs making 1 call to Exporter::import # spent 8µs making 1 call to UNIVERSAL::VERSION
13
14343µs225µs
# spent 18µs (12+7) within IO::Uncompress::Gunzip::BEGIN@14 which was called: # once (12µs+7µs) by OpenBSD::PackageRepository::uncompress at line 14
use Compress::Raw::Zlib 2.069 () ;
# spent 18µs making 1 call to IO::Uncompress::Gunzip::BEGIN@14 # spent 7µs making 1 call to UNIVERSAL::VERSION
15341µs3293µs
# spent 153µs (14+139) within IO::Uncompress::Gunzip::BEGIN@15 which was called: # once (14µs+139µs) by OpenBSD::PackageRepository::uncompress at line 15
use IO::Compress::Base::Common 2.069 qw(:Status );
# spent 153µs making 1 call to IO::Uncompress::Gunzip::BEGIN@15 # spent 133µs making 1 call to Exporter::import # spent 6µs making 1 call to UNIVERSAL::VERSION
163158µs313.7ms
# spent 8.25ms (1.14+7.11) within IO::Uncompress::Gunzip::BEGIN@16 which was called: # once (1.14ms+7.11ms) by OpenBSD::PackageRepository::uncompress at line 16
use IO::Compress::Gzip::Constants 2.069 ;
# spent 8.25ms making 1 call to IO::Uncompress::Gunzip::BEGIN@16 # spent 5.42ms making 1 call to Exporter::import # spent 9µs making 1 call to UNIVERSAL::VERSION
1731.24ms21.39ms
# spent 1.38ms (974µs+404µs) within IO::Uncompress::Gunzip::BEGIN@17 which was called: # once (974µs+404µs) by OpenBSD::PackageRepository::uncompress at line 17
use IO::Compress::Zlib::Extra 2.069 ;
# spent 1.38ms making 1 call to IO::Uncompress::Gunzip::BEGIN@17 # spent 8µs making 1 call to UNIVERSAL::VERSION
18
1911µsrequire Exporter ;
20
21our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GunzipError);
22
23113µs@ISA = qw( Exporter IO::Uncompress::RawInflate );
2411µs@EXPORT_OK = qw( $GunzipError gunzip );
2512µs%EXPORT_TAGS = %IO::Uncompress::RawInflate::DEFLATE_CONSTANTS ;
2612µspush @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
2717µs129µsExporter::export_ok_tags('all');
# spent 29µs making 1 call to Exporter::export_ok_tags
28
291800ns$GunzipError = '';
30
311700ns$VERSION = '2.069_001';
32
33sub new
34
# spent 363ms (161µs+363) within IO::Uncompress::Gunzip::new which was called 2 times, avg 181ms/call: # 2 times (161µs+363ms) by OpenBSD::PackageRepository::uncompress at line 404 of OpenBSD/PackageRepository.pm, avg 181ms/call
{
3522µs my $class = shift ;
36228µs $GunzipError = '';
37278µs2714µs my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$GunzipError);
# spent 714µs making 2 calls to IO::Compress::Base::Common::createSelfTiedObject, avg 357µs/call
38
39258µs2362ms $obj->_create(undef, 0, @_);
# spent 362ms making 2 calls to IO::Uncompress::Base::_create, avg 181ms/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 21µs within IO::Uncompress::Gunzip::getExtraParams which was called 2 times, avg 11µs/call: # 2 times (21µs+0s) by IO::Uncompress::Base::checkParams at line 350 of IO/Uncompress/Base.pm, avg 11µs/call
{
50218µs return ( 'parseextra' => [IO::Compress::Base::Common::Parse_boolean, 0] ) ;
51}
52
53sub ckParams
54
# spent 57µs (20+37) within IO::Uncompress::Gunzip::ckParams which was called 2 times, avg 28µs/call: # 2 times (20µs+37µs) by IO::Uncompress::Base::_create at line 411 of IO/Uncompress/Base.pm, avg 28µs/call
{
5522µs my $self = shift ;
5622µs my $got = shift ;
57
58 # gunzip always needs crc32
5928µs237µs $got->setValue('crc32' => 1);
# spent 37µs making 2 calls to IO::Compress::Base::Parameters::setValue, avg 19µs/call
60
61224µs return 1;
62}
63
64sub ckMagic
65
# spent 349ms (55µs+349) within IO::Uncompress::Gunzip::ckMagic which was called 2 times, avg 174ms/call: # 2 times (55µs+349ms) by IO::Uncompress::RawInflate::mkUncomp at line 87 of IO/Uncompress/RawInflate.pm, avg 174ms/call
{
6622µs my $self = shift;
67
6822µs my $magic ;
69229µs2349ms $self->smartReadExact(\$magic, GZIP_ID_SIZE);
# spent 349ms making 2 calls to IO::Uncompress::Base::smartReadExact, avg 174ms/call
70
7126µs *$self->{HeaderPending} = $magic ;
72
7322µs return $self->HeaderError("Minimum header size is " .
74 GZIP_MIN_HEADER_SIZE . " bytes")
75 if length $magic != GZIP_ID_SIZE ;
76
77210µs246µs return $self->HeaderError("Bad Magic")
# spent 46µs making 2 calls to IO::Uncompress::Gunzip::isGzipMagic, avg 23µs/call
78 if ! isGzipMagic($magic) ;
79
8024µs *$self->{Type} = 'rfc1952';
81
82213µs return $magic ;
83}
84
85sub readHeader
86
# spent 7.63ms (29µs+7.60) within IO::Uncompress::Gunzip::readHeader which was called 2 times, avg 3.82ms/call: # 2 times (29µs+7.60ms) by IO::Uncompress::RawInflate::mkUncomp at line 90 of IO/Uncompress/RawInflate.pm, avg 3.82ms/call
{
8722µs my $self = shift;
8822µs my $magic = shift;
89
90220µs27.60ms return $self->_readGzipHeader($magic);
# spent 7.60ms making 2 calls to IO::Uncompress::Gunzip::_readGzipHeader, avg 3.80ms/call
91}
92
93sub chkTrailer
94
# spent 26µs (24+2) within IO::Uncompress::Gunzip::chkTrailer which was called 2 times, avg 13µs/call: # 2 times (24µs+2µs) by IO::Uncompress::Base::_raw_read at line 954 of IO/Uncompress/Base.pm, avg 13µs/call
{
9522µs my $self = shift;
9622µs my $trailer = shift;
97
98 # Check CRC & ISIZE
99210µs22µs my ($CRC32, $ISIZE) = unpack("V V", $trailer) ;
# spent 2µs making 2 calls to IO::Uncompress::Gunzip::CORE:unpack, avg 1µs/call
10023µs *$self->{Info}{CRC32} = $CRC32;
10123µs *$self->{Info}{ISIZE} = $ISIZE;
102
10322µ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
11328µs return STATUS_OK;
114}
115
116sub isGzipMagic
117
# spent 46µs (28+18) within IO::Uncompress::Gunzip::isGzipMagic which was called 2 times, avg 23µs/call: # 2 times (28µs+18µs) by IO::Uncompress::Gunzip::ckMagic at line 77, avg 23µs/call
{
11822µs my $buffer = shift ;
11922µs return 0 if length $buffer < GZIP_ID_SIZE ;
120232µs218µs my ($id1, $id2) = unpack("C C", $buffer) ;
# spent 18µs making 2 calls to IO::Uncompress::Gunzip::CORE:unpack, avg 9µs/call
121215µ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 7.60ms (1.23+6.37) within IO::Uncompress::Gunzip::_readGzipHeader which was called 2 times, avg 3.80ms/call: # 2 times (1.23ms+6.37ms) by IO::Uncompress::Gunzip::readHeader at line 90, avg 3.80ms/call
{
14822µs my ($self, $magic) = @_ ;
14922µs my ($HeaderCRC) ;
15022µs my ($buffer) = '' ;
151
15229µs2105µs $self->smartReadExact(\$buffer, GZIP_MIN_HEADER_SIZE - GZIP_ID_SIZE)
# spent 105µs making 2 calls to IO::Uncompress::Base::smartReadExact, avg 53µs/call
153 or return $self->HeaderError("Minimum header size is " .
154 GZIP_MIN_HEADER_SIZE . " bytes") ;
155
15624µs my $keep = $magic . $buffer ;
15723µs *$self->{HeaderPending} = $keep ;
158
159 # now split out the various parts
160213µs24µs my ($cm, $flag, $mtime, $xfl, $os) = unpack("C C V C C", $buffer) ;
# spent 4µs making 2 calls to IO::Uncompress::Gunzip::CORE:unpack, avg 2µs/call
161
16222µs $cm == GZIP_CM_DEFLATED
163 or return $self->HeaderError("Not Deflate (CM is $cm)") ;
164
165 # check for use of reserved bits
16622µs return $self->HeaderError("Use of Reserved Bits in FLG field.")
167 if $flag & GZIP_FLG_RESERVED ;
168
16922µs my $EXTRA ;
17024µs my @EXTRA = () ;
17122µ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
18922µs my $origname ;
19022µ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
20422µs my $comment ;
20523µs if ($flag & GZIP_FLG_FCOMMENT) {
20622µs $comment = "";
20722µs while (1) {
208200479µs2006.26ms $self->smartReadExact(\$buffer, 1)
# spent 6.26ms making 200 calls to IO::Uncompress::Base::smartReadExact, avg 31µs/call
209 or return $self->TruncatedHeader("FCOMMENT");
210200124µs last if $buffer eq GZIP_NULL_BYTE ;
211198251µs $comment .= $buffer
212 }
21324µs $keep .= $comment . GZIP_NULL_BYTE ;
214
215 return $self->HeaderError("Non ISO 8859-1 Character found in Comment")
21623µs if *$self->{Strict} && $comment =~ /$GZIP_FCOMMENT_INVALID_CHAR_RE/o ;
217 }
218
21922µ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
23623µ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}
2582146µs ? $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
27319µs1;
274
275__END__
 
# spent 24µs within IO::Uncompress::Gunzip::CORE:unpack which was called 6 times, avg 4µs/call: # 2 times (18µs+0s) by IO::Uncompress::Gunzip::isGzipMagic at line 120, avg 9µs/call # 2 times (4µs+0s) by IO::Uncompress::Gunzip::_readGzipHeader at line 160, avg 2µs/call # 2 times (2µs+0s) by IO::Uncompress::Gunzip::chkTrailer at line 99, avg 1µs/call
sub IO::Uncompress::Gunzip::CORE:unpack; # opcode