Filename | /home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/x86_64-linux/Compress/Raw/Zlib.pm |
Statements | Executed 1999 statements in 3.16ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
7 | 1 | 1 | 12.1ms | 12.1ms | inflate (xsub) | Compress::Raw::Zlib::inflateStream::
1 | 1 | 1 | 850µs | 965µs | BEGIN@113 | Compress::Raw::Zlib::
7 | 1 | 1 | 295µs | 450µs | parse | Compress::Raw::Zlib::Parameters::
1 | 1 | 1 | 188µs | 228µs | BEGIN@10 | Compress::Raw::Zlib::
70 | 2 | 1 | 127µs | 145µs | _checkType | Compress::Raw::Zlib::Parameters::
7 | 1 | 1 | 120µs | 722µs | new | Compress::Raw::Zlib::Inflate::
63 | 8 | 1 | 49µs | 49µs | value | Compress::Raw::Zlib::Parameters::
7 | 1 | 1 | 47µs | 510µs | ParseParameters | Compress::Raw::Zlib::
7 | 3 | 2 | 44µs | 58µs | AUTOLOAD | Compress::Raw::Zlib::
7 | 1 | 1 | 40µs | 40µs | _inflateInit (xsub) | Compress::Raw::Zlib::
55 | 8 | 2 | 32µs | 32µs | __ANON__[:122] | Compress::Raw::Zlib::
7 | 1 | 1 | 25µs | 25µs | DESTROY (xsub) | Compress::Raw::Zlib::inflateStream::
1 | 1 | 1 | 14µs | 28µs | BEGIN@155 | Compress::Raw::Zlib::
7 | 1 | 1 | 13µs | 13µs | new | Compress::Raw::Zlib::Parameters::
1 | 1 | 1 | 8µs | 42µs | BEGIN@6 | Compress::Raw::Zlib::
1 | 1 | 1 | 5µs | 9µs | BEGIN@121 | Compress::Raw::Zlib::
7 | 1 | 1 | 4µs | 4µs | constant (xsub) | Compress::Raw::Zlib::
1 | 1 | 1 | 4µs | 5µs | BEGIN@8 | Compress::Raw::Zlib::
1 | 1 | 1 | 4µs | 22µs | BEGIN@114 | Compress::Raw::Zlib::
1 | 1 | 1 | 4µs | 24µs | BEGIN@126 | Compress::Raw::Zlib::
1 | 1 | 1 | 4µs | 21µs | BEGIN@144 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 21µs | BEGIN@130 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 18µs | BEGIN@127 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 19µs | BEGIN@146 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 17µs | BEGIN@129 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 36µs | BEGIN@145 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 18µs | BEGIN@147 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 17µs | BEGIN@128 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 16µs | BEGIN@154 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 19µs | BEGIN@9 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 18µs | BEGIN@157 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 16µs | BEGIN@158 | Compress::Raw::Zlib::
1 | 1 | 1 | 3µs | 16µs | BEGIN@153 | Compress::Raw::Zlib::
1 | 1 | 1 | 2µs | 15µs | BEGIN@156 | Compress::Raw::Zlib::
0 | 0 | 0 | 0s | 0s | new | Compress::Raw::Zlib::Deflate::
0 | 0 | 0 | 0s | 0s | new | Compress::Raw::Zlib::InflateScan::
0 | 0 | 0 | 0s | 0s | parsed | Compress::Raw::Zlib::Parameters::
0 | 0 | 0 | 0s | 0s | setError | Compress::Raw::Zlib::Parameters::
0 | 0 | 0 | 0s | 0s | STORABLE_freeze | Compress::Raw::Zlib::deflateStream::
0 | 0 | 0 | 0s | 0s | STORABLE_thaw | Compress::Raw::Zlib::deflateStream::
0 | 0 | 0 | 0s | 0s | deflateParams | Compress::Raw::Zlib::deflateStream::
0 | 0 | 0 | 0s | 0s | createDeflateStream | Compress::Raw::Zlib::inflateScanStream::
0 | 0 | 0 | 0s | 0s | inflate | Compress::Raw::Zlib::inflateScanStream::
0 | 0 | 0 | 0s | 0s | STORABLE_freeze | Compress::Raw::Zlib::inflateStream::
0 | 0 | 0 | 0s | 0s | STORABLE_thaw | Compress::Raw::Zlib::inflateStream::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | |||||
2 | package Compress::Raw::Zlib; | ||||
3 | |||||
4 | 1 | 6µs | require 5.006 ; | ||
5 | 1 | 400ns | require Exporter; | ||
6 | 2 | 17µs | 2 | 75µs | # spent 42µs (8+34) within Compress::Raw::Zlib::BEGIN@6 which was called:
# once (8µs+34µs) by Archive::Zip::BEGIN@9 at line 6 # spent 42µs making 1 call to Compress::Raw::Zlib::BEGIN@6
# spent 34µs making 1 call to Exporter::import |
7 | |||||
8 | 2 | 14µs | 2 | 7µs | # spent 5µs (4+2) within Compress::Raw::Zlib::BEGIN@8 which was called:
# once (4µs+2µs) by Archive::Zip::BEGIN@9 at line 8 # spent 5µs making 1 call to Compress::Raw::Zlib::BEGIN@8
# spent 2µs making 1 call to strict::import |
9 | 2 | 13µs | 2 | 35µs | # spent 19µs (3+16) within Compress::Raw::Zlib::BEGIN@9 which was called:
# once (3µs+16µs) by Archive::Zip::BEGIN@9 at line 9 # spent 19µs making 1 call to Compress::Raw::Zlib::BEGIN@9
# spent 16µs making 1 call to warnings::import |
10 | 2 | 204µs | 2 | 230µs | # spent 228µs (188+40) within Compress::Raw::Zlib::BEGIN@10 which was called:
# once (188µs+40µs) by Archive::Zip::BEGIN@9 at line 10 # spent 228µs making 1 call to Compress::Raw::Zlib::BEGIN@10
# spent 2µs making 1 call to bytes::import |
11 | our ($VERSION, $XS_VERSION, @ISA, @EXPORT, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD, %DEFLATE_CONSTANTS, @DEFLATE_CONSTANTS); | ||||
12 | |||||
13 | 1 | 300ns | $VERSION = '2.209'; | ||
14 | 1 | 100ns | $XS_VERSION = $VERSION; | ||
15 | 1 | 11µs | $VERSION = eval $VERSION; # spent 2µs executing statements in string eval | ||
16 | |||||
17 | 1 | 5µs | @ISA = qw(Exporter); | ||
18 | 1 | 3µs | %EXPORT_TAGS = ( flush => [qw{ | ||
19 | Z_NO_FLUSH | ||||
20 | Z_PARTIAL_FLUSH | ||||
21 | Z_SYNC_FLUSH | ||||
22 | Z_FULL_FLUSH | ||||
23 | Z_FINISH | ||||
24 | Z_BLOCK | ||||
25 | }], | ||||
26 | level => [qw{ | ||||
27 | Z_NO_COMPRESSION | ||||
28 | Z_BEST_SPEED | ||||
29 | Z_BEST_COMPRESSION | ||||
30 | Z_DEFAULT_COMPRESSION | ||||
31 | }], | ||||
32 | strategy => [qw{ | ||||
33 | Z_FILTERED | ||||
34 | Z_HUFFMAN_ONLY | ||||
35 | Z_RLE | ||||
36 | Z_FIXED | ||||
37 | Z_DEFAULT_STRATEGY | ||||
38 | }], | ||||
39 | status => [qw{ | ||||
40 | Z_OK | ||||
41 | Z_STREAM_END | ||||
42 | Z_NEED_DICT | ||||
43 | Z_ERRNO | ||||
44 | Z_STREAM_ERROR | ||||
45 | Z_DATA_ERROR | ||||
46 | Z_MEM_ERROR | ||||
47 | Z_BUF_ERROR | ||||
48 | Z_VERSION_ERROR | ||||
49 | }], | ||||
50 | ); | ||||
51 | |||||
52 | 1 | 1µs | %DEFLATE_CONSTANTS = %EXPORT_TAGS; | ||
53 | |||||
54 | # Items to export into callers namespace by default. Note: do not export | ||||
55 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||
56 | # Do not simply export all your public functions/methods/constants. | ||||
57 | 1 | 4µs | @DEFLATE_CONSTANTS = | ||
58 | @EXPORT = qw( | ||||
59 | ZLIB_VERSION | ||||
60 | ZLIB_VERNUM | ||||
61 | |||||
62 | |||||
63 | OS_CODE | ||||
64 | |||||
65 | MAX_MEM_LEVEL | ||||
66 | MAX_WBITS | ||||
67 | |||||
68 | Z_ASCII | ||||
69 | Z_BEST_COMPRESSION | ||||
70 | Z_BEST_SPEED | ||||
71 | Z_BINARY | ||||
72 | Z_BLOCK | ||||
73 | Z_BUF_ERROR | ||||
74 | Z_DATA_ERROR | ||||
75 | Z_DEFAULT_COMPRESSION | ||||
76 | Z_DEFAULT_STRATEGY | ||||
77 | Z_DEFLATED | ||||
78 | Z_ERRNO | ||||
79 | Z_FILTERED | ||||
80 | Z_FIXED | ||||
81 | Z_FINISH | ||||
82 | Z_FULL_FLUSH | ||||
83 | Z_HUFFMAN_ONLY | ||||
84 | Z_MEM_ERROR | ||||
85 | Z_NEED_DICT | ||||
86 | Z_NO_COMPRESSION | ||||
87 | Z_NO_FLUSH | ||||
88 | Z_NULL | ||||
89 | Z_OK | ||||
90 | Z_PARTIAL_FLUSH | ||||
91 | Z_RLE | ||||
92 | Z_STREAM_END | ||||
93 | Z_STREAM_ERROR | ||||
94 | Z_SYNC_FLUSH | ||||
95 | Z_TREES | ||||
96 | Z_UNKNOWN | ||||
97 | Z_VERSION_ERROR | ||||
98 | |||||
99 | ZLIBNG_VERSION | ||||
100 | ZLIBNG_VERNUM | ||||
101 | ZLIBNG_VER_MAJOR | ||||
102 | ZLIBNG_VER_MINOR | ||||
103 | ZLIBNG_VER_REVISION | ||||
104 | ZLIBNG_VER_STATUS | ||||
105 | ZLIBNG_VER_MODIFIED | ||||
106 | |||||
107 | WANT_GZIP | ||||
108 | WANT_GZIP_OR_ZLIB | ||||
109 | ); | ||||
110 | |||||
111 | 1 | 700ns | push @EXPORT, qw(crc32 adler32 DEF_WBITS); | ||
112 | |||||
113 | 2 | 91µs | 2 | 994µs | # spent 965µs (850+115) within Compress::Raw::Zlib::BEGIN@113 which was called:
# once (850µs+115µs) by Archive::Zip::BEGIN@9 at line 113 # spent 965µs making 1 call to Compress::Raw::Zlib::BEGIN@113
# spent 28µs making 1 call to constant::import |
114 | 2 | 49µs | 2 | 41µs | # spent 22µs (4+19) within Compress::Raw::Zlib::BEGIN@114 which was called:
# once (4µs+19µs) by Archive::Zip::BEGIN@9 at line 114 # spent 22µs making 1 call to Compress::Raw::Zlib::BEGIN@114
# spent 19µs making 1 call to constant::import |
115 | |||||
116 | # spent 58µs (44+14) within Compress::Raw::Zlib::AUTOLOAD which was called 7 times, avg 8µs/call:
# 5 times (26µs+9µs) by Archive::Zip::BEGIN@9 at line 385, avg 7µs/call
# once (10µs+3µs) by Archive::Zip::Member::rewindData at line 1230 of Archive/Zip/Member.pm
# once (8µs+3µs) by Archive::Zip::Member::_inflateChunk at line 1186 of Archive/Zip/Member.pm | ||||
117 | 7 | 800ns | my($constname); | ||
118 | 7 | 19µs | 7 | 10µs | ($constname = $AUTOLOAD) =~ s/.*:://; # spent 10µs making 7 calls to CORE::subst, avg 1µs/call |
119 | 7 | 13µs | 7 | 4µs | my ($error, $val) = constant($constname); # spent 4µs making 7 calls to Compress::Raw::Zlib::constant, avg 600ns/call |
120 | 7 | 800ns | Carp::croak $error if $error; | ||
121 | 2 | 49µs | 2 | 13µs | # spent 9µs (5+4) within Compress::Raw::Zlib::BEGIN@121 which was called:
# once (5µs+4µs) by Archive::Zip::BEGIN@9 at line 121 # spent 9µs making 1 call to Compress::Raw::Zlib::BEGIN@121
# spent 4µs making 1 call to strict::unimport |
122 | 62 | 60µs | # spent 32µs within Compress::Raw::Zlib::__ANON__[/home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/x86_64-linux/Compress/Raw/Zlib.pm:122] which was called 55 times, avg 582ns/call:
# 13 times (6µs+0s) by Archive::Zip::Member::_inflateChunk at line 1186 of Archive/Zip/Member.pm, avg 469ns/call
# 7 times (8µs+0s) by Archive::Zip::Member::_inflateChunk at line 1185 of Archive/Zip/Member.pm, avg 1µs/call
# 7 times (6µs+0s) by Archive::Zip::Member::rewindData at line 1225 of Archive/Zip/Member.pm, avg 829ns/call
# 7 times (3µs+0s) by Compress::Raw::Zlib::Inflate::new at line 473, avg 486ns/call
# 7 times (3µs+0s) by Archive::Zip::BEGIN@9 or Archive::Zip::Member::_inflateChunk or Archive::Zip::Member::rewindData at line 123, avg 429ns/call
# 7 times (2µs+0s) by Archive::Zip::Member::_inflateChunk at line 1187 of Archive/Zip/Member.pm, avg 214ns/call
# 6 times (4µs+0s) by Archive::Zip::Member::rewindData at line 1230 of Archive/Zip/Member.pm, avg 733ns/call
# once (300ns+0s) by Archive::Zip::BEGIN@9 at line 442 | ||
123 | 7 | 17µs | 7 | 3µs | goto &{$AUTOLOAD}; # spent 3µs making 7 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:122], avg 429ns/call |
124 | } | ||||
125 | |||||
126 | 2 | 15µs | 2 | 44µs | # spent 24µs (4+20) within Compress::Raw::Zlib::BEGIN@126 which was called:
# once (4µs+20µs) by Archive::Zip::BEGIN@9 at line 126 # spent 24µs making 1 call to Compress::Raw::Zlib::BEGIN@126
# spent 20µs making 1 call to constant::import |
127 | 2 | 12µs | 2 | 33µs | # spent 18µs (3+15) within Compress::Raw::Zlib::BEGIN@127 which was called:
# once (3µs+15µs) by Archive::Zip::BEGIN@9 at line 127 # spent 18µs making 1 call to Compress::Raw::Zlib::BEGIN@127
# spent 15µs making 1 call to constant::import |
128 | 2 | 13µs | 2 | 31µs | # spent 17µs (3+14) within Compress::Raw::Zlib::BEGIN@128 which was called:
# once (3µs+14µs) by Archive::Zip::BEGIN@9 at line 128 # spent 17µs making 1 call to Compress::Raw::Zlib::BEGIN@128
# spent 14µs making 1 call to constant::import |
129 | 2 | 12µs | 2 | 30µs | # spent 17µs (3+14) within Compress::Raw::Zlib::BEGIN@129 which was called:
# once (3µs+14µs) by Archive::Zip::BEGIN@9 at line 129 # spent 17µs making 1 call to Compress::Raw::Zlib::BEGIN@129
# spent 14µs making 1 call to constant::import |
130 | 2 | 42µs | 2 | 39µs | # spent 21µs (3+18) within Compress::Raw::Zlib::BEGIN@130 which was called:
# once (3µs+18µs) by Archive::Zip::BEGIN@9 at line 130 # spent 21µs making 1 call to Compress::Raw::Zlib::BEGIN@130
# spent 18µs making 1 call to constant::import |
131 | |||||
132 | eval { | ||||
133 | 1 | 400ns | require XSLoader; | ||
134 | 1 | 176µs | 1 | 170µs | XSLoader::load('Compress::Raw::Zlib', $XS_VERSION); # spent 170µs making 1 call to XSLoader::load |
135 | 1 | 500ns | 1; | ||
136 | } | ||||
137 | 1 | 400ns | or do { | ||
138 | require DynaLoader; | ||||
139 | local @ISA = qw(DynaLoader); | ||||
140 | bootstrap Compress::Raw::Zlib $XS_VERSION ; | ||||
141 | }; | ||||
142 | |||||
143 | |||||
144 | 2 | 13µs | 2 | 39µs | # spent 21µs (4+18) within Compress::Raw::Zlib::BEGIN@144 which was called:
# once (4µs+18µs) by Archive::Zip::BEGIN@9 at line 144 # spent 21µs making 1 call to Compress::Raw::Zlib::BEGIN@144
# spent 18µs making 1 call to constant::import |
145 | 2 | 16µs | 2 | 69µs | # spent 36µs (3+33) within Compress::Raw::Zlib::BEGIN@145 which was called:
# once (3µs+33µs) by Archive::Zip::BEGIN@9 at line 145 # spent 36µs making 1 call to Compress::Raw::Zlib::BEGIN@145
# spent 33µs making 1 call to constant::import |
146 | 2 | 13µs | 2 | 35µs | # spent 19µs (3+16) within Compress::Raw::Zlib::BEGIN@146 which was called:
# once (3µs+16µs) by Archive::Zip::BEGIN@9 at line 146 # spent 19µs making 1 call to Compress::Raw::Zlib::BEGIN@146
# spent 16µs making 1 call to constant::import |
147 | 2 | 14µs | 2 | 33µs | # spent 18µs (3+15) within Compress::Raw::Zlib::BEGIN@147 which was called:
# once (3µs+15µs) by Archive::Zip::BEGIN@9 at line 147 # spent 18µs making 1 call to Compress::Raw::Zlib::BEGIN@147
# spent 15µs making 1 call to constant::import |
148 | #use constant Parse_string => 0x10; | ||||
149 | #use constant Parse_custom => 0x12; | ||||
150 | |||||
151 | #use constant Parse_store_ref => 0x100 ; | ||||
152 | |||||
153 | 2 | 12µs | 2 | 30µs | # spent 16µs (3+14) within Compress::Raw::Zlib::BEGIN@153 which was called:
# once (3µs+14µs) by Archive::Zip::BEGIN@9 at line 153 # spent 16µs making 1 call to Compress::Raw::Zlib::BEGIN@153
# spent 14µs making 1 call to constant::import |
154 | 2 | 12µs | 2 | 30µs | # spent 16µs (3+14) within Compress::Raw::Zlib::BEGIN@154 which was called:
# once (3µs+14µs) by Archive::Zip::BEGIN@9 at line 154 # spent 16µs making 1 call to Compress::Raw::Zlib::BEGIN@154
# spent 14µs making 1 call to constant::import |
155 | 2 | 11µs | 2 | 41µs | # spent 28µs (14+13) within Compress::Raw::Zlib::BEGIN@155 which was called:
# once (14µs+13µs) by Archive::Zip::BEGIN@9 at line 155 # spent 28µs making 1 call to Compress::Raw::Zlib::BEGIN@155
# spent 13µs making 1 call to constant::import |
156 | 2 | 11µs | 2 | 28µs | # spent 15µs (2+13) within Compress::Raw::Zlib::BEGIN@156 which was called:
# once (2µs+13µs) by Archive::Zip::BEGIN@9 at line 156 # spent 15µs making 1 call to Compress::Raw::Zlib::BEGIN@156
# spent 13µs making 1 call to constant::import |
157 | 2 | 13µs | 2 | 33µs | # spent 18µs (3+15) within Compress::Raw::Zlib::BEGIN@157 which was called:
# once (3µs+15µs) by Archive::Zip::BEGIN@9 at line 157 # spent 18µs making 1 call to Compress::Raw::Zlib::BEGIN@157
# spent 15µs making 1 call to constant::import |
158 | 2 | 1.45ms | 2 | 28µs | # spent 16µs (3+13) within Compress::Raw::Zlib::BEGIN@158 which was called:
# once (3µs+13µs) by Archive::Zip::BEGIN@9 at line 158 # spent 16µs making 1 call to Compress::Raw::Zlib::BEGIN@158
# spent 13µs making 1 call to constant::import |
159 | |||||
- - | |||||
162 | sub ParseParameters | ||||
163 | # spent 510µs (47+463) within Compress::Raw::Zlib::ParseParameters which was called 7 times, avg 73µs/call:
# 7 times (47µs+463µs) by Compress::Raw::Zlib::Inflate::new at line 458, avg 73µs/call | ||||
164 | 7 | 2µs | my $level = shift || 0 ; | ||
165 | |||||
166 | 7 | 15µs | my $sub = (caller($level + 1))[3] ; | ||
167 | #local $Carp::CarpLevel = 1 ; | ||||
168 | 7 | 13µs | 7 | 13µs | my $p = new Compress::Raw::Zlib::Parameters() ; # spent 13µs making 7 calls to Compress::Raw::Zlib::Parameters::new, avg 2µs/call |
169 | 7 | 6µs | 7 | 450µs | $p->parse(@_) # spent 450µs making 7 calls to Compress::Raw::Zlib::Parameters::parse, avg 64µs/call |
170 | or croak "$sub: $p->{Error}" ; | ||||
171 | |||||
172 | 7 | 8µs | return $p; | ||
173 | } | ||||
174 | |||||
175 | |||||
176 | sub Compress::Raw::Zlib::Parameters::new | ||||
177 | # spent 13µs within Compress::Raw::Zlib::Parameters::new which was called 7 times, avg 2µs/call:
# 7 times (13µs+0s) by Compress::Raw::Zlib::ParseParameters at line 168, avg 2µs/call | ||||
178 | 7 | 1µs | my $class = shift ; | ||
179 | |||||
180 | 7 | 6µs | my $obj = { Error => '', | ||
181 | Got => {}, | ||||
182 | } ; | ||||
183 | |||||
184 | #return bless $obj, ref($class) || $class || __PACKAGE__ ; | ||||
185 | 7 | 10µs | return bless $obj, 'Compress::Raw::Zlib::Parameters' ; | ||
186 | } | ||||
187 | |||||
188 | sub Compress::Raw::Zlib::Parameters::setError | ||||
189 | { | ||||
190 | my $self = shift ; | ||||
191 | my $error = shift ; | ||||
192 | my $retval = @_ ? shift : undef ; | ||||
193 | |||||
194 | $self->{Error} = $error ; | ||||
195 | return $retval; | ||||
196 | } | ||||
197 | |||||
198 | #sub getError | ||||
199 | #{ | ||||
200 | # my $self = shift ; | ||||
201 | # return $self->{Error} ; | ||||
202 | #} | ||||
203 | |||||
204 | sub Compress::Raw::Zlib::Parameters::parse | ||||
205 | # spent 450µs (295+155) within Compress::Raw::Zlib::Parameters::parse which was called 7 times, avg 64µs/call:
# 7 times (295µs+155µs) by Compress::Raw::Zlib::ParseParameters at line 169, avg 64µs/call | ||||
206 | 7 | 2µs | my $self = shift ; | ||
207 | |||||
208 | 7 | 1µs | my $default = shift ; | ||
209 | |||||
210 | 7 | 3µs | my $got = $self->{Got} ; | ||
211 | 7 | 4µs | my $firstTime = keys %{ $got } == 0 ; | ||
212 | |||||
213 | 7 | 800ns | my (@Bad) ; | ||
214 | 7 | 2µs | my @entered = () ; | ||
215 | |||||
216 | # Allow the options to be passed as a hash reference or | ||||
217 | # as the complete hash. | ||||
218 | 7 | 4µs | if (@_ == 0) { | ||
219 | @entered = () ; | ||||
220 | } | ||||
221 | elsif (@_ == 1) { | ||||
222 | my $href = $_[0] ; | ||||
223 | return $self->setError("Expected even number of parameters, got 1") | ||||
224 | if ! defined $href or ! ref $href or ref $href ne "HASH" ; | ||||
225 | |||||
226 | foreach my $key (keys %$href) { | ||||
227 | push @entered, $key ; | ||||
228 | push @entered, \$href->{$key} ; | ||||
229 | } | ||||
230 | } | ||||
231 | else { | ||||
232 | 7 | 2µs | my $count = @_; | ||
233 | 7 | 3µs | return $self->setError("Expected even number of parameters, got $count") | ||
234 | if $count % 2 != 0 ; | ||||
235 | |||||
236 | 7 | 10µs | for my $i (0.. $count / 2 - 1) { | ||
237 | 14 | 4µs | push @entered, $_[2* $i] ; | ||
238 | 14 | 6µs | push @entered, \$_[2* $i+1] ; | ||
239 | } | ||||
240 | } | ||||
241 | |||||
242 | |||||
243 | 7 | 32µs | while (my ($key, $v) = each %$default) | ||
244 | { | ||||
245 | 56 | 5µs | croak "need 4 params [@$v]" | ||
246 | if @$v != 4 ; | ||||
247 | |||||
248 | 56 | 13µs | my ($first_only, $sticky, $type, $value) = @$v ; | ||
249 | 56 | 4µs | my $x ; | ||
250 | 56 | 27µs | 56 | 90µs | $self->_checkType($key, \$value, $type, 0, \$x) # spent 90µs making 56 calls to Compress::Raw::Zlib::Parameters::_checkType, avg 2µs/call |
251 | or return undef ; | ||||
252 | |||||
253 | 56 | 13µs | $key = lc $key; | ||
254 | |||||
255 | 56 | 37µs | if ($firstTime || ! $sticky) { | ||
256 | $got->{$key} = [0, $type, $value, $x, $first_only, $sticky] ; | ||||
257 | } | ||||
258 | |||||
259 | 56 | 15µs | $got->{$key}[OFF_PARSED] = 0 ; | ||
260 | } | ||||
261 | |||||
262 | 7 | 6µs | for my $i (0.. @entered / 2 - 1) { | ||
263 | 14 | 4µs | my $key = $entered[2* $i] ; | ||
264 | 14 | 3µs | my $value = $entered[2* $i+1] ; | ||
265 | |||||
266 | #print "Key [$key] Value [$value]" ; | ||||
267 | #print defined $$value ? "[$$value]\n" : "[undef]\n"; | ||||
268 | |||||
269 | 14 | 24µs | 14 | 10µs | $key =~ s/^-// ; # spent 10µs making 14 calls to CORE::subst, avg 686ns/call |
270 | 14 | 3µs | my $canonkey = lc $key; | ||
271 | |||||
272 | 14 | 9µs | if ($got->{$canonkey} && ($firstTime || | ||
273 | ! $got->{$canonkey}[OFF_FIRST_ONLY] )) | ||||
274 | { | ||||
275 | 14 | 3µs | my $type = $got->{$canonkey}[OFF_TYPE] ; | ||
276 | 14 | 1µs | my $s ; | ||
277 | 14 | 8µs | 14 | 55µs | $self->_checkType($key, $value, $type, 1, \$s) # spent 55µs making 14 calls to Compress::Raw::Zlib::Parameters::_checkType, avg 4µs/call |
278 | or return undef ; | ||||
279 | #$value = $$value unless $type & Parse_store_ref ; | ||||
280 | 14 | 2µs | $value = $$value ; | ||
281 | 14 | 11µs | $got->{$canonkey} = [1, $type, $value, $s] ; | ||
282 | } | ||||
283 | else | ||||
284 | { push (@Bad, $key) } | ||||
285 | } | ||||
286 | |||||
287 | 7 | 1µs | if (@Bad) { | ||
288 | my ($bad) = join(", ", @Bad) ; | ||||
289 | return $self->setError("unknown key value(s) @Bad") ; | ||||
290 | } | ||||
291 | |||||
292 | 7 | 9µs | return 1; | ||
293 | } | ||||
294 | |||||
295 | sub Compress::Raw::Zlib::Parameters::_checkType | ||||
296 | { | ||||
297 | 70 | 6µs | my $self = shift ; | ||
298 | |||||
299 | 70 | 8µs | my $key = shift ; | ||
300 | 70 | 8µs | my $value = shift ; | ||
301 | 70 | 5µs | my $type = shift ; | ||
302 | 70 | 6µs | my $validate = shift ; | ||
303 | 70 | 5µs | my $output = shift; | ||
304 | |||||
305 | #local $Carp::CarpLevel = $level ; | ||||
306 | #print "PARSE $type $key $value $validate $sub\n" ; | ||||
307 | # if ( $type & Parse_store_ref) | ||||
308 | # { | ||||
309 | # #$value = $$value | ||||
310 | # # if ref ${ $value } ; | ||||
311 | # | ||||
312 | # $$output = $value ; | ||||
313 | # return 1; | ||||
314 | # } | ||||
315 | |||||
316 | 70 | 8µs | $value = $$value ; | ||
317 | |||||
318 | 70 | 17µs | if ($type & Parse_any) | ||
319 | { | ||||
320 | 7 | 1µs | $$output = $value ; | ||
321 | 7 | 6µs | return 1; | ||
322 | } | ||||
323 | elsif ($type & Parse_unsigned) | ||||
324 | { | ||||
325 | 14 | 2µs | return $self->setError("Parameter '$key' must be an unsigned int, got 'undef'") | ||
326 | if $validate && ! defined $value ; | ||||
327 | 14 | 13µs | 7 | 6µs | return $self->setError("Parameter '$key' must be an unsigned int, got '$value'") # spent 6µs making 7 calls to CORE::match, avg 871ns/call |
328 | if $validate && $value !~ /^\d+$/; | ||||
329 | |||||
330 | 14 | 3µs | $$output = defined $value ? $value : 0 ; | ||
331 | 14 | 10µs | return 1; | ||
332 | } | ||||
333 | elsif ($type & Parse_signed) | ||||
334 | { | ||||
335 | 14 | 3µs | return $self->setError("Parameter '$key' must be a signed int, got 'undef'") | ||
336 | if $validate && ! defined $value ; | ||||
337 | 14 | 20µs | 7 | 12µs | return $self->setError("Parameter '$key' must be a signed int, got '$value'") # spent 12µs making 7 calls to CORE::match, avg 2µs/call |
338 | if $validate && $value !~ /^-?\d+$/; | ||||
339 | |||||
340 | 14 | 4µs | $$output = defined $value ? $value : 0 ; | ||
341 | 14 | 20µs | return 1 ; | ||
342 | } | ||||
343 | elsif ($type & Parse_boolean) | ||||
344 | { | ||||
345 | 35 | 2µs | return $self->setError("Parameter '$key' must be an int, got '$value'") | ||
346 | if $validate && defined $value && $value !~ /^\d*$/; | ||||
347 | 35 | 6µs | $$output = defined $value ? $value != 0 : 0 ; | ||
348 | 35 | 27µs | return 1; | ||
349 | } | ||||
350 | # elsif ($type & Parse_string) | ||||
351 | # { | ||||
352 | # $$output = defined $value ? $value : "" ; | ||||
353 | # return 1; | ||||
354 | # } | ||||
355 | |||||
356 | $$output = $value ; | ||||
357 | return 1; | ||||
358 | } | ||||
359 | |||||
- - | |||||
362 | sub Compress::Raw::Zlib::Parameters::parsed | ||||
363 | { | ||||
364 | my $self = shift ; | ||||
365 | my $name = shift ; | ||||
366 | |||||
367 | return $self->{Got}{lc $name}[OFF_PARSED] ; | ||||
368 | } | ||||
369 | |||||
370 | sub Compress::Raw::Zlib::Parameters::value | ||||
371 | # spent 49µs within Compress::Raw::Zlib::Parameters::value which was called 63 times, avg 778ns/call:
# 14 times (9µs+0s) by Compress::Raw::Zlib::Inflate::new at line 476, avg 629ns/call
# 7 times (12µs+0s) by Compress::Raw::Zlib::Inflate::new at line 460, avg 2µs/call
# 7 times (5µs+0s) by Compress::Raw::Zlib::Inflate::new at line 465, avg 757ns/call
# 7 times (5µs+0s) by Compress::Raw::Zlib::Inflate::new at line 467, avg 700ns/call
# 7 times (5µs+0s) by Compress::Raw::Zlib::Inflate::new at line 466, avg 686ns/call
# 7 times (4µs+0s) by Compress::Raw::Zlib::Inflate::new at line 468, avg 614ns/call
# 7 times (4µs+0s) by Compress::Raw::Zlib::Inflate::new at line 472, avg 614ns/call
# 7 times (4µs+0s) by Compress::Raw::Zlib::Inflate::new at line 469, avg 600ns/call | ||||
372 | 63 | 5µs | my $self = shift ; | ||
373 | 63 | 7µs | my $name = shift ; | ||
374 | |||||
375 | 63 | 5µs | if (@_) | ||
376 | { | ||||
377 | $self->{Got}{lc $name}[OFF_PARSED] = 1; | ||||
378 | $self->{Got}{lc $name}[OFF_DEFAULT] = $_[0] ; | ||||
379 | $self->{Got}{lc $name}[OFF_FIXED] = $_[0] ; | ||||
380 | } | ||||
381 | |||||
382 | 63 | 63µs | return $self->{Got}{lc $name}[OFF_FIXED] ; | ||
383 | } | ||||
384 | |||||
385 | 1 | 10µs | 5 | 35µs | our $OPTIONS_deflate = # spent 35µs making 5 calls to Compress::Raw::Zlib::AUTOLOAD, avg 7µs/call |
386 | { | ||||
387 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||
388 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
389 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
390 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
391 | |||||
392 | 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()], | ||||
393 | 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()], | ||||
394 | 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()], | ||||
395 | 'MemLevel' => [1, 1, Parse_unsigned, MAX_MEM_LEVEL()], | ||||
396 | 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()], | ||||
397 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||
398 | }; | ||||
399 | |||||
400 | sub Compress::Raw::Zlib::Deflate::new | ||||
401 | { | ||||
402 | my $pkg = shift ; | ||||
403 | my ($got) = ParseParameters(0, $OPTIONS_deflate, @_); | ||||
404 | |||||
405 | croak "Compress::Raw::Zlib::Deflate::new: Bufsize must be >= 1, you specified " . | ||||
406 | $got->value('Bufsize') | ||||
407 | unless $got->value('Bufsize') >= 1; | ||||
408 | |||||
409 | my $flags = 0 ; | ||||
410 | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||
411 | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||
412 | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||
413 | |||||
414 | my $windowBits = $got->value('WindowBits'); | ||||
415 | $windowBits += MAX_WBITS() | ||||
416 | if ($windowBits & MAX_WBITS()) == 0 ; | ||||
417 | |||||
418 | _deflateInit($flags, | ||||
419 | $got->value('Level'), | ||||
420 | $got->value('Method'), | ||||
421 | $windowBits, | ||||
422 | $got->value('MemLevel'), | ||||
423 | $got->value('Strategy'), | ||||
424 | $got->value('Bufsize'), | ||||
425 | $got->value('Dictionary')) ; | ||||
426 | |||||
427 | } | ||||
428 | |||||
429 | sub Compress::Raw::Zlib::deflateStream::STORABLE_freeze | ||||
430 | { | ||||
431 | my $type = ref shift; | ||||
432 | croak "Cannot freeze $type object\n"; | ||||
433 | } | ||||
434 | |||||
435 | sub Compress::Raw::Zlib::deflateStream::STORABLE_thaw | ||||
436 | { | ||||
437 | my $type = ref shift; | ||||
438 | croak "Cannot thaw $type object\n"; | ||||
439 | } | ||||
440 | |||||
441 | |||||
442 | 1 | 2µs | 1 | 300ns | our $OPTIONS_inflate = # spent 300ns making 1 call to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:122] |
443 | { | ||||
444 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||
445 | 'LimitOutput' => [1, 1, Parse_boolean, 0], | ||||
446 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
447 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
448 | 'ConsumeInput' => [1, 1, Parse_boolean, 1], | ||||
449 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
450 | |||||
451 | 'WindowBits' => [1, 1, Parse_signed, MAX_WBITS()], | ||||
452 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||
453 | } ; | ||||
454 | |||||
455 | sub Compress::Raw::Zlib::Inflate::new | ||||
456 | # spent 722µs (120+602) within Compress::Raw::Zlib::Inflate::new which was called 7 times, avg 103µs/call:
# 7 times (120µs+602µs) by Archive::Zip::Member::rewindData at line 1225 of Archive/Zip/Member.pm, avg 103µs/call | ||||
457 | 7 | 1µs | my $pkg = shift ; | ||
458 | 7 | 8µs | 7 | 510µs | my ($got) = ParseParameters(0, $OPTIONS_inflate, @_); # spent 510µs making 7 calls to Compress::Raw::Zlib::ParseParameters, avg 73µs/call |
459 | |||||
460 | 7 | 6µs | 7 | 12µs | croak "Compress::Raw::Zlib::Inflate::new: Bufsize must be >= 1, you specified " . # spent 12µs making 7 calls to Compress::Raw::Zlib::Parameters::value, avg 2µs/call |
461 | $got->value('Bufsize') | ||||
462 | unless $got->value('Bufsize') >= 1; | ||||
463 | |||||
464 | 7 | 1µs | my $flags = 0 ; | ||
465 | 7 | 3µs | 7 | 5µs | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; # spent 5µs making 7 calls to Compress::Raw::Zlib::Parameters::value, avg 757ns/call |
466 | 7 | 3µs | 7 | 5µs | $flags |= FLAG_CRC if $got->value('CRC32') ; # spent 5µs making 7 calls to Compress::Raw::Zlib::Parameters::value, avg 686ns/call |
467 | 7 | 4µs | 7 | 5µs | $flags |= FLAG_ADLER if $got->value('ADLER32') ; # spent 5µs making 7 calls to Compress::Raw::Zlib::Parameters::value, avg 700ns/call |
468 | 7 | 5µs | 7 | 4µs | $flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; # spent 4µs making 7 calls to Compress::Raw::Zlib::Parameters::value, avg 614ns/call |
469 | 7 | 3µs | 7 | 4µs | $flags |= FLAG_LIMIT_OUTPUT if $got->value('LimitOutput') ; # spent 4µs making 7 calls to Compress::Raw::Zlib::Parameters::value, avg 600ns/call |
470 | |||||
471 | |||||
472 | 7 | 5µs | 7 | 4µs | my $windowBits = $got->value('WindowBits'); # spent 4µs making 7 calls to Compress::Raw::Zlib::Parameters::value, avg 614ns/call |
473 | 7 | 6µs | 7 | 3µs | $windowBits += MAX_WBITS() # spent 3µs making 7 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:122], avg 486ns/call |
474 | if ($windowBits & MAX_WBITS()) == 0 ; | ||||
475 | |||||
476 | 7 | 80µs | 21 | 48µs | _inflateInit($flags, $windowBits, $got->value('Bufsize'), # spent 40µs making 7 calls to Compress::Raw::Zlib::_inflateInit, avg 6µs/call
# spent 9µs making 14 calls to Compress::Raw::Zlib::Parameters::value, avg 629ns/call |
477 | $got->value('Dictionary')) ; | ||||
478 | } | ||||
479 | |||||
480 | sub Compress::Raw::Zlib::inflateStream::STORABLE_freeze | ||||
481 | { | ||||
482 | my $type = ref shift; | ||||
483 | croak "Cannot freeze $type object\n"; | ||||
484 | } | ||||
485 | |||||
486 | sub Compress::Raw::Zlib::inflateStream::STORABLE_thaw | ||||
487 | { | ||||
488 | my $type = ref shift; | ||||
489 | croak "Cannot thaw $type object\n"; | ||||
490 | } | ||||
491 | |||||
492 | sub Compress::Raw::Zlib::InflateScan::new | ||||
493 | { | ||||
494 | my $pkg = shift ; | ||||
495 | my ($got) = ParseParameters(0, | ||||
496 | { | ||||
497 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
498 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
499 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
500 | |||||
501 | 'WindowBits' => [1, 1, Parse_signed, -MAX_WBITS()], | ||||
502 | 'Dictionary' => [1, 1, Parse_any, ""], | ||||
503 | }, @_) ; | ||||
504 | |||||
505 | |||||
506 | croak "Compress::Raw::Zlib::InflateScan::new: Bufsize must be >= 1, you specified " . | ||||
507 | $got->value('Bufsize') | ||||
508 | unless $got->value('Bufsize') >= 1; | ||||
509 | |||||
510 | my $flags = 0 ; | ||||
511 | #$flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||
512 | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||
513 | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||
514 | #$flags |= FLAG_CONSUME_INPUT if $got->value('ConsumeInput') ; | ||||
515 | |||||
516 | _inflateScanInit($flags, $got->value('WindowBits'), $got->value('Bufsize'), | ||||
517 | '') ; | ||||
518 | } | ||||
519 | |||||
520 | sub Compress::Raw::Zlib::inflateScanStream::createDeflateStream | ||||
521 | { | ||||
522 | my $pkg = shift ; | ||||
523 | my ($got) = ParseParameters(0, | ||||
524 | { | ||||
525 | 'AppendOutput' => [1, 1, Parse_boolean, 0], | ||||
526 | 'CRC32' => [1, 1, Parse_boolean, 0], | ||||
527 | 'ADLER32' => [1, 1, Parse_boolean, 0], | ||||
528 | 'Bufsize' => [1, 1, Parse_unsigned, 4096], | ||||
529 | |||||
530 | 'Level' => [1, 1, Parse_signed, Z_DEFAULT_COMPRESSION()], | ||||
531 | 'Method' => [1, 1, Parse_unsigned, Z_DEFLATED()], | ||||
532 | 'WindowBits' => [1, 1, Parse_signed, - MAX_WBITS()], | ||||
533 | 'MemLevel' => [1, 1, Parse_unsigned, MAX_MEM_LEVEL()], | ||||
534 | 'Strategy' => [1, 1, Parse_unsigned, Z_DEFAULT_STRATEGY()], | ||||
535 | }, @_) ; | ||||
536 | |||||
537 | croak "Compress::Raw::Zlib::InflateScan::createDeflateStream: Bufsize must be >= 1, you specified " . | ||||
538 | $got->value('Bufsize') | ||||
539 | unless $got->value('Bufsize') >= 1; | ||||
540 | |||||
541 | my $flags = 0 ; | ||||
542 | $flags |= FLAG_APPEND if $got->value('AppendOutput') ; | ||||
543 | $flags |= FLAG_CRC if $got->value('CRC32') ; | ||||
544 | $flags |= FLAG_ADLER if $got->value('ADLER32') ; | ||||
545 | |||||
546 | $pkg->_createDeflateStream($flags, | ||||
547 | $got->value('Level'), | ||||
548 | $got->value('Method'), | ||||
549 | $got->value('WindowBits'), | ||||
550 | $got->value('MemLevel'), | ||||
551 | $got->value('Strategy'), | ||||
552 | $got->value('Bufsize'), | ||||
553 | ) ; | ||||
554 | |||||
555 | } | ||||
556 | |||||
557 | sub Compress::Raw::Zlib::inflateScanStream::inflate | ||||
558 | { | ||||
559 | my $self = shift ; | ||||
560 | my $buffer = $_[1]; | ||||
561 | my $eof = $_[2]; | ||||
562 | |||||
563 | my $status = $self->scan(@_); | ||||
564 | |||||
565 | if ($status == Z_OK() && $_[2]) { | ||||
566 | my $byte = ' '; | ||||
567 | |||||
568 | $status = $self->scan(\$byte, $_[1]) ; | ||||
569 | } | ||||
570 | |||||
571 | return $status ; | ||||
572 | } | ||||
573 | |||||
574 | sub Compress::Raw::Zlib::deflateStream::deflateParams | ||||
575 | { | ||||
576 | my $self = shift ; | ||||
577 | my ($got) = ParseParameters(0, { | ||||
578 | 'Level' => [1, 1, Parse_signed, undef], | ||||
579 | 'Strategy' => [1, 1, Parse_unsigned, undef], | ||||
580 | 'Bufsize' => [1, 1, Parse_unsigned, undef], | ||||
581 | }, | ||||
582 | @_) ; | ||||
583 | |||||
584 | croak "Compress::Raw::Zlib::deflateParams needs Level and/or Strategy" | ||||
585 | unless $got->parsed('Level') + $got->parsed('Strategy') + | ||||
586 | $got->parsed('Bufsize'); | ||||
587 | |||||
588 | croak "Compress::Raw::Zlib::Inflate::deflateParams: Bufsize must be >= 1, you specified " . | ||||
589 | $got->value('Bufsize') | ||||
590 | if $got->parsed('Bufsize') && $got->value('Bufsize') <= 1; | ||||
591 | |||||
592 | my $flags = 0; | ||||
593 | $flags |= 1 if $got->parsed('Level') ; | ||||
594 | $flags |= 2 if $got->parsed('Strategy') ; | ||||
595 | $flags |= 4 if $got->parsed('Bufsize') ; | ||||
596 | |||||
597 | $self->_deflateParams($flags, $got->value('Level'), | ||||
598 | $got->value('Strategy'), $got->value('Bufsize')); | ||||
599 | |||||
600 | } | ||||
601 | |||||
602 | |||||
603 | 1 | 13µs | 1; | ||
604 | __END__ | ||||
# spent 40µs within Compress::Raw::Zlib::_inflateInit which was called 7 times, avg 6µs/call:
# 7 times (40µs+0s) by Compress::Raw::Zlib::Inflate::new at line 476, avg 6µs/call | |||||
# spent 4µs within Compress::Raw::Zlib::constant which was called 7 times, avg 600ns/call:
# 7 times (4µs+0s) by Compress::Raw::Zlib::AUTOLOAD at line 119, avg 600ns/call | |||||
# spent 25µs within Compress::Raw::Zlib::inflateStream::DESTROY which was called 7 times, avg 4µs/call:
# 7 times (25µs+0s) by Archive::Zip::Member::endRead at line 1255 of Archive/Zip/Member.pm, avg 4µs/call | |||||
# spent 12.1ms within Compress::Raw::Zlib::inflateStream::inflate which was called 7 times, avg 1.73ms/call:
# 7 times (12.1ms+0s) by Archive::Zip::Member::_inflateChunk at line 1183 of Archive/Zip/Member.pm, avg 1.73ms/call |