Filename | /Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/IO/Compress/RawDeflate.pm |
Statements | Executed 41 statements in 2.78ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 4.97ms | 22.5ms | BEGIN@9 | IO::Compress::RawDeflate::
1 | 1 | 1 | 1.45ms | 8.99ms | BEGIN@11 | IO::Compress::RawDeflate::
1 | 1 | 1 | 24µs | 26µs | BEGIN@5 | IO::Compress::RawDeflate::
1 | 1 | 1 | 18µs | 60µs | BEGIN@137 | IO::Compress::RawDeflate::
1 | 1 | 1 | 15µs | 42µs | BEGIN@12 | IO::Compress::RawDeflate::
1 | 1 | 1 | 12µs | 224µs | BEGIN@10 | IO::Compress::RawDeflate::
1 | 1 | 1 | 7µs | 31µs | BEGIN@150 | IO::Compress::RawDeflate::
1 | 1 | 1 | 4µs | 18µs | BEGIN@6 | IO::Compress::RawDeflate::
1 | 1 | 1 | 3µs | 5µs | BEGIN@7 | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | ckParams | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | createMerge | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | deflateParams | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | getExtraParams | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | getFileInfo | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | getInverseClass | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | getZlibParams | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | mkComp | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | mkFinalTrailer | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | mkHeader | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | mkTrailer | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | new | IO::Compress::RawDeflate::
0 | 0 | 0 | 0s | 0s | rawdeflate | IO::Compress::RawDeflate::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package IO::Compress::RawDeflate ; | ||||
2 | |||||
3 | # create RFC1951 | ||||
4 | # | ||||
5 | 2 | 24µs | 2 | 28µs | # spent 26µs (24+2) within IO::Compress::RawDeflate::BEGIN@5 which was called:
# once (24µs+2µs) by IO::Compress::Gzip::BEGIN@11 at line 5 # spent 26µs making 1 call to IO::Compress::RawDeflate::BEGIN@5
# spent 2µs making 1 call to strict::import |
6 | 2 | 16µs | 2 | 32µs | # spent 18µs (4+14) within IO::Compress::RawDeflate::BEGIN@6 which was called:
# once (4µs+14µs) by IO::Compress::Gzip::BEGIN@11 at line 6 # spent 18µs making 1 call to IO::Compress::RawDeflate::BEGIN@6
# spent 14µs making 1 call to warnings::import |
7 | 2 | 16µs | 2 | 7µs | # spent 5µs (3+2) within IO::Compress::RawDeflate::BEGIN@7 which was called:
# once (3µs+2µs) by IO::Compress::Gzip::BEGIN@11 at line 7 # spent 5µs making 1 call to IO::Compress::RawDeflate::BEGIN@7
# spent 2µs making 1 call to bytes::import |
8 | |||||
9 | 3 | 617µs | 3 | 22.6ms | # spent 22.5ms (4.97+17.6) within IO::Compress::RawDeflate::BEGIN@9 which was called:
# once (4.97ms+17.6ms) by IO::Compress::Gzip::BEGIN@11 at line 9 # spent 22.5ms making 1 call to IO::Compress::RawDeflate::BEGIN@9
# spent 24µs making 1 call to Exporter::import
# spent 6µs making 1 call to UNIVERSAL::VERSION |
10 | 3 | 43µs | 3 | 436µs | # spent 224µs (12+212) within IO::Compress::RawDeflate::BEGIN@10 which was called:
# once (12µs+212µs) by IO::Compress::Gzip::BEGIN@11 at line 10 # spent 224µs making 1 call to IO::Compress::RawDeflate::BEGIN@10
# spent 207µs making 1 call to Exporter::import
# spent 5µs making 1 call to UNIVERSAL::VERSION |
11 | 3 | 744µs | 3 | 9.15ms | # spent 8.99ms (1.45+7.54) within IO::Compress::RawDeflate::BEGIN@11 which was called:
# once (1.45ms+7.54ms) by IO::Compress::Gzip::BEGIN@11 at line 11 # spent 8.99ms making 1 call to IO::Compress::RawDeflate::BEGIN@11
# spent 153µs making 1 call to Exporter::import
# spent 9µs making 1 call to UNIVERSAL::VERSION |
12 | 3 | 721µs | 3 | 69µs | # spent 42µs (15+27) within IO::Compress::RawDeflate::BEGIN@12 which was called:
# once (15µs+27µs) by IO::Compress::Gzip::BEGIN@11 at line 12 # spent 42µs making 1 call to IO::Compress::RawDeflate::BEGIN@12
# spent 22µs making 1 call to Exporter::import
# spent 5µs making 1 call to UNIVERSAL::VERSION |
13 | |||||
14 | 1 | 1µs | require Exporter ; | ||
15 | |||||
16 | our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); | ||||
17 | |||||
18 | 1 | 1µs | $VERSION = '2.106'; | ||
19 | 1 | 0s | $RawDeflateError = ''; | ||
20 | |||||
21 | 1 | 13µs | @ISA = qw(IO::Compress::Base Exporter); | ||
22 | 1 | 5µs | @EXPORT_OK = qw( $RawDeflateError rawdeflate ) ; | ||
23 | 1 | 7µs | push @EXPORT_OK, @IO::Compress::Adapter::Deflate::EXPORT_OK ; | ||
24 | |||||
25 | 1 | 2µs | %EXPORT_TAGS = %IO::Compress::Adapter::Deflate::DEFLATE_CONSTANTS; | ||
26 | |||||
27 | |||||
28 | { | ||||
29 | 2 | 0s | my %seen; | ||
30 | 1 | 1µs | foreach (keys %EXPORT_TAGS ) | ||
31 | { | ||||
32 | push @{$EXPORT_TAGS{constants}}, | ||||
33 | grep { !$seen{$_}++ } | ||||
34 | 4 | 57µs | @{ $EXPORT_TAGS{$_} } | ||
35 | } | ||||
36 | 1 | 3µs | $EXPORT_TAGS{all} = $EXPORT_TAGS{constants} ; | ||
37 | } | ||||
38 | |||||
39 | |||||
40 | 1 | 3µs | %DEFLATE_CONSTANTS = %EXPORT_TAGS; | ||
41 | |||||
42 | #push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; | ||||
43 | |||||
44 | 1 | 3µs | 1 | 28µs | Exporter::export_ok_tags('all'); # spent 28µs making 1 call to Exporter::export_ok_tags |
45 | |||||
- - | |||||
48 | sub new | ||||
49 | { | ||||
50 | my $class = shift ; | ||||
51 | |||||
52 | my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$RawDeflateError); | ||||
53 | |||||
54 | return $obj->_create(undef, @_); | ||||
55 | } | ||||
56 | |||||
57 | sub rawdeflate | ||||
58 | { | ||||
59 | my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$RawDeflateError); | ||||
60 | return $obj->_def(@_); | ||||
61 | } | ||||
62 | |||||
63 | sub ckParams | ||||
64 | { | ||||
65 | my $self = shift ; | ||||
66 | my $got = shift; | ||||
67 | |||||
68 | return 1 ; | ||||
69 | } | ||||
70 | |||||
71 | sub mkComp | ||||
72 | { | ||||
73 | my $self = shift ; | ||||
74 | my $got = shift ; | ||||
75 | |||||
76 | my ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject( | ||||
77 | $got->getValue('crc32'), | ||||
78 | $got->getValue('adler32'), | ||||
79 | $got->getValue('level'), | ||||
80 | $got->getValue('strategy') | ||||
81 | ); | ||||
82 | |||||
83 | return $self->saveErrorString(undef, $errstr, $errno) | ||||
84 | if ! defined $obj; | ||||
85 | |||||
86 | return $obj; | ||||
87 | } | ||||
88 | |||||
89 | |||||
90 | sub mkHeader | ||||
91 | { | ||||
92 | my $self = shift ; | ||||
93 | return ''; | ||||
94 | } | ||||
95 | |||||
96 | sub mkTrailer | ||||
97 | { | ||||
98 | my $self = shift ; | ||||
99 | return ''; | ||||
100 | } | ||||
101 | |||||
102 | sub mkFinalTrailer | ||||
103 | { | ||||
104 | return ''; | ||||
105 | } | ||||
106 | |||||
107 | |||||
108 | #sub newHeader | ||||
109 | #{ | ||||
110 | # my $self = shift ; | ||||
111 | # return ''; | ||||
112 | #} | ||||
113 | |||||
114 | sub getExtraParams | ||||
115 | { | ||||
116 | my $self = shift ; | ||||
117 | return getZlibParams(); | ||||
118 | } | ||||
119 | |||||
120 | 1 | 6µs | 2 | 2µs | our %PARAMS = ( # spent 2µs making 2 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:114], avg 1µs/call |
121 | #'method' => [IO::Compress::Base::Common::Parse_unsigned, Z_DEFLATED], | ||||
122 | 'level' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_COMPRESSION], | ||||
123 | 'strategy' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_STRATEGY], | ||||
124 | |||||
125 | 'crc32' => [IO::Compress::Base::Common::Parse_boolean, 0], | ||||
126 | 'adler32' => [IO::Compress::Base::Common::Parse_boolean, 0], | ||||
127 | 'merge' => [IO::Compress::Base::Common::Parse_boolean, 0], | ||||
128 | ); | ||||
129 | |||||
130 | sub getZlibParams | ||||
131 | { | ||||
132 | return %PARAMS; | ||||
133 | } | ||||
134 | |||||
135 | sub getInverseClass | ||||
136 | { | ||||
137 | 2 | 99µs | 2 | 102µs | # spent 60µs (18+42) within IO::Compress::RawDeflate::BEGIN@137 which was called:
# once (18µs+42µs) by IO::Compress::Gzip::BEGIN@11 at line 137 # spent 60µs making 1 call to IO::Compress::RawDeflate::BEGIN@137
# spent 42µs making 1 call to warnings::unimport |
138 | return ('IO::Uncompress::RawInflate', | ||||
139 | \$IO::Uncompress::RawInflate::RawInflateError); | ||||
140 | } | ||||
141 | |||||
142 | sub getFileInfo | ||||
143 | { | ||||
144 | my $self = shift ; | ||||
145 | my $params = shift; | ||||
146 | my $file = shift ; | ||||
147 | |||||
148 | } | ||||
149 | |||||
150 | 2 | 385µs | 2 | 55µs | # spent 31µs (7+24) within IO::Compress::RawDeflate::BEGIN@150 which was called:
# once (7µs+24µs) by IO::Compress::Gzip::BEGIN@11 at line 150 # spent 31µs making 1 call to IO::Compress::RawDeflate::BEGIN@150
# spent 24µs making 1 call to Exporter::import |
151 | |||||
152 | sub createMerge | ||||
153 | { | ||||
154 | my $self = shift ; | ||||
155 | my $outValue = shift ; | ||||
156 | my $outType = shift ; | ||||
157 | |||||
158 | my ($invClass, $error_ref) = $self->getInverseClass(); | ||||
159 | eval "require $invClass" | ||||
160 | or die "aaaahhhh" ; | ||||
161 | |||||
162 | my $inf = $invClass->new( $outValue, | ||||
163 | Transparent => 0, | ||||
164 | #Strict => 1, | ||||
165 | AutoClose => 0, | ||||
166 | Scan => 1) | ||||
167 | or return $self->saveErrorString(undef, "Cannot create InflateScan object: $$error_ref" ) ; | ||||
168 | |||||
169 | my $end_offset = 0; | ||||
170 | $inf->scan() | ||||
171 | or return $self->saveErrorString(undef, "Error Scanning: $$error_ref", $inf->errorNo) ; | ||||
172 | $inf->zap($end_offset) | ||||
173 | or return $self->saveErrorString(undef, "Error Zapping: $$error_ref", $inf->errorNo) ; | ||||
174 | |||||
175 | my $def = *$self->{Compress} = $inf->createDeflate(); | ||||
176 | |||||
177 | *$self->{Header} = *$inf->{Info}{Header}; | ||||
178 | *$self->{UnCompSize} = *$inf->{UnCompSize}->clone(); | ||||
179 | *$self->{CompSize} = *$inf->{CompSize}->clone(); | ||||
180 | # TODO -- fix this | ||||
181 | #*$self->{CompSize} = U64->new(0, *$self->{UnCompSize_32bit}); | ||||
182 | |||||
183 | |||||
184 | if ( $outType eq 'buffer') | ||||
185 | { substr( ${ *$self->{Buffer} }, $end_offset) = '' } | ||||
186 | elsif ($outType eq 'handle' || $outType eq 'filename') { | ||||
187 | *$self->{FH} = *$inf->{FH} ; | ||||
188 | delete *$inf->{FH}; | ||||
189 | *$self->{FH}->flush() ; | ||||
190 | *$self->{Handle} = 1 if $outType eq 'handle'; | ||||
191 | |||||
192 | #seek(*$self->{FH}, $end_offset, SEEK_SET) | ||||
193 | *$self->{FH}->seek($end_offset, SEEK_SET) | ||||
194 | or return $self->saveErrorString(undef, $!, $!) ; | ||||
195 | } | ||||
196 | |||||
197 | return $def ; | ||||
198 | } | ||||
199 | |||||
200 | #### zlib specific methods | ||||
201 | |||||
202 | sub deflateParams | ||||
203 | { | ||||
204 | my $self = shift ; | ||||
205 | |||||
206 | my $level = shift ; | ||||
207 | my $strategy = shift ; | ||||
208 | |||||
209 | my $status = *$self->{Compress}->deflateParams(Level => $level, Strategy => $strategy) ; | ||||
210 | return $self->saveErrorString(0, *$self->{Compress}{Error}, *$self->{Compress}{ErrorNo}) | ||||
211 | if $status == STATUS_ERROR; | ||||
212 | |||||
213 | return 1; | ||||
214 | } | ||||
215 | |||||
- - | |||||
219 | 1 | 15µs | 1; | ||
220 | |||||
221 | __END__ |