← 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:35 2013

Filename/usr/lib/perl/5.10/IO/Uncompress/Gunzip.pm
StatementsExecuted 38 statements in 1.98ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.61ms13.9msIO::Uncompress::Gunzip::::BEGIN@12IO::Uncompress::Gunzip::BEGIN@12
11123µs211µsIO::Uncompress::Gunzip::::BEGIN@50IO::Uncompress::Gunzip::BEGIN@50
11121µs55µsIO::Uncompress::Gunzip::::BEGIN@9IO::Uncompress::Gunzip::BEGIN@9
11119µs24µsIO::Uncompress::Gunzip::::BEGIN@8IO::Uncompress::Gunzip::BEGIN@8
11119µs384µsIO::Uncompress::Gunzip::::BEGIN@16IO::Uncompress::Gunzip::BEGIN@16
11116µs68µsIO::Uncompress::Gunzip::::BEGIN@14IO::Uncompress::Gunzip::BEGIN@14
11115µs178µsIO::Uncompress::Gunzip::::BEGIN@15IO::Uncompress::Gunzip::BEGIN@15
11115µs30µsIO::Uncompress::Gunzip::::BEGIN@17IO::Uncompress::Gunzip::BEGIN@17
11113µs17µsIO::Uncompress::Gunzip::::BEGIN@10IO::Uncompress::Gunzip::BEGIN@10
0000s0sIO::Uncompress::Gunzip::::_readFullGzipHeaderIO::Uncompress::Gunzip::_readFullGzipHeader
0000s0sIO::Uncompress::Gunzip::::_readGzipHeaderIO::Uncompress::Gunzip::_readGzipHeader
0000s0sIO::Uncompress::Gunzip::::chkTrailerIO::Uncompress::Gunzip::chkTrailer
0000s0sIO::Uncompress::Gunzip::::ckMagicIO::Uncompress::Gunzip::ckMagic
0000s0sIO::Uncompress::Gunzip::::ckParamsIO::Uncompress::Gunzip::ckParams
0000s0sIO::Uncompress::Gunzip::::getExtraParamsIO::Uncompress::Gunzip::getExtraParams
0000s0sIO::Uncompress::Gunzip::::gunzipIO::Uncompress::Gunzip::gunzip
0000s0sIO::Uncompress::Gunzip::::isGzipMagicIO::Uncompress::Gunzip::isGzipMagic
0000s0sIO::Uncompress::Gunzip::::newIO::Uncompress::Gunzip::new
0000s0sIO::Uncompress::Gunzip::::readHeaderIO::Uncompress::Gunzip::readHeader
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
4120µsrequire 5.004 ;
5
6# for RFC1952
7
8346µs229µs
# spent 24µs (19+5) within IO::Uncompress::Gunzip::BEGIN@8 which was called: # once (19µs+5µs) by Compress::Zlib::BEGIN@14 at line 8
use strict ;
# spent 24µs making 1 call to IO::Uncompress::Gunzip::BEGIN@8 # spent 5µs making 1 call to strict::import
9352µs289µs
# spent 55µs (21+34) within IO::Uncompress::Gunzip::BEGIN@9 which was called: # once (21µs+34µs) by Compress::Zlib::BEGIN@14 at line 9
use warnings;
# spent 55µs making 1 call to IO::Uncompress::Gunzip::BEGIN@9 # spent 34µs making 1 call to warnings::import
10332µs220µs
# spent 17µs (13+3) within IO::Uncompress::Gunzip::BEGIN@10 which was called: # once (13µs+3µs) by Compress::Zlib::BEGIN@14 at line 10
use bytes;
# spent 17µs making 1 call to IO::Uncompress::Gunzip::BEGIN@10 # spent 3µs making 1 call to bytes::import
11
123183µs313.9ms
# spent 13.9ms (1.61+12.3) within IO::Uncompress::Gunzip::BEGIN@12 which was called: # once (1.61ms+12.3ms) by Compress::Zlib::BEGIN@14 at line 12
use IO::Uncompress::RawInflate 2.020 ;
# spent 13.9ms making 1 call to IO::Uncompress::Gunzip::BEGIN@12 # spent 28µs making 1 call to Exporter::import # spent 16µs making 1 call to UNIVERSAL::VERSION
13
14358µs3119µs
# spent 68µs (16+52) within IO::Uncompress::Gunzip::BEGIN@14 which was called: # once (16µs+52µs) by Compress::Zlib::BEGIN@14 at line 14
use Compress::Raw::Zlib 2.020 qw( crc32 ) ;
# spent 68µs making 1 call to IO::Uncompress::Gunzip::BEGIN@14 # spent 37µs making 1 call to Exporter::import # spent 15µs making 1 call to UNIVERSAL::VERSION
15357µs3342µs
# spent 178µs (15+163) within IO::Uncompress::Gunzip::BEGIN@15 which was called: # once (15µs+163µs) by Compress::Zlib::BEGIN@14 at line 15
use IO::Compress::Base::Common 2.020 qw(:Status createSelfTiedObject);
# spent 178µs making 1 call to IO::Uncompress::Gunzip::BEGIN@15 # spent 150µs making 1 call to Exporter::import # spent 13µs making 1 call to UNIVERSAL::VERSION
16361µs3749µs
# spent 384µs (19+365) within IO::Uncompress::Gunzip::BEGIN@16 which was called: # once (19µs+365µs) by Compress::Zlib::BEGIN@14 at line 16
use IO::Compress::Gzip::Constants 2.020 ;
# spent 384µs making 1 call to IO::Uncompress::Gunzip::BEGIN@16 # spent 350µs making 1 call to Exporter::import # spent 15µs making 1 call to UNIVERSAL::VERSION
173223µs244µs
# spent 30µs (15+15) within IO::Uncompress::Gunzip::BEGIN@17 which was called: # once (15µs+15µs) by Compress::Zlib::BEGIN@14 at line 17
use IO::Compress::Zlib::Extra 2.020 ;
# spent 30µs making 1 call to IO::Uncompress::Gunzip::BEGIN@17 # spent 15µs making 1 call to UNIVERSAL::VERSION
18
191700nsrequire Exporter ;
20
2111µsour ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GunzipError);
22
23120µs@ISA = qw( Exporter IO::Uncompress::RawInflate );
241900ns@EXPORT_OK = qw( $GunzipError gunzip );
2511µs%EXPORT_TAGS = %IO::Uncompress::RawInflate::DEFLATE_CONSTANTS ;
2612µspush @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
2714µs126µsExporter::export_ok_tags('all');
# spent 26µs making 1 call to Exporter::export_ok_tags
28
291700ns$GunzipError = '';
30
311500ns$VERSION = '2.020';
32
33sub new
34{
35 my $class = shift ;
36 $GunzipError = '';
37 my $obj = createSelfTiedObject($class, \$GunzipError);
38
39 $obj->_create(undef, 0, @_);
40}
41
42sub gunzip
43{
44 my $obj = createSelfTiedObject(undef, \$GunzipError);
45 return $obj->_inf(@_) ;
46}
47
48sub getExtraParams
49{
5031.20ms3398µs
# spent 211µs (23+187) within IO::Uncompress::Gunzip::BEGIN@50 which was called: # once (23µs+187µs) by Compress::Zlib::BEGIN@14 at line 50
use IO::Compress::Base::Common 2.020 qw(:Parse);
# spent 211µs making 1 call to IO::Uncompress::Gunzip::BEGIN@50 # spent 169µs making 1 call to Exporter::import # spent 18µs making 1 call to UNIVERSAL::VERSION
51 return ( 'ParseExtra' => [1, 1, Parse_boolean, 0] ) ;
52}
53
54sub ckParams
55{
56 my $self = shift ;
57 my $got = shift ;
58
59 # gunzip always needs crc32
60 $got->value('CRC32' => 1);
61
62 return 1;
63}
64
65sub ckMagic
66{
67 my $self = shift;
68
69 my $magic ;
70 $self->smartReadExact(\$magic, GZIP_ID_SIZE);
71
72 *$self->{HeaderPending} = $magic ;
73
74 return $self->HeaderError("Minimum header size is " .
75 GZIP_MIN_HEADER_SIZE . " bytes")
76 if length $magic != GZIP_ID_SIZE ;
77
78 return $self->HeaderError("Bad Magic")
79 if ! isGzipMagic($magic) ;
80
81 *$self->{Type} = 'rfc1952';
82
83 return $magic ;
84}
85
86sub readHeader
87{
88 my $self = shift;
89 my $magic = shift;
90
91 return $self->_readGzipHeader($magic);
92}
93
94sub chkTrailer
95{
96 my $self = shift;
97 my $trailer = shift;
98
99 # Check CRC & ISIZE
100 my ($CRC32, $ISIZE) = unpack("V V", $trailer) ;
101 *$self->{Info}{CRC32} = $CRC32;
102 *$self->{Info}{ISIZE} = $ISIZE;
103
104 if (*$self->{Strict}) {
105 return $self->TrailerError("CRC mismatch")
106 if $CRC32 != *$self->{Uncomp}->crc32() ;
107
108 my $exp_isize = *$self->{UnCompSize}->get32bit();
109 return $self->TrailerError("ISIZE mismatch. Got $ISIZE"
110 . ", expected $exp_isize")
111 if $ISIZE != $exp_isize ;
112 }
113
114 return STATUS_OK;
115}
116
117sub isGzipMagic
118{
119 my $buffer = shift ;
120 return 0 if length $buffer < GZIP_ID_SIZE ;
121 my ($id1, $id2) = unpack("C C", $buffer) ;
122 return $id1 == GZIP_ID1 && $id2 == GZIP_ID2 ;
123}
124
125sub _readFullGzipHeader($)
126{
127 my ($self) = @_ ;
128 my $magic = '' ;
129
130 $self->smartReadExact(\$magic, GZIP_ID_SIZE);
131
132 *$self->{HeaderPending} = $magic ;
133
134 return $self->HeaderError("Minimum header size is " .
135 GZIP_MIN_HEADER_SIZE . " bytes")
136 if length $magic != GZIP_ID_SIZE ;
137
138
139 return $self->HeaderError("Bad Magic")
140 if ! isGzipMagic($magic) ;
141
142 my $status = $self->_readGzipHeader($magic);
143 delete *$self->{Transparent} if ! defined $status ;
144 return $status ;
145}
146
147sub _readGzipHeader($)
148{
149 my ($self, $magic) = @_ ;
150 my ($HeaderCRC) ;
151 my ($buffer) = '' ;
152
153 $self->smartReadExact(\$buffer, GZIP_MIN_HEADER_SIZE - GZIP_ID_SIZE)
154 or return $self->HeaderError("Minimum header size is " .
155 GZIP_MIN_HEADER_SIZE . " bytes") ;
156
157 my $keep = $magic . $buffer ;
158 *$self->{HeaderPending} = $keep ;
159
160 # now split out the various parts
161 my ($cm, $flag, $mtime, $xfl, $os) = unpack("C C V C C", $buffer) ;
162
163 $cm == GZIP_CM_DEFLATED
164 or return $self->HeaderError("Not Deflate (CM is $cm)") ;
165
166 # check for use of reserved bits
167 return $self->HeaderError("Use of Reserved Bits in FLG field.")
168 if $flag & GZIP_FLG_RESERVED ;
169
170 my $EXTRA ;
171 my @EXTRA = () ;
172 if ($flag & GZIP_FLG_FEXTRA) {
173 $EXTRA = "" ;
174 $self->smartReadExact(\$buffer, GZIP_FEXTRA_HEADER_SIZE)
175 or return $self->TruncatedHeader("FEXTRA Length") ;
176
177 my ($XLEN) = unpack("v", $buffer) ;
178 $self->smartReadExact(\$EXTRA, $XLEN)
179 or return $self->TruncatedHeader("FEXTRA Body");
180 $keep .= $buffer . $EXTRA ;
181
182 if ($XLEN && *$self->{'ParseExtra'}) {
183 my $bad = IO::Compress::Zlib::Extra::parseRawExtra($EXTRA,
184 \@EXTRA, 1, 1);
185 return $self->HeaderError($bad)
186 if defined $bad;
187 }
188 }
189
190 my $origname ;
191 if ($flag & GZIP_FLG_FNAME) {
192 $origname = "" ;
193 while (1) {
194 $self->smartReadExact(\$buffer, 1)
195 or return $self->TruncatedHeader("FNAME");
196 last if $buffer eq GZIP_NULL_BYTE ;
197 $origname .= $buffer
198 }
199 $keep .= $origname . GZIP_NULL_BYTE ;
200
201 return $self->HeaderError("Non ISO 8859-1 Character found in Name")
202 if *$self->{Strict} && $origname =~ /$GZIP_FNAME_INVALID_CHAR_RE/o ;
203 }
204
205 my $comment ;
206 if ($flag & GZIP_FLG_FCOMMENT) {
207 $comment = "";
208 while (1) {
209 $self->smartReadExact(\$buffer, 1)
210 or return $self->TruncatedHeader("FCOMMENT");
211 last if $buffer eq GZIP_NULL_BYTE ;
212 $comment .= $buffer
213 }
214 $keep .= $comment . GZIP_NULL_BYTE ;
215
216 return $self->HeaderError("Non ISO 8859-1 Character found in Comment")
217 if *$self->{Strict} && $comment =~ /$GZIP_FCOMMENT_INVALID_CHAR_RE/o ;
218 }
219
220 if ($flag & GZIP_FLG_FHCRC) {
221 $self->smartReadExact(\$buffer, GZIP_FHCRC_SIZE)
222 or return $self->TruncatedHeader("FHCRC");
223
224 $HeaderCRC = unpack("v", $buffer) ;
225 my $crc16 = crc32($keep) & 0xFF ;
226
227 return $self->HeaderError("CRC16 mismatch.")
228 if *$self->{Strict} && $crc16 != $HeaderCRC;
229
230 $keep .= $buffer ;
231 }
232
233 # Assume compression method is deflated for xfl tests
234 #if ($xfl) {
235 #}
236
237 *$self->{Type} = 'rfc1952';
238
239 return {
240 'Type' => 'rfc1952',
241 'FingerprintLength' => 2,
242 'HeaderLength' => length $keep,
243 'TrailerLength' => GZIP_TRAILER_SIZE,
244 'Header' => $keep,
245 'isMinimalHeader' => $keep eq GZIP_MINIMUM_HEADER ? 1 : 0,
246
247 'MethodID' => $cm,
248 'MethodName' => $cm == GZIP_CM_DEFLATED ? "Deflated" : "Unknown" ,
249 'TextFlag' => $flag & GZIP_FLG_FTEXT ? 1 : 0,
250 'HeaderCRCFlag' => $flag & GZIP_FLG_FHCRC ? 1 : 0,
251 'NameFlag' => $flag & GZIP_FLG_FNAME ? 1 : 0,
252 'CommentFlag' => $flag & GZIP_FLG_FCOMMENT ? 1 : 0,
253 'ExtraFlag' => $flag & GZIP_FLG_FEXTRA ? 1 : 0,
254 'Name' => $origname,
255 'Comment' => $comment,
256 'Time' => $mtime,
257 'OsID' => $os,
258 'OsName' => defined $GZIP_OS_Names{$os}
259 ? $GZIP_OS_Names{$os} : "Unknown",
260 'HeaderCRC' => $HeaderCRC,
261 'Flags' => $flag,
262 'ExtraFlags' => $xfl,
263 'ExtraFieldRaw' => $EXTRA,
264 'ExtraField' => [ @EXTRA ],
265
266
267 #'CompSize'=> $compsize,
268 #'CRC32'=> $CRC32,
269 #'OrigSize'=> $ISIZE,
270 }
271}
272
273
274116µs1;
275
276__END__