← 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/Compress/Base/Common.pm
StatementsExecuted 6509 statements in 185ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4011112ms118msIO::Compress::Base::Parameters::::parseIO::Compress::Base::Parameters::parse
401113.6ms25.3msIO::Compress::Base::Common::::createSelfTiedObject IO::Compress::Base::Common::createSelfTiedObject
40113.36ms3.36msIO::Compress::Base::Parameters::::newIO::Compress::Base::Parameters::new
6801423.07ms3.07msIO::Compress::Base::Parameters::::getValueIO::Compress::Base::Parameters::getValue
1112.75ms5.27msIO::Compress::Base::Common::::BEGIN@9 IO::Compress::Base::Common::BEGIN@9
364212.60ms2.60msU64::::add U64::add
40112.46ms4.76msIO::Compress::Base::Parameters::::_checkTypeIO::Compress::Base::Parameters::_checkType
80212.41ms5.23msIO::Compress::Base::Common::::whatIsInput IO::Compress::Base::Common::whatIsInput
40112.30ms2.30msIO::Compress::Base::Common::::CORE:match IO::Compress::Base::Common::CORE:match (opcode)
80111.88ms2.12msIO::Compress::Base::Common::::isaFilehandle IO::Compress::Base::Common::isaFilehandle
40111.55ms1.55msIO::Compress::Base::Common::::CORE:subst IO::Compress::Base::Common::CORE:subst (opcode)
1111.45ms2.20msIO::Compress::Base::Common::::BEGIN@8 IO::Compress::Base::Common::BEGIN@8
40111.28ms1.28msIO::Compress::Base::Parameters::::setValueIO::Compress::Base::Parameters::setValue
80211.22ms1.22msU64::::new U64::new
8011696µs2.82msIO::Compress::Base::Common::::whatIs IO::Compress::Base::Common::whatIs
4011600µs600µsIO::Compress::Base::Parameters::::parsedIO::Compress::Base::Parameters::parsed
4011426µs563µsIO::Compress::Base::Common::::setBinModeInput IO::Compress::Base::Common::setBinModeInput
111289µs294µsIO::Compress::Base::Common::::BEGIN@114 IO::Compress::Base::Common::BEGIN@114
8021224µs224µsU64::::reset U64::reset
4011137µs137µsIO::Compress::Base::Common::::CORE:binmode IO::Compress::Base::Common::CORE:binmode (opcode)
11135µs42µsIO::Compress::Base::Common::::BEGIN@3 IO::Compress::Base::Common::BEGIN@3
11117µs122µsIO::Compress::Base::Common::::BEGIN@45 IO::Compress::Base::Common::BEGIN@45
11115µs111µsIO::Compress::Base::Common::::BEGIN@51 IO::Compress::Base::Common::BEGIN@51
11114µs30µsIO::Compress::Base::Common::::BEGIN@4 IO::Compress::Base::Common::BEGIN@4
11114µs84µsIO::Compress::Base::Common::::BEGIN@7 IO::Compress::Base::Common::BEGIN@7
11114µs70µsIO::Compress::Base::Common::::BEGIN@485 IO::Compress::Base::Common::BEGIN@485
11114µs17µsIO::Compress::Base::Common::::BEGIN@5 IO::Compress::Base::Common::BEGIN@5
11113µs85µsIO::Compress::Base::Common::::BEGIN@47 IO::Compress::Base::Common::BEGIN@47
11113µs84µsIO::Compress::Base::Common::::BEGIN@50 IO::Compress::Base::Common::BEGIN@50
11113µs89µsIO::Compress::Base::Common::::BEGIN@148 IO::Compress::Base::Common::BEGIN@148
11113µs90µsIO::Compress::Base::Common::::BEGIN@46 IO::Compress::Base::Common::BEGIN@46
11113µs83µsIO::Compress::Base::Common::::BEGIN@48 IO::Compress::Base::Common::BEGIN@48
11113µs82µsIO::Compress::Base::Common::::BEGIN@480 IO::Compress::Base::Common::BEGIN@480
11113µs84µsIO::Compress::Base::Common::::BEGIN@49 IO::Compress::Base::Common::BEGIN@49
11112µs17µsIO::Compress::Base::Common::::BEGIN@520 IO::Compress::Base::Common::BEGIN@520
11112µs34µsU64::::BEGIN@1038 U64::BEGIN@1038
11112µs29µsIO::Compress::Base::Common::::BEGIN@522 IO::Compress::Base::Common::BEGIN@522
11111µs78µsIO::Compress::Base::Common::::BEGIN@149 IO::Compress::Base::Common::BEGIN@149
11111µs64µsIO::Compress::Base::Common::::BEGIN@482 IO::Compress::Base::Common::BEGIN@482
11111µs67µsIO::Compress::Base::Common::::BEGIN@523 IO::Compress::Base::Common::BEGIN@523
11110µs64µsIO::Compress::Base::Common::::BEGIN@152 IO::Compress::Base::Common::BEGIN@152
11110µs57µsU64::::BEGIN@838 U64::BEGIN@838
11110µs67µsU64::::BEGIN@835 U64::BEGIN@835
1119µs67µsIO::Compress::Base::Common::::BEGIN@481 IO::Compress::Base::Common::BEGIN@481
1119µs59µsIO::Compress::Base::Common::::BEGIN@483 IO::Compress::Base::Common::BEGIN@483
1119µs58µsU64::::BEGIN@836 U64::BEGIN@836
1119µs65µsIO::Compress::Base::Common::::BEGIN@150 IO::Compress::Base::Common::BEGIN@150
1119µs64µsIO::Compress::Base::Common::::BEGIN@489 IO::Compress::Base::Common::BEGIN@489
1119µs59µsIO::Compress::Base::Common::::BEGIN@500 IO::Compress::Base::Common::BEGIN@500
1118µs57µsIO::Compress::Base::Common::::BEGIN@484 IO::Compress::Base::Common::BEGIN@484
1118µs61µsIO::Compress::Base::Common::::BEGIN@490 IO::Compress::Base::Common::BEGIN@490
1118µs56µsIO::Compress::Base::Common::::BEGIN@494 IO::Compress::Base::Common::BEGIN@494
1118µs60µsIO::Compress::Base::Common::::BEGIN@495 IO::Compress::Base::Common::BEGIN@495
1118µs56µsIO::Compress::Base::Common::::BEGIN@492 IO::Compress::Base::Common::BEGIN@492
1118µs56µsIO::Compress::Base::Common::::BEGIN@499 IO::Compress::Base::Common::BEGIN@499
1118µs56µsIO::Compress::Base::Common::::BEGIN@493 IO::Compress::Base::Common::BEGIN@493
1118µs56µsU64::::BEGIN@837 U64::BEGIN@837
0000s0sIO::Compress::Base::Common::::Init IO::Compress::Base::Common::Init
0000s0sIO::Compress::Base::Common::::ParseParameters IO::Compress::Base::Common::ParseParameters
0000s0sIO::Compress::Base::Common::::cleanFileGlobString IO::Compress::Base::Common::cleanFileGlobString
0000s0sIO::Compress::Base::Common::::getEncoding IO::Compress::Base::Common::getEncoding
0000s0sIO::Compress::Base::Common::::hasEncode IO::Compress::Base::Common::hasEncode
0000s0sIO::Compress::Base::Common::::isGeMax32 IO::Compress::Base::Common::isGeMax32
0000s0sIO::Compress::Base::Common::::isaFileGlobString IO::Compress::Base::Common::isaFileGlobString
0000s0sIO::Compress::Base::Common::::isaFilename IO::Compress::Base::Common::isaFilename
0000s0sIO::Compress::Base::Common::::isaScalar IO::Compress::Base::Common::isaScalar
0000s0sIO::Compress::Base::Common::::oneTarget IO::Compress::Base::Common::oneTarget
0000s0sIO::Compress::Base::Common::::setBinModeOutput IO::Compress::Base::Common::setBinModeOutput
0000s0sIO::Compress::Base::Common::::whatIsOutput IO::Compress::Base::Common::whatIsOutput
0000s0sIO::Compress::Base::Parameters::::cloneIO::Compress::Base::Parameters::clone
0000s0sIO::Compress::Base::Parameters::::getErrorIO::Compress::Base::Parameters::getError
0000s0sIO::Compress::Base::Parameters::::setErrorIO::Compress::Base::Parameters::setError
0000s0sIO::Compress::Base::Parameters::::valueOrDefaultIO::Compress::Base::Parameters::valueOrDefault
0000s0sIO::Compress::Base::Parameters::::valueRefIO::Compress::Base::Parameters::valueRef
0000s0sIO::Compress::Base::Parameters::::wantValueIO::Compress::Base::Parameters::wantValue
0000s0sIO::Compress::Base::Validator::::croakError IO::Compress::Base::Validator::croakError
0000s0sIO::Compress::Base::Validator::::new IO::Compress::Base::Validator::new
0000s0sIO::Compress::Base::Validator::::saveErrorString IO::Compress::Base::Validator::saveErrorString
0000s0sIO::Compress::Base::Validator::::validateInputArray IO::Compress::Base::Validator::validateInputArray
0000s0sIO::Compress::Base::Validator::::validateInputFilenames IO::Compress::Base::Validator::validateInputFilenames
0000s0sU64::::Value_VV64 U64::Value_VV64
0000s0sU64::::add32 U64::add32
0000s0sU64::::clone U64::clone
0000s0sU64::::cmp U64::cmp
0000s0sU64::::equal U64::equal
0000s0sU64::::full32 U64::full32
0000s0sU64::::get32bit U64::get32bit
0000s0sU64::::get64bit U64::get64bit
0000s0sU64::::getHigh U64::getHigh
0000s0sU64::::getLow U64::getLow
0000s0sU64::::getPacked_V32 U64::getPacked_V32
0000s0sU64::::getPacked_V64 U64::getPacked_V64
0000s0sU64::::gt U64::gt
0000s0sU64::::is64bit U64::is64bit
0000s0sU64::::isAlmost64bit U64::isAlmost64bit
0000s0sU64::::newUnpack_V32 U64::newUnpack_V32
0000s0sU64::::newUnpack_V64 U64::newUnpack_V64
0000s0sU64::::pack_V64 U64::pack_V64
0000s0sU64::::subtract U64::subtract
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package IO::Compress::Base::Common;
2
3251µs250µs
# spent 42µs (35+7) within IO::Compress::Base::Common::BEGIN@3 which was called: # once (35µs+7µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 3
use strict ;
# spent 42µs making 1 call to IO::Compress::Base::Common::BEGIN@3 # spent 7µs making 1 call to strict::import
4239µs246µs
# spent 30µs (14+16) within IO::Compress::Base::Common::BEGIN@4 which was called: # once (14µs+16µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 4
use warnings;
# spent 30µs making 1 call to IO::Compress::Base::Common::BEGIN@4 # spent 16µs making 1 call to warnings::import
5248µs221µs
# spent 17µs (14+4) within IO::Compress::Base::Common::BEGIN@5 which was called: # once (14µs+4µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 5
use bytes;
# spent 17µs making 1 call to IO::Compress::Base::Common::BEGIN@5 # spent 4µs making 1 call to bytes::import
6
7246µs2155µs
# spent 84µs (14+70) within IO::Compress::Base::Common::BEGIN@7 which was called: # once (14µs+70µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 7
use Carp;
# spent 84µs making 1 call to IO::Compress::Base::Common::BEGIN@7 # spent 70µs making 1 call to Exporter::import
82220µs22.37ms
# spent 2.20ms (1.45+747µs) within IO::Compress::Base::Common::BEGIN@8 which was called: # once (1.45ms+747µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 8
use Scalar::Util qw(blessed readonly);
# spent 2.20ms making 1 call to IO::Compress::Base::Common::BEGIN@8 # spent 167µs making 1 call to Exporter::import
92355µs15.27ms
# spent 5.27ms (2.75+2.52) within IO::Compress::Base::Common::BEGIN@9 which was called: # once (2.75ms+2.52ms) by IO::Uncompress::RawInflate::BEGIN@9 at line 9
use File::GlobMapper;
# spent 5.27ms making 1 call to IO::Compress::Base::Common::BEGIN@9
10
1112µsrequire Exporter;
12our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE);
13110µs@ISA = qw(Exporter);
1411µs$VERSION = '2.069_001';
15
1614µs@EXPORT = qw( isaFilehandle isaFilename isaScalar
17 whatIsInput whatIsOutput
18 isaFileGlobString cleanFileGlobString oneTarget
19 setBinModeInput setBinModeOutput
20 ckInOutParams
21 createSelfTiedObject
22
23 isGeMax32
24
25 MAX32
26
27 WANT_CODE
28 WANT_EXT
29 WANT_UNDEF
30 WANT_HASH
31
32 STATUS_OK
33 STATUS_ENDSTREAM
34 STATUS_EOF
35 STATUS_ERROR
36 );
37
3813µs%EXPORT_TAGS = ( Status => [qw( STATUS_OK
39 STATUS_ENDSTREAM
40 STATUS_EOF
41 STATUS_ERROR
42 )]);
43
44
45260µs2227µs
# spent 122µs (17+105) within IO::Compress::Base::Common::BEGIN@45 which was called: # once (17µs+105µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 45
use constant STATUS_OK => 0;
# spent 122µs making 1 call to IO::Compress::Base::Common::BEGIN@45 # spent 105µs making 1 call to constant::import
46243µs2168µs
# spent 90µs (13+77) within IO::Compress::Base::Common::BEGIN@46 which was called: # once (13µs+77µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 46
use constant STATUS_ENDSTREAM => 1;
# spent 90µs making 1 call to IO::Compress::Base::Common::BEGIN@46 # spent 77µs making 1 call to constant::import
47246µs2157µs
# spent 85µs (13+72) within IO::Compress::Base::Common::BEGIN@47 which was called: # once (13µs+72µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 47
use constant STATUS_EOF => 2;
# spent 85µs making 1 call to IO::Compress::Base::Common::BEGIN@47 # spent 72µs making 1 call to constant::import
48242µs2154µs
# spent 83µs (13+70) within IO::Compress::Base::Common::BEGIN@48 which was called: # once (13µs+70µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 48
use constant STATUS_ERROR => -1;
# spent 83µs making 1 call to IO::Compress::Base::Common::BEGIN@48 # spent 70µs making 1 call to constant::import
49250µs2155µs
# spent 84µs (13+71) within IO::Compress::Base::Common::BEGIN@49 which was called: # once (13µs+71µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 49
use constant MAX16 => 0xFFFF ;
# spent 84µs making 1 call to IO::Compress::Base::Common::BEGIN@49 # spent 71µs making 1 call to constant::import
50248µs2154µs
# spent 84µs (13+71) within IO::Compress::Base::Common::BEGIN@50 which was called: # once (13µs+71µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 50
use constant MAX32 => 0xFFFFFFFF ;
# spent 84µs making 1 call to IO::Compress::Base::Common::BEGIN@50 # spent 71µs making 1 call to constant::import
512395µs2206µs
# spent 111µs (15+96) within IO::Compress::Base::Common::BEGIN@51 which was called: # once (15µs+96µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 51
use constant MAX32cmp => 0xFFFFFFFF + 1 - 1; # for 5.6.x on 32-bit need to force an non-IV value
# spent 111µs making 1 call to IO::Compress::Base::Common::BEGIN@51 # spent 96µs making 1 call to constant::import
52
53
54sub isGeMax32
55{
56 return $_[0] >= MAX32cmp ;
57}
58
59sub hasEncode()
60{
61 if (! defined $HAS_ENCODE) {
62 eval
63 {
64 require Encode;
65 Encode->import();
66 };
67
68 $HAS_ENCODE = $@ ? 0 : 1 ;
69 }
70
71 return $HAS_ENCODE;
72}
73
74sub getEncoding($$$)
75{
76 my $obj = shift;
77 my $class = shift ;
78 my $want_encoding = shift ;
79
80 $obj->croakError("$class: Encode module needed to use -Encode")
81 if ! hasEncode();
82
83 my $encoding = Encode::find_encoding($want_encoding);
84
85 $obj->croakError("$class: Encoding '$want_encoding' is not available")
86 if ! $encoding;
87
88 return $encoding;
89}
90
91our ($needBinmode);
92131µs$needBinmode = ($^O eq 'MSWin32' ||
# spent 5µs executing statements in string eval
93 ($] >= 5.006 && eval ' ${^UNICODE} || ${^UTF8LOCALE} '))
94 ? 1 : 1 ;
95
96sub setBinModeInput($)
97
# spent 563µs (426+137) within IO::Compress::Base::Common::setBinModeInput which was called 40 times, avg 14µs/call: # 40 times (426µs+137µs) by IO::Uncompress::Base::_create at line 437 of IO/Uncompress/Base.pm, avg 14µs/call
{
984055µs my $handle = shift ;
99
10040525µs40137µs binmode $handle
# spent 137µs making 40 calls to IO::Compress::Base::Common::CORE:binmode, avg 3µs/call
101 if $needBinmode;
102}
103
104sub setBinModeOutput($)
105{
106 my $handle = shift ;
107
108 binmode $handle
109 if $needBinmode;
110}
111
112sub isaFilehandle($)
113
# spent 2.12ms (1.88+249µs) within IO::Compress::Base::Common::isaFilehandle which was called 80 times, avg 27µs/call: # 80 times (1.88ms+249µs) by IO::Compress::Base::Common::whatIs at line 185, avg 27µs/call
{
1142522µs2298µs
# spent 294µs (289+4) within IO::Compress::Base::Common::BEGIN@114 which was called: # once (289µs+4µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 114
use utf8; # Pragma needed to keep Perl 5.6.0 happy
# spent 294µs making 1 call to IO::Compress::Base::Common::BEGIN@114 # spent 4µs making 1 call to utf8::import
115801.03ms80249µs return (defined $_[0] and
# spent 249µs making 80 calls to UNIVERSAL::isa, avg 3µs/call
116 (UNIVERSAL::isa($_[0],'GLOB') or
117 UNIVERSAL::isa($_[0],'IO::Handle') or
118 UNIVERSAL::isa(\$_[0],'GLOB'))
119 )
120}
121
122sub isaScalar
123{
124 return ( defined($_[0]) and ref($_[0]) eq 'SCALAR' and defined ${ $_[0] } ) ;
125}
126
127sub isaFilename($)
128{
129 return (defined $_[0] and
130 ! ref $_[0] and
131 UNIVERSAL::isa(\$_[0], 'SCALAR'));
132}
133
134sub isaFileGlobString
135{
136 return defined $_[0] && $_[0] =~ /^<.*>$/;
137}
138
139sub cleanFileGlobString
140{
141 my $string = shift ;
142
143 $string =~ s/^\s*<\s*(.*)\s*>\s*$/$1/;
144
145 return $string;
146}
147
148238µs2166µs
# spent 89µs (13+76) within IO::Compress::Base::Common::BEGIN@148 which was called: # once (13µs+76µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 148
use constant WANT_CODE => 1 ;
# spent 89µs making 1 call to IO::Compress::Base::Common::BEGIN@148 # spent 76µs making 1 call to constant::import
149241µs2146µs
# spent 78µs (11+68) within IO::Compress::Base::Common::BEGIN@149 which was called: # once (11µs+68µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 149
use constant WANT_EXT => 2 ;
# spent 78µs making 1 call to IO::Compress::Base::Common::BEGIN@149 # spent 68µs making 1 call to constant::import
150234µs2122µs
# spent 65µs (9+56) within IO::Compress::Base::Common::BEGIN@150 which was called: # once (9µs+56µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 150
use constant WANT_UNDEF => 4 ;
# spent 65µs making 1 call to IO::Compress::Base::Common::BEGIN@150 # spent 56µs making 1 call to constant::import
151#use constant WANT_HASH => 8 ;
15221.65ms2117µs
# spent 64µs (10+53) within IO::Compress::Base::Common::BEGIN@152 which was called: # once (10µs+53µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 152
use constant WANT_HASH => 0 ;
# spent 64µs making 1 call to IO::Compress::Base::Common::BEGIN@152 # spent 54µs making 1 call to constant::import
153
154sub whatIsInput($;$)
155
# spent 5.23ms (2.41+2.82) within IO::Compress::Base::Common::whatIsInput which was called 80 times, avg 65µs/call: # 40 times (2.00ms+2.18ms) by IO::Uncompress::Base::_create at line 403 of IO/Uncompress/Base.pm, avg 104µs/call # 40 times (408µs+646µs) by IO::Uncompress::Base::ckInputParam at line 536 of IO/Uncompress/Base.pm, avg 26µs/call
{
15680813µs802.82ms my $got = whatIs(@_);
# spent 2.82ms making 80 calls to IO::Compress::Base::Common::whatIs, avg 35µs/call
157
15880111µs if (defined $got && $got eq 'filename' && defined $_[0] && $_[0] eq '-')
159 {
160 #use IO::File;
161 $got = 'handle';
162 $_[0] = *STDIN;
163 #$_[0] = new IO::File("<-");
164 }
165
16680393µs return $got;
167}
168
169sub whatIsOutput($;$)
170{
171 my $got = whatIs(@_);
172
173 if (defined $got && $got eq 'filename' && defined $_[0] && $_[0] eq '-')
174 {
175 $got = 'handle';
176 $_[0] = *STDOUT;
177 #$_[0] = new IO::File(">-");
178 }
179
180 return $got;
181}
182
183sub whatIs ($;$)
184
# spent 2.82ms (696µs+2.12) within IO::Compress::Base::Common::whatIs which was called 80 times, avg 35µs/call: # 80 times (696µs+2.12ms) by IO::Compress::Base::Common::whatIsInput at line 156, avg 35µs/call
{
185801.93ms802.12ms return 'handle' if isaFilehandle($_[0]);
# spent 2.12ms making 80 calls to IO::Compress::Base::Common::isaFilehandle, avg 27µs/call
186
187 my $wantCode = defined $_[1] && $_[1] & WANT_CODE ;
188 my $extended = defined $_[1] && $_[1] & WANT_EXT ;
189 my $undef = defined $_[1] && $_[1] & WANT_UNDEF ;
190 my $hash = defined $_[1] && $_[1] & WANT_HASH ;
191
192 return 'undef' if ! defined $_[0] && $undef ;
193
194 if (ref $_[0]) {
195 return '' if blessed($_[0]); # is an object
196 #return '' if UNIVERSAL::isa($_[0], 'UNIVERSAL'); # is an object
197 return 'buffer' if UNIVERSAL::isa($_[0], 'SCALAR');
198 return 'array' if UNIVERSAL::isa($_[0], 'ARRAY') && $extended ;
199 return 'hash' if UNIVERSAL::isa($_[0], 'HASH') && $hash ;
200 return 'code' if UNIVERSAL::isa($_[0], 'CODE') && $wantCode ;
201 return '';
202 }
203
204 return 'fileglob' if $extended && isaFileGlobString($_[0]);
205 return 'filename';
206}
207
208sub oneTarget
209{
210 return $_[0] =~ /^(code|handle|buffer|filename)$/;
211}
212
213sub IO::Compress::Base::Validator::new
214{
215 my $class = shift ;
216
217 my $Class = shift ;
218 my $error_ref = shift ;
219 my $reportClass = shift ;
220
221 my %data = (Class => $Class,
222 Error => $error_ref,
223 reportClass => $reportClass,
224 ) ;
225
226 my $obj = bless \%data, $class ;
227
228 local $Carp::CarpLevel = 1;
229
230 my $inType = $data{inType} = whatIsInput($_[0], WANT_EXT|WANT_HASH);
231 my $outType = $data{outType} = whatIsOutput($_[1], WANT_EXT|WANT_HASH);
232
233 my $oneInput = $data{oneInput} = oneTarget($inType);
234 my $oneOutput = $data{oneOutput} = oneTarget($outType);
235
236 if (! $inType)
237 {
238 $obj->croakError("$reportClass: illegal input parameter") ;
239 #return undef ;
240 }
241
242# if ($inType eq 'hash')
243# {
244# $obj->{Hash} = 1 ;
245# $obj->{oneInput} = 1 ;
246# return $obj->validateHash($_[0]);
247# }
248
249 if (! $outType)
250 {
251 $obj->croakError("$reportClass: illegal output parameter") ;
252 #return undef ;
253 }
254
255
256 if ($inType ne 'fileglob' && $outType eq 'fileglob')
257 {
258 $obj->croakError("Need input fileglob for outout fileglob");
259 }
260
261# if ($inType ne 'fileglob' && $outType eq 'hash' && $inType ne 'filename' )
262# {
263# $obj->croakError("input must ne filename or fileglob when output is a hash");
264# }
265
266 if ($inType eq 'fileglob' && $outType eq 'fileglob')
267 {
268 $data{GlobMap} = 1 ;
269 $data{inType} = $data{outType} = 'filename';
270 my $mapper = new File::GlobMapper($_[0], $_[1]);
271 if ( ! $mapper )
272 {
273 return $obj->saveErrorString($File::GlobMapper::Error) ;
274 }
275 $data{Pairs} = $mapper->getFileMap();
276
277 return $obj;
278 }
279
280 $obj->croakError("$reportClass: input and output $inType are identical")
281 if $inType eq $outType && $_[0] eq $_[1] && $_[0] ne '-' ;
282
283 if ($inType eq 'fileglob') # && $outType ne 'fileglob'
284 {
285 my $glob = cleanFileGlobString($_[0]);
286 my @inputs = glob($glob);
287
288 if (@inputs == 0)
289 {
290 # TODO -- legal or die?
291 die "globmap matched zero file -- legal or die???" ;
292 }
293 elsif (@inputs == 1)
294 {
295 $obj->validateInputFilenames($inputs[0])
296 or return undef;
297 $_[0] = $inputs[0] ;
298 $data{inType} = 'filename' ;
299 $data{oneInput} = 1;
300 }
301 else
302 {
303 $obj->validateInputFilenames(@inputs)
304 or return undef;
305 $_[0] = [ @inputs ] ;
306 $data{inType} = 'filenames' ;
307 }
308 }
309 elsif ($inType eq 'filename')
310 {
311 $obj->validateInputFilenames($_[0])
312 or return undef;
313 }
314 elsif ($inType eq 'array')
315 {
316 $data{inType} = 'filenames' ;
317 $obj->validateInputArray($_[0])
318 or return undef ;
319 }
320
321 return $obj->saveErrorString("$reportClass: output buffer is read-only")
322 if $outType eq 'buffer' && readonly(${ $_[1] });
323
324 if ($outType eq 'filename' )
325 {
326 $obj->croakError("$reportClass: output filename is undef or null string")
327 if ! defined $_[1] || $_[1] eq '' ;
328
329 if (-e $_[1])
330 {
331 if (-d _ )
332 {
333 return $obj->saveErrorString("output file '$_[1]' is a directory");
334 }
335 }
336 }
337
338 return $obj ;
339}
340
341sub IO::Compress::Base::Validator::saveErrorString
342{
343 my $self = shift ;
344 ${ $self->{Error} } = shift ;
345 return undef;
346
347}
348
349sub IO::Compress::Base::Validator::croakError
350{
351 my $self = shift ;
352 $self->saveErrorString($_[0]);
353 croak $_[0];
354}
355
- -
358sub IO::Compress::Base::Validator::validateInputFilenames
359{
360 my $self = shift ;
361
362 foreach my $filename (@_)
363 {
364 $self->croakError("$self->{reportClass}: input filename is undef or null string")
365 if ! defined $filename || $filename eq '' ;
366
367 next if $filename eq '-';
368
369 if (! -e $filename )
370 {
371 return $self->saveErrorString("input file '$filename' does not exist");
372 }
373
374 if (-d _ )
375 {
376 return $self->saveErrorString("input file '$filename' is a directory");
377 }
378
379# if (! -r _ )
380# {
381# return $self->saveErrorString("cannot open file '$filename': $!");
382# }
383 }
384
385 return 1 ;
386}
387
388sub IO::Compress::Base::Validator::validateInputArray
389{
390 my $self = shift ;
391
392 if ( @{ $_[0] } == 0 )
393 {
394 return $self->saveErrorString("empty array reference") ;
395 }
396
397 foreach my $element ( @{ $_[0] } )
398 {
399 my $inType = whatIsInput($element);
400
401 if (! $inType)
402 {
403 $self->croakError("unknown input parameter") ;
404 }
405 elsif($inType eq 'filename')
406 {
407 $self->validateInputFilenames($element)
408 or return undef ;
409 }
410 else
411 {
412 $self->croakError("not a filename") ;
413 }
414 }
415
416 return 1 ;
417}
418
419#sub IO::Compress::Base::Validator::validateHash
420#{
421# my $self = shift ;
422# my $href = shift ;
423#
424# while (my($k, $v) = each %$href)
425# {
426# my $ktype = whatIsInput($k);
427# my $vtype = whatIsOutput($v, WANT_EXT|WANT_UNDEF) ;
428#
429# if ($ktype ne 'filename')
430# {
431# return $self->saveErrorString("hash key not filename") ;
432# }
433#
434# my %valid = map { $_ => 1 } qw(filename buffer array undef handle) ;
435# if (! $valid{$vtype})
436# {
437# return $self->saveErrorString("hash value not ok") ;
438# }
439# }
440#
441# return $self ;
442#}
443
444sub createSelfTiedObject
445
# spent 25.3ms (13.6+11.7) within IO::Compress::Base::Common::createSelfTiedObject which was called 40 times, avg 632µs/call: # 40 times (13.6ms+11.7ms) by IO::Uncompress::Gunzip::new at line 37 of IO/Uncompress/Gunzip.pm, avg 632µs/call
{
4464067µs my $class = shift || (caller)[0] ;
4474048µs my $error_ref = shift ;
448
449402.52ms408.54ms my $obj = bless Symbol::gensym(), ref($class) || $class;
# spent 8.54ms making 40 calls to Symbol::gensym, avg 213µs/call
450406.64ms403.16ms tie *$obj, $obj if $] >= 5.005;
# spent 3.16ms making 40 calls to IO::Uncompress::Base::TIEHANDLE, avg 79µs/call
451401.60ms *$obj->{Closed} = 1 ;
4524071µs $$error_ref = '';
45340599µs *$obj->{Error} = $error_ref ;
4544058µs my $errno = 0 ;
45540631µs *$obj->{ErrorNo} = \$errno ;
456
457401.87ms return $obj;
458}
459
- -
462#package Parse::Parameters ;
463#
464#
465#require Exporter;
466#our ($VERSION, @ISA, @EXPORT);
467#$VERSION = '2.000_08';
468#@ISA = qw(Exporter);
469
47012µs$EXPORT_TAGS{Parse} = [qw( ParseParameters
471 Parse_any Parse_unsigned Parse_signed
472 Parse_boolean Parse_string
473 Parse_code
474 Parse_writable_scalar
475 )
476 ];
477
47812µspush @EXPORT, @{ $EXPORT_TAGS{Parse} } ;
479
480238µs2151µs
# spent 82µs (13+69) within IO::Compress::Base::Common::BEGIN@480 which was called: # once (13µs+69µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 480
use constant Parse_any => 0x01;
# spent 82µs making 1 call to IO::Compress::Base::Common::BEGIN@480 # spent 69µs making 1 call to constant::import
481229µs2125µs
# spent 67µs (9+58) within IO::Compress::Base::Common::BEGIN@481 which was called: # once (9µs+58µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 481
use constant Parse_unsigned => 0x02;
# spent 67µs making 1 call to IO::Compress::Base::Common::BEGIN@481 # spent 58µs making 1 call to constant::import
482236µs2118µs
# spent 64µs (11+54) within IO::Compress::Base::Common::BEGIN@482 which was called: # once (11µs+54µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 482
use constant Parse_signed => 0x04;
# spent 64µs making 1 call to IO::Compress::Base::Common::BEGIN@482 # spent 54µs making 1 call to constant::import
483227µs2109µs
# spent 59µs (9+50) within IO::Compress::Base::Common::BEGIN@483 which was called: # once (9µs+50µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 483
use constant Parse_boolean => 0x08;
# spent 59µs making 1 call to IO::Compress::Base::Common::BEGIN@483 # spent 50µs making 1 call to constant::import
484230µs2105µs
# spent 57µs (8+48) within IO::Compress::Base::Common::BEGIN@484 which was called: # once (8µs+48µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 484
use constant Parse_string => 0x10;
# spent 57µs making 1 call to IO::Compress::Base::Common::BEGIN@484 # spent 48µs making 1 call to constant::import
485230µs2127µs
# spent 70µs (14+56) within IO::Compress::Base::Common::BEGIN@485 which was called: # once (14µs+56µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 485
use constant Parse_code => 0x20;
# spent 70µs making 1 call to IO::Compress::Base::Common::BEGIN@485 # spent 56µs making 1 call to constant::import
486
487#use constant Parse_store_ref => 0x100 ;
488#use constant Parse_multiple => 0x100 ;
489232µs2120µs
# spent 64µs (9+56) within IO::Compress::Base::Common::BEGIN@489 which was called: # once (9µs+56µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 489
use constant Parse_writable => 0x200 ;
# spent 64µs making 1 call to IO::Compress::Base::Common::BEGIN@489 # spent 56µs making 1 call to constant::import
490227µs2113µs
# spent 61µs (8+52) within IO::Compress::Base::Common::BEGIN@490 which was called: # once (8µs+52µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 490
use constant Parse_writable_scalar => 0x400 | Parse_writable ;
# spent 61µs making 1 call to IO::Compress::Base::Common::BEGIN@490 # spent 52µs making 1 call to constant::import
491
492225µs2103µs
# spent 56µs (8+48) within IO::Compress::Base::Common::BEGIN@492 which was called: # once (8µs+48µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 492
use constant OFF_PARSED => 0 ;
# spent 56µs making 1 call to IO::Compress::Base::Common::BEGIN@492 # spent 48µs making 1 call to constant::import
493226µs2103µs
# spent 56µs (8+48) within IO::Compress::Base::Common::BEGIN@493 which was called: # once (8µs+48µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 493
use constant OFF_TYPE => 1 ;
# spent 56µs making 1 call to IO::Compress::Base::Common::BEGIN@493 # spent 48µs making 1 call to constant::import
494225µs2103µs
# spent 56µs (8+47) within IO::Compress::Base::Common::BEGIN@494 which was called: # once (8µs+47µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 494
use constant OFF_DEFAULT => 2 ;
# spent 56µs making 1 call to IO::Compress::Base::Common::BEGIN@494 # spent 47µs making 1 call to constant::import
495227µs2111µs
# spent 60µs (8+52) within IO::Compress::Base::Common::BEGIN@495 which was called: # once (8µs+52µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 495
use constant OFF_FIXED => 3 ;
# spent 60µs making 1 call to IO::Compress::Base::Common::BEGIN@495 # spent 52µs making 1 call to constant::import
496#use constant OFF_FIRST_ONLY => 4 ;
497#use constant OFF_STICKY => 5 ;
498
499225µs2104µs
# spent 56µs (8+48) within IO::Compress::Base::Common::BEGIN@499 which was called: # once (8µs+48µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 499
use constant IxError => 0;
# spent 56µs making 1 call to IO::Compress::Base::Common::BEGIN@499 # spent 48µs making 1 call to constant::import
5002131µs2109µs
# spent 59µs (9+50) within IO::Compress::Base::Common::BEGIN@500 which was called: # once (9µs+50µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 500
use constant IxGot => 1 ;
# spent 59µs making 1 call to IO::Compress::Base::Common::BEGIN@500 # spent 50µs making 1 call to constant::import
501
502sub ParseParameters
503{
504 my $level = shift || 0 ;
505
506 my $sub = (caller($level + 1))[3] ;
507 local $Carp::CarpLevel = 1 ;
508
509 return $_[1]
510 if @_ == 2 && defined $_[1] && UNIVERSAL::isa($_[1], "IO::Compress::Base::Parameters");
511
512 my $p = new IO::Compress::Base::Parameters() ;
513 $p->parse(@_)
514 or croak "$sub: $p->[IxError]" ;
515
516 return $p;
517}
518
519
520237µs222µs
# spent 17µs (12+5) within IO::Compress::Base::Common::BEGIN@520 which was called: # once (12µs+5µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 520
use strict;
# spent 17µs making 1 call to IO::Compress::Base::Common::BEGIN@520 # spent 5µs making 1 call to strict::import
521
522232µs247µs
# spent 29µs (12+18) within IO::Compress::Base::Common::BEGIN@522 which was called: # once (12µs+18µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 522
use warnings;
# spent 29µs making 1 call to IO::Compress::Base::Common::BEGIN@522 # spent 18µs making 1 call to warnings::import
52321.47ms2123µs
# spent 67µs (11+56) within IO::Compress::Base::Common::BEGIN@523 which was called: # once (11µs+56µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 523
use Carp;
# spent 67µs making 1 call to IO::Compress::Base::Common::BEGIN@523 # spent 56µs making 1 call to Exporter::import
524
525
526sub Init
527{
528 my $default = shift ;
529 my %got ;
530
531 my $obj = IO::Compress::Base::Parameters::new();
532 while (my ($key, $v) = each %$default)
533 {
534 croak "need 2 params [@$v]"
535 if @$v != 2 ;
536
537 my ($type, $value) = @$v ;
538# my ($first_only, $sticky, $type, $value) = @$v ;
539 my $sticky = 0;
540 my $x ;
541 $obj->_checkType($key, \$value, $type, 0, \$x)
542 or return undef ;
543
544 $key = lc $key;
545
546# if (! $sticky) {
547# $x = []
548# if $type & Parse_multiple;
549
550# $got{$key} = [0, $type, $value, $x, $first_only, $sticky] ;
551 $got{$key} = [0, $type, $value, $x] ;
552# }
553#
554# $got{$key}[OFF_PARSED] = 0 ;
555 }
556
557 return bless \%got, "IO::Compress::Base::Parameters::Defaults" ;
558}
559
560sub IO::Compress::Base::Parameters::new
561
# spent 3.36ms within IO::Compress::Base::Parameters::new which was called 40 times, avg 84µs/call: # 40 times (3.36ms+0s) by IO::Uncompress::Base::checkParams at line 348 of IO/Uncompress/Base.pm, avg 84µs/call
{
562 #my $class = shift ;
563
5644040µs my $obj;
565401.51ms $obj->[IxError] = '';
56640135µs $obj->[IxGot] = {} ;
567
568401.24ms return bless $obj, 'IO::Compress::Base::Parameters' ;
569}
570
571sub IO::Compress::Base::Parameters::setError
572{
573 my $self = shift ;
574 my $error = shift ;
575 my $retval = @_ ? shift : undef ;
576
577
578 $self->[IxError] = $error ;
579 return $retval;
580}
581
582sub IO::Compress::Base::Parameters::getError
583{
584 my $self = shift ;
585 return $self->[IxError] ;
586}
587
588sub IO::Compress::Base::Parameters::parse
589
# spent 118ms (112+6.31) within IO::Compress::Base::Parameters::parse which was called 40 times, avg 2.96ms/call: # 40 times (112ms+6.31ms) by IO::Uncompress::Base::checkParams at line 374 of IO/Uncompress/Base.pm, avg 2.96ms/call
{
5904053µs my $self = shift ;
5914044µs my $default = shift ;
592
5934073µs my $got = $self->[IxGot] ;
59440596µs my $firstTime = keys %{ $got } == 0 ;
595
5964048µs my (@Bad) ;
5974091µs my @entered = () ;
598
599 # Allow the options to be passed as a hash reference or
600 # as the complete hash.
60140138µs if (@_ == 0) {
602 @entered = () ;
603 }
604 elsif (@_ == 1) {
605 my $href = $_[0] ;
606
607 return $self->setError("Expected even number of parameters, got 1")
608 if ! defined $href or ! ref $href or ref $href ne "HASH" ;
609
610 foreach my $key (keys %$href) {
611 push @entered, $key ;
612 push @entered, \$href->{$key} ;
613 }
614 }
615 else {
616
6174057µs my $count = @_;
6184080µs return $self->setError("Expected even number of parameters, got $count")
619 if $count % 2 != 0 ;
620
62140875µs for my $i (0.. $count / 2 - 1) {
62240547µs push @entered, $_[2 * $i] ;
62340166µs push @entered, \$_[2 * $i + 1] ;
624 }
625 }
626
627401.98ms foreach my $key (keys %$default)
628 {
629
630440582µs my ($type, $value) = @{ $default->{$key} } ;
631
632440103ms if ($firstTime) {
633 $got->{$key} = [0, $type, $value, $value] ;
634 }
635 else
636 {
637 $got->{$key}[OFF_PARSED] = 0 ;
638 }
639 }
640
641
6424087µs my %parsed = ();
643
644
64540171µs for my $i (0.. @entered / 2 - 1) {
64640493µs my $key = $entered[2* $i] ;
6474063µs my $value = $entered[2* $i+1] ;
648
649 #print "Key [$key] Value [$value]" ;
650 #print defined $$value ? "[$$value]\n" : "[undef]\n";
651
652402.28ms401.55ms $key =~ s/^-// ;
# spent 1.55ms making 40 calls to IO::Compress::Base::Common::CORE:subst, avg 39µs/call
6534092µs my $canonkey = lc $key;
654
65540211µs if ($got->{$canonkey})
656 {
6574058µs my $type = $got->{$canonkey}[OFF_TYPE] ;
6584055µs my $parsed = $parsed{$canonkey};
6594075µs ++ $parsed{$canonkey};
660
6614039µs return $self->setError("Muliple instances of '$key' found")
662 if $parsed ;
663
6644035µs my $s ;
665401.68ms404.76ms $self->_checkType($key, $value, $type, 1, \$s)
# spent 4.76ms making 40 calls to IO::Compress::Base::Parameters::_checkType, avg 119µs/call
666 or return undef ;
667
6684049µs $value = $$value ;
66940162µs $got->{$canonkey} = [1, $type, $value, $s] ;
670
671 }
672 else
673 { push (@Bad, $key) }
674 }
675
6764050µs if (@Bad) {
677 my ($bad) = join(", ", @Bad) ;
678 return $self->setError("unknown key value(s) $bad") ;
679 }
680
68140268µs return 1;
682}
683
684sub IO::Compress::Base::Parameters::_checkType
685
# spent 4.76ms (2.46+2.30) within IO::Compress::Base::Parameters::_checkType which was called 40 times, avg 119µs/call: # 40 times (2.46ms+2.30ms) by IO::Compress::Base::Parameters::parse at line 665, avg 119µs/call
{
6864049µs my $self = shift ;
687
6884047µs my $key = shift ;
6894047µs my $value = shift ;
6904042µs my $type = shift ;
6914040µs my $validate = shift ;
6924046µs my $output = shift;
693
694 #local $Carp::CarpLevel = $level ;
695 #print "PARSE $type $key $value $validate $sub\n" ;
696
6974066µs if ($type & Parse_writable_scalar)
698 {
699 return $self->setError("Parameter '$key' not writable")
700 if readonly $$value ;
701
702 if (ref $$value)
703 {
704 return $self->setError("Parameter '$key' not a scalar reference")
705 if ref $$value ne 'SCALAR' ;
706
707 $$output = $$value ;
708 }
709 else
710 {
711 return $self->setError("Parameter '$key' not a scalar")
712 if ref $value ne 'SCALAR' ;
713
714 $$output = $value ;
715 }
716
717 return 1;
718 }
719
720
7214061µs $value = $$value ;
722
72340107µs if ($type & Parse_any)
724 {
725 $$output = $value ;
726 return 1;
727 }
728 elsif ($type & Parse_unsigned)
729 {
730
731 return $self->setError("Parameter '$key' must be an unsigned int, got 'undef'")
732 if ! defined $value ;
733 return $self->setError("Parameter '$key' must be an unsigned int, got '$value'")
734 if $value !~ /^\d+$/;
735
736 $$output = defined $value ? $value : 0 ;
737 return 1;
738 }
739 elsif ($type & Parse_signed)
740 {
741 return $self->setError("Parameter '$key' must be a signed int, got 'undef'")
742 if ! defined $value ;
743 return $self->setError("Parameter '$key' must be a signed int, got '$value'")
744 if $value !~ /^-?\d+$/;
745
746 $$output = defined $value ? $value : 0 ;
747 return 1 ;
748 }
749 elsif ($type & Parse_boolean)
750 {
751402.57ms402.30ms return $self->setError("Parameter '$key' must be an int, got '$value'")
# spent 2.30ms making 40 calls to IO::Compress::Base::Common::CORE:match, avg 57µs/call
752 if defined $value && $value !~ /^\d*$/;
753
7544071µs $$output = defined $value && $value != 0 ? 1 : 0 ;
75540258µs return 1;
756 }
757
758 elsif ($type & Parse_string)
759 {
760 $$output = defined $value ? $value : "" ;
761 return 1;
762 }
763 elsif ($type & Parse_code)
764 {
765 return $self->setError("Parameter '$key' must be a code reference, got '$value'")
766 if (! defined $value || ref $value ne 'CODE') ;
767
768 $$output = defined $value ? $value : "" ;
769 return 1;
770 }
771
772 $$output = $value ;
773 return 1;
774}
775
776sub IO::Compress::Base::Parameters::parsed
777
# spent 600µs within IO::Compress::Base::Parameters::parsed which was called 40 times, avg 15µs/call: # 40 times (600µs+0s) by IO::Uncompress::Base::_create at line 451 of IO/Uncompress/Base.pm, avg 15µs/call
{
77840251µs return $_[0]->[IxGot]{$_[1]}[OFF_PARSED] ;
779}
780
781
782sub IO::Compress::Base::Parameters::getValue
783
# spent 3.07ms within IO::Compress::Base::Parameters::getValue which was called 680 times, avg 5µs/call: # 120 times (845µs+0s) by IO::Uncompress::RawInflate::mkUncomp at line 76 of IO/Uncompress/RawInflate.pm, avg 7µs/call # 80 times (217µs+0s) by IO::Uncompress::Base::_create at line 467 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (616µs+0s) by IO::Uncompress::Base::_create at line 461 of IO/Uncompress/Base.pm, avg 15µs/call # 40 times (198µs+0s) by IO::Uncompress::Base::_create at line 424 of IO/Uncompress/Base.pm, avg 5µs/call # 40 times (159µs+0s) by IO::Uncompress::Base::_create at line 458 of IO/Uncompress/Base.pm, avg 4µs/call # 40 times (134µs+0s) by IO::Uncompress::Base::_create at line 457 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (120µs+0s) by IO::Uncompress::Base::_create at line 454 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (118µs+0s) by IO::Uncompress::Base::_create at line 459 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (115µs+0s) by IO::Uncompress::Base::_create at line 470 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (114µs+0s) by IO::Uncompress::Base::_create at line 462 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (113µs+0s) by IO::Uncompress::Base::_create at line 456 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (110µs+0s) by IO::Uncompress::Base::_create at line 463 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (107µs+0s) by IO::Uncompress::Base::_create at line 460 of IO/Uncompress/Base.pm, avg 3µs/call # 40 times (106µs+0s) by IO::Uncompress::Base::_create at line 466 of IO/Uncompress/Base.pm, avg 3µs/call
{
7846804.78ms return $_[0]->[IxGot]{$_[1]}[OFF_FIXED] ;
785}
786sub IO::Compress::Base::Parameters::setValue
787
# spent 1.28ms within IO::Compress::Base::Parameters::setValue which was called 40 times, avg 32µs/call: # 40 times (1.28ms+0s) by IO::Uncompress::Gunzip::ckParams at line 59 of IO/Uncompress/Gunzip.pm, avg 32µs/call
{
78840577µs $_[0]->[IxGot]{$_[1]}[OFF_PARSED] = 1;
7894085µs $_[0]->[IxGot]{$_[1]}[OFF_DEFAULT] = $_[2] ;
79040373µs $_[0]->[IxGot]{$_[1]}[OFF_FIXED] = $_[2] ;
791}
792
793sub IO::Compress::Base::Parameters::valueRef
794{
795 return $_[0]->[IxGot]{$_[1]}[OFF_FIXED] ;
796}
797
798sub IO::Compress::Base::Parameters::valueOrDefault
799{
800 my $self = shift ;
801 my $name = shift ;
802 my $default = shift ;
803
804 my $value = $self->[IxGot]{$name}[OFF_DEFAULT] ;
805
806 return $value if defined $value ;
807 return $default ;
808}
809
810sub IO::Compress::Base::Parameters::wantValue
811{
812 return defined $_[0]->[IxGot]{$_[1]}[OFF_DEFAULT] ;
813}
814
815sub IO::Compress::Base::Parameters::clone
816{
817 my $self = shift ;
818 my $obj = [] ;
819 my %got ;
820
821 my $hash = $self->[IxGot] ;
822 for my $k (keys %{ $hash })
823 {
824 $got{$k} = [ @{ $hash->{$k} } ];
825 }
826
827 $obj->[IxError] = $self->[IxError];
828 $obj->[IxGot] = \%got ;
829
830 return bless $obj, 'IO::Compress::Base::Parameters' ;
831}
832
833package U64;
834
835234µs2124µs
# spent 67µs (10+57) within U64::BEGIN@835 which was called: # once (10µs+57µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 835
use constant MAX32 => 0xFFFFFFFF ;
# spent 67µs making 1 call to U64::BEGIN@835 # spent 57µs making 1 call to constant::import
836227µs2106µs
# spent 58µs (9+49) within U64::BEGIN@836 which was called: # once (9µs+49µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 836
use constant HI_1 => MAX32 + 1 ;
# spent 58µs making 1 call to U64::BEGIN@836 # spent 49µs making 1 call to constant::import
837224µs2105µs
# spent 56µs (8+48) within U64::BEGIN@837 which was called: # once (8µs+48µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 837
use constant LOW => 0 ;
# spent 56µs making 1 call to U64::BEGIN@837 # spent 48µs making 1 call to constant::import
8382806µs2104µs
# spent 57µs (10+47) within U64::BEGIN@838 which was called: # once (10µs+47µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 838
use constant HIGH => 1;
# spent 57µs making 1 call to U64::BEGIN@838 # spent 47µs making 1 call to constant::import
839
840sub new
841
# spent 1.22ms within U64::new which was called 80 times, avg 15µs/call: # 40 times (1.07ms+0s) by IO::Uncompress::Base::_create at line 475 of IO/Uncompress/Base.pm, avg 27µs/call # 40 times (143µs+0s) by IO::Uncompress::Base::_create at line 476 of IO/Uncompress/Base.pm, avg 4µs/call
{
84280911µs return bless [ 0, 0 ], $_[0]
843 if @_ == 1 ;
844
845 return bless [ $_[1], 0 ], $_[0]
846 if @_ == 2 ;
847
848 return bless [ $_[2], $_[1] ], $_[0]
849 if @_ == 3 ;
850}
851
852sub newUnpack_V64
853{
854 my ($low, $hi) = unpack "V V", $_[0] ;
855 bless [ $low, $hi ], "U64";
856}
857
858sub newUnpack_V32
859{
860 my $string = shift;
861
862 my $low = unpack "V", $string ;
863 bless [ $low, 0 ], "U64";
864}
865
866sub reset
867
# spent 224µs within U64::reset which was called 80 times, avg 3µs/call: # 40 times (149µs+0s) by IO::Uncompress::Base::gotoNextStream at line 1037 of IO/Uncompress/Base.pm, avg 4µs/call # 40 times (75µs+0s) by IO::Uncompress::Base::gotoNextStream at line 1038 of IO/Uncompress/Base.pm, avg 2µs/call
{
86880465µs $_[0]->[HIGH] = $_[0]->[LOW] = 0;
869}
870
871sub clone
872{
873 bless [ @{$_[0]} ], ref $_[0] ;
874}
875
876sub getHigh
877{
878 return $_[0]->[HIGH];
879}
880
881sub getLow
882{
883 return $_[0]->[LOW];
884}
885
886sub get32bit
887{
888 return $_[0]->[LOW];
889}
890
891sub get64bit
892{
893 # Not using << here because the result will still be
894 # a 32-bit value on systems where int size is 32-bits
895 return $_[0]->[HIGH] * HI_1 + $_[0]->[LOW];
896}
897
898sub add
899
# spent 2.60ms within U64::add which was called 364 times, avg 7µs/call: # 182 times (1.61ms+0s) by IO::Uncompress::Base::_raw_read at line 926 of IO/Uncompress/Base.pm, avg 9µs/call # 182 times (990µs+0s) by IO::Uncompress::Base::_raw_read at line 930 of IO/Uncompress/Base.pm, avg 5µs/call
{
900# my $self = shift;
901364280µs my $value = $_[1];
902
903364357µs if (ref $value eq 'U64') {
904 $_[0]->[HIGH] += $value->[HIGH] ;
905 $value = $value->[LOW];
906 }
907 elsif ($value > MAX32) {
908 $_[0]->[HIGH] += int($value / HI_1) ;
909 $value = $value % HI_1;
910 }
911
912364351µs my $available = MAX32 - $_[0]->[LOW] ;
913
91436429.8ms if ($value > $available) {
915 ++ $_[0]->[HIGH] ;
916 $_[0]->[LOW] = $value - $available - 1;
917 }
918 else {
919364310µs $_[0]->[LOW] += $value ;
920 }
921}
922
923sub add32
924{
925# my $self = shift;
926 my $value = $_[1];
927
928 if ($value > MAX32) {
929 $_[0]->[HIGH] += int($value / HI_1) ;
930 $value = $value % HI_1;
931 }
932
933 my $available = MAX32 - $_[0]->[LOW] ;
934
935 if ($value > $available) {
936 ++ $_[0]->[HIGH] ;
937 $_[0]->[LOW] = $value - $available - 1;
938 }
939 else {
940 $_[0]->[LOW] += $value ;
941 }
942}
943
944sub subtract
945{
946 my $self = shift;
947 my $value = shift;
948
949 if (ref $value eq 'U64') {
950
951 if ($value->[HIGH]) {
952 die "bad"
953 if $self->[HIGH] == 0 ||
954 $value->[HIGH] > $self->[HIGH] ;
955
956 $self->[HIGH] -= $value->[HIGH] ;
957 }
958
959 $value = $value->[LOW] ;
960 }
961
962 if ($value > $self->[LOW]) {
963 -- $self->[HIGH] ;
964 $self->[LOW] = MAX32 - $value + $self->[LOW] + 1 ;
965 }
966 else {
967 $self->[LOW] -= $value;
968 }
969}
970
971sub equal
972{
973 my $self = shift;
974 my $other = shift;
975
976 return $self->[LOW] == $other->[LOW] &&
977 $self->[HIGH] == $other->[HIGH] ;
978}
979
980sub gt
981{
982 my $self = shift;
983 my $other = shift;
984
985 return $self->cmp($other) > 0 ;
986}
987
988sub cmp
989{
990 my $self = shift;
991 my $other = shift ;
992
993 if ($self->[LOW] == $other->[LOW]) {
994 return $self->[HIGH] - $other->[HIGH] ;
995 }
996 else {
997 return $self->[LOW] - $other->[LOW] ;
998 }
999}
1000
1001
1002sub is64bit
1003{
1004 return $_[0]->[HIGH] > 0 ;
1005}
1006
1007sub isAlmost64bit
1008{
1009 return $_[0]->[HIGH] > 0 || $_[0]->[LOW] == MAX32 ;
1010}
1011
1012sub getPacked_V64
1013{
1014 return pack "V V", @{ $_[0] } ;
1015}
1016
1017sub getPacked_V32
1018{
1019 return pack "V", $_[0]->[LOW] ;
1020}
1021
1022sub pack_V64
1023{
1024 return pack "V V", $_[0], 0;
1025}
1026
1027
1028sub full32
1029{
1030 return $_[0] == MAX32 ;
1031}
1032
1033sub Value_VV64
1034{
1035 my $buffer = shift;
1036
1037 my ($lo, $hi) = unpack ("V V" , $buffer);
10382123µs256µs
# spent 34µs (12+22) within U64::BEGIN@1038 which was called: # once (12µs+22µs) by IO::Uncompress::RawInflate::BEGIN@9 at line 1038
no warnings 'uninitialized';
# spent 34µs making 1 call to U64::BEGIN@1038 # spent 22µs making 1 call to warnings::unimport
1039 return $hi * HI_1 + $lo;
1040}
1041
1042
1043package IO::Compress::Base::Common;
1044
1045111µs1;
 
# spent 137µs within IO::Compress::Base::Common::CORE:binmode which was called 40 times, avg 3µs/call: # 40 times (137µs+0s) by IO::Compress::Base::Common::setBinModeInput at line 100, avg 3µs/call
sub IO::Compress::Base::Common::CORE:binmode; # opcode
# spent 2.30ms within IO::Compress::Base::Common::CORE:match which was called 40 times, avg 57µs/call: # 40 times (2.30ms+0s) by IO::Compress::Base::Parameters::_checkType at line 751, avg 57µs/call
sub IO::Compress::Base::Common::CORE:match; # opcode
# spent 1.55ms within IO::Compress::Base::Common::CORE:subst which was called 40 times, avg 39µs/call: # 40 times (1.55ms+0s) by IO::Compress::Base::Parameters::parse at line 652, avg 39µs/call
sub IO::Compress::Base::Common::CORE:subst; # opcode