| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/IO/Compress/RawDeflate.pm |
| Statements | Executed 42 statements in 797µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.29ms | 8.67ms | IO::Compress::RawDeflate::BEGIN@9 |
| 1 | 1 | 1 | 457µs | 3.20ms | IO::Compress::RawDeflate::BEGIN@11 |
| 1 | 1 | 1 | 9µs | 87µs | IO::Compress::RawDeflate::BEGIN@119 |
| 1 | 1 | 1 | 8µs | 109µs | IO::Compress::RawDeflate::BEGIN@10 |
| 1 | 1 | 1 | 7µs | 29µs | IO::Compress::RawDeflate::BEGIN@120 |
| 1 | 1 | 1 | 7µs | 8µs | IO::Compress::RawDeflate::BEGIN@5 |
| 1 | 1 | 1 | 6µs | 8µs | IO::Compress::RawDeflate::BEGIN@6 |
| 1 | 1 | 1 | 5µs | 18µs | IO::Compress::RawDeflate::BEGIN@150 |
| 1 | 1 | 1 | 5µs | 5µs | IO::Compress::RawDeflate::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::ckParams |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::createMerge |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::deflateParams |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::getExtraParams |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::getFileInfo |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::getInverseClass |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::getZlibParams |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::mkComp |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::mkFinalTrailer |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::mkHeader |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::mkTrailer |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::new |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::RawDeflate::rawdeflate |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package IO::Compress::RawDeflate ; | ||||
| 2 | |||||
| 3 | # create RFC1951 | ||||
| 4 | # | ||||
| 5 | 2 | 16µs | 2 | 9µs | # spent 8µs (7+1000ns) within IO::Compress::RawDeflate::BEGIN@5 which was called:
# once (7µs+1000ns) by IO::Compress::Deflate::BEGIN@11 at line 5 # spent 8µs making 1 call to IO::Compress::RawDeflate::BEGIN@5
# spent 1µs making 1 call to strict::import |
| 6 | 2 | 10µs | 2 | 10µs | # spent 8µs (6+2) within IO::Compress::RawDeflate::BEGIN@6 which was called:
# once (6µs+2µs) by IO::Compress::Deflate::BEGIN@11 at line 6 # spent 8µs making 1 call to IO::Compress::RawDeflate::BEGIN@6
# spent 2µs making 1 call to warnings::import |
| 7 | 2 | 13µs | 2 | 6µs | # spent 5µs (5+400ns) within IO::Compress::RawDeflate::BEGIN@7 which was called:
# once (5µs+400ns) by IO::Compress::Deflate::BEGIN@11 at line 7 # spent 5µs making 1 call to IO::Compress::RawDeflate::BEGIN@7
# spent 400ns making 1 call to bytes::import |
| 8 | |||||
| 9 | 3 | 76µs | 3 | 8.70ms | # spent 8.67ms (2.29+6.39) within IO::Compress::RawDeflate::BEGIN@9 which was called:
# once (2.29ms+6.39ms) by IO::Compress::Deflate::BEGIN@11 at line 9 # spent 8.67ms making 1 call to IO::Compress::RawDeflate::BEGIN@9
# spent 21µs making 1 call to Exporter::import
# spent 4µs making 1 call to UNIVERSAL::VERSION |
| 10 | 3 | 28µs | 3 | 211µs | # spent 109µs (8+102) within IO::Compress::RawDeflate::BEGIN@10 which was called:
# once (8µs+102µs) by IO::Compress::Deflate::BEGIN@11 at line 10 # spent 109µs making 1 call to IO::Compress::RawDeflate::BEGIN@10
# spent 98µs making 1 call to Exporter::import
# spent 4µs making 1 call to UNIVERSAL::VERSION |
| 11 | 3 | 292µs | 3 | 3.30ms | # spent 3.20ms (457µs+2.74) within IO::Compress::RawDeflate::BEGIN@11 which was called:
# once (457µs+2.74ms) by IO::Compress::Deflate::BEGIN@11 at line 11 # spent 3.20ms making 1 call to IO::Compress::RawDeflate::BEGIN@11
# spent 92µs making 1 call to Exporter::import
# spent 6µs making 1 call to UNIVERSAL::VERSION |
| 12 | |||||
| 13 | 1 | 300ns | require Exporter ; | ||
| 14 | |||||
| 15 | our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); | ||||
| 16 | |||||
| 17 | 1 | 300ns | $VERSION = '2.068'; | ||
| 18 | 1 | 100ns | $RawDeflateError = ''; | ||
| 19 | |||||
| 20 | 1 | 5µs | @ISA = qw(Exporter IO::Compress::Base); | ||
| 21 | 1 | 400ns | @EXPORT_OK = qw( $RawDeflateError rawdeflate ) ; | ||
| 22 | 1 | 2µs | push @EXPORT_OK, @IO::Compress::Adapter::Deflate::EXPORT_OK ; | ||
| 23 | |||||
| 24 | 1 | 2µs | %EXPORT_TAGS = %IO::Compress::Adapter::Deflate::DEFLATE_CONSTANTS; | ||
| 25 | |||||
| 26 | |||||
| 27 | { | ||||
| 28 | 2 | 300ns | my %seen; | ||
| 29 | 1 | 900ns | foreach (keys %EXPORT_TAGS ) | ||
| 30 | { | ||||
| 31 | push @{$EXPORT_TAGS{constants}}, | ||||
| 32 | grep { !$seen{$_}++ } | ||||
| 33 | 4 | 11µs | @{ $EXPORT_TAGS{$_} } | ||
| 34 | } | ||||
| 35 | 1 | 1µs | $EXPORT_TAGS{all} = $EXPORT_TAGS{constants} ; | ||
| 36 | } | ||||
| 37 | |||||
| 38 | |||||
| 39 | 1 | 1µs | %DEFLATE_CONSTANTS = %EXPORT_TAGS; | ||
| 40 | |||||
| 41 | #push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; | ||||
| 42 | |||||
| 43 | 1 | 2µs | 1 | 13µs | Exporter::export_ok_tags('all'); # spent 13µs making 1 call to Exporter::export_ok_tags |
| 44 | |||||
| 45 | |||||
| 46 | |||||
| 47 | sub new | ||||
| 48 | { | ||||
| 49 | my $class = shift ; | ||||
| 50 | |||||
| 51 | my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$RawDeflateError); | ||||
| 52 | |||||
| 53 | return $obj->_create(undef, @_); | ||||
| 54 | } | ||||
| 55 | |||||
| 56 | sub rawdeflate | ||||
| 57 | { | ||||
| 58 | my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$RawDeflateError); | ||||
| 59 | return $obj->_def(@_); | ||||
| 60 | } | ||||
| 61 | |||||
| 62 | sub ckParams | ||||
| 63 | { | ||||
| 64 | my $self = shift ; | ||||
| 65 | my $got = shift; | ||||
| 66 | |||||
| 67 | return 1 ; | ||||
| 68 | } | ||||
| 69 | |||||
| 70 | sub mkComp | ||||
| 71 | { | ||||
| 72 | my $self = shift ; | ||||
| 73 | my $got = shift ; | ||||
| 74 | |||||
| 75 | my ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject( | ||||
| 76 | $got->getValue('crc32'), | ||||
| 77 | $got->getValue('adler32'), | ||||
| 78 | $got->getValue('level'), | ||||
| 79 | $got->getValue('strategy') | ||||
| 80 | ); | ||||
| 81 | |||||
| 82 | return $self->saveErrorString(undef, $errstr, $errno) | ||||
| 83 | if ! defined $obj; | ||||
| 84 | |||||
| 85 | return $obj; | ||||
| 86 | } | ||||
| 87 | |||||
| 88 | |||||
| 89 | sub mkHeader | ||||
| 90 | { | ||||
| 91 | my $self = shift ; | ||||
| 92 | return ''; | ||||
| 93 | } | ||||
| 94 | |||||
| 95 | sub mkTrailer | ||||
| 96 | { | ||||
| 97 | my $self = shift ; | ||||
| 98 | return ''; | ||||
| 99 | } | ||||
| 100 | |||||
| 101 | sub mkFinalTrailer | ||||
| 102 | { | ||||
| 103 | return ''; | ||||
| 104 | } | ||||
| 105 | |||||
| 106 | |||||
| 107 | #sub newHeader | ||||
| 108 | #{ | ||||
| 109 | # my $self = shift ; | ||||
| 110 | # return ''; | ||||
| 111 | #} | ||||
| 112 | |||||
| 113 | sub getExtraParams | ||||
| 114 | { | ||||
| 115 | my $self = shift ; | ||||
| 116 | return getZlibParams(); | ||||
| 117 | } | ||||
| 118 | |||||
| 119 | 3 | 33µs | 3 | 165µs | # spent 87µs (9+78) within IO::Compress::RawDeflate::BEGIN@119 which was called:
# once (9µs+78µs) by IO::Compress::Deflate::BEGIN@11 at line 119 # spent 87µs making 1 call to IO::Compress::RawDeflate::BEGIN@119
# spent 72µs making 1 call to Exporter::import
# spent 5µs making 1 call to UNIVERSAL::VERSION |
| 120 | 3 | 89µs | 3 | 51µs | # spent 29µs (7+22) within IO::Compress::RawDeflate::BEGIN@120 which was called:
# once (7µs+22µs) by IO::Compress::Deflate::BEGIN@11 at line 120 # spent 29µs making 1 call to IO::Compress::RawDeflate::BEGIN@120
# spent 17µs making 1 call to Exporter::import
# spent 5µs making 1 call to UNIVERSAL::VERSION |
| 121 | 1 | 4µs | 2 | 900ns | our %PARAMS = ( # spent 900ns making 2 calls to Compress::Raw::Zlib::__ANON__[Compress/Raw/Zlib.pm:114], avg 450ns/call |
| 122 | #'method' => [IO::Compress::Base::Common::Parse_unsigned, Z_DEFLATED], | ||||
| 123 | 'level' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_COMPRESSION], | ||||
| 124 | 'strategy' => [IO::Compress::Base::Common::Parse_signed, Z_DEFAULT_STRATEGY], | ||||
| 125 | |||||
| 126 | 'crc32' => [IO::Compress::Base::Common::Parse_boolean, 0], | ||||
| 127 | 'adler32' => [IO::Compress::Base::Common::Parse_boolean, 0], | ||||
| 128 | 'merge' => [IO::Compress::Base::Common::Parse_boolean, 0], | ||||
| 129 | ); | ||||
| 130 | |||||
| 131 | sub getZlibParams | ||||
| 132 | { | ||||
| 133 | return %PARAMS; | ||||
| 134 | } | ||||
| 135 | |||||
| 136 | sub getInverseClass | ||||
| 137 | { | ||||
| 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 | 201µs | 2 | 31µs | # spent 18µs (5+13) within IO::Compress::RawDeflate::BEGIN@150 which was called:
# once (5µs+13µs) by IO::Compress::Deflate::BEGIN@11 at line 150 # spent 18µs making 1 call to IO::Compress::RawDeflate::BEGIN@150
# spent 13µ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} = new U64(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 | 8µs | 1; | ||
| 220 | |||||
| 221 | __END__ |