| Filename | /usr/lib/perl/5.10/IO/Compress/RawDeflate.pm |
| Statements | Executed 45 statements in 1.78ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 4.62ms | 5.57ms | IO::Compress::RawDeflate::BEGIN@10 |
| 1 | 1 | 1 | 930µs | 1.37ms | IO::Compress::RawDeflate::BEGIN@12 |
| 1 | 1 | 1 | 24µs | 338µs | IO::Compress::RawDeflate::BEGIN@11 |
| 1 | 1 | 1 | 20µs | 211µs | IO::Compress::RawDeflate::BEGIN@145 |
| 1 | 1 | 1 | 19µs | 24µs | IO::Compress::RawDeflate::BEGIN@7 |
| 1 | 1 | 1 | 18µs | 21µs | IO::Compress::RawDeflate::BEGIN@5 |
| 1 | 1 | 1 | 16µs | 71µs | IO::Compress::RawDeflate::BEGIN@178 |
| 1 | 1 | 1 | 15µs | 79µs | IO::Compress::RawDeflate::BEGIN@146 |
| 1 | 1 | 1 | 9µs | 21µs | IO::Compress::RawDeflate::BEGIN@6 |
| 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 | 3 | 27µs | 2 | 25µs | # spent 21µs (18+4) within IO::Compress::RawDeflate::BEGIN@5 which was called:
# once (18µs+4µs) by IO::Compress::Gzip::BEGIN@11 at line 5 # spent 21µs making 1 call to IO::Compress::RawDeflate::BEGIN@5
# spent 4µs making 1 call to strict::import |
| 6 | 3 | 54µs | 2 | 33µs | # spent 21µs (9+12) within IO::Compress::RawDeflate::BEGIN@6 which was called:
# once (9µs+12µs) by IO::Compress::Gzip::BEGIN@11 at line 6 # spent 21µs making 1 call to IO::Compress::RawDeflate::BEGIN@6
# spent 12µs making 1 call to warnings::import |
| 7 | 3 | 45µs | 2 | 30µs | # spent 24µs (19+6) within IO::Compress::RawDeflate::BEGIN@7 which was called:
# once (19µs+6µs) by IO::Compress::Gzip::BEGIN@11 at line 7 # spent 24µs making 1 call to IO::Compress::RawDeflate::BEGIN@7
# spent 6µs making 1 call to bytes::import |
| 8 | |||||
| 9 | |||||
| 10 | 3 | 170µs | 3 | 5.60ms | # spent 5.57ms (4.62+941µs) within IO::Compress::RawDeflate::BEGIN@10 which was called:
# once (4.62ms+941µs) by IO::Compress::Gzip::BEGIN@11 at line 10 # spent 5.57ms making 1 call to IO::Compress::RawDeflate::BEGIN@10
# spent 25µs making 1 call to Exporter::import
# spent 12µs making 1 call to UNIVERSAL::VERSION |
| 11 | 3 | 79µs | 3 | 652µs | # spent 338µs (24+314) within IO::Compress::RawDeflate::BEGIN@11 which was called:
# once (24µs+314µs) by IO::Compress::Gzip::BEGIN@11 at line 11 # spent 338µs making 1 call to IO::Compress::RawDeflate::BEGIN@11
# spent 289µs making 1 call to Exporter::import
# spent 25µs making 1 call to UNIVERSAL::VERSION |
| 12 | 3 | 678µs | 2 | 1.39ms | # spent 1.37ms (930µs+444µs) within IO::Compress::RawDeflate::BEGIN@12 which was called:
# once (930µs+444µs) by IO::Compress::Gzip::BEGIN@11 at line 12 # spent 1.37ms making 1 call to IO::Compress::RawDeflate::BEGIN@12
# spent 16µs making 1 call to UNIVERSAL::VERSION |
| 13 | |||||
| 14 | 1 | 900ns | require Exporter ; | ||
| 15 | |||||
| 16 | |||||
| 17 | 1 | 1µs | our ($VERSION, @ISA, @EXPORT_OK, %DEFLATE_CONSTANTS, %EXPORT_TAGS, $RawDeflateError); | ||
| 18 | |||||
| 19 | 1 | 700ns | $VERSION = '2.020'; | ||
| 20 | 1 | 300ns | $RawDeflateError = ''; | ||
| 21 | |||||
| 22 | 1 | 17µs | @ISA = qw(Exporter IO::Compress::Base); | ||
| 23 | 1 | 800ns | @EXPORT_OK = qw( $RawDeflateError rawdeflate ) ; | ||
| 24 | |||||
| 25 | 1 | 5µs | %EXPORT_TAGS = ( flush => [qw{ | ||
| 26 | Z_NO_FLUSH | ||||
| 27 | Z_PARTIAL_FLUSH | ||||
| 28 | Z_SYNC_FLUSH | ||||
| 29 | Z_FULL_FLUSH | ||||
| 30 | Z_FINISH | ||||
| 31 | Z_BLOCK | ||||
| 32 | }], | ||||
| 33 | level => [qw{ | ||||
| 34 | Z_NO_COMPRESSION | ||||
| 35 | Z_BEST_SPEED | ||||
| 36 | Z_BEST_COMPRESSION | ||||
| 37 | Z_DEFAULT_COMPRESSION | ||||
| 38 | }], | ||||
| 39 | strategy => [qw{ | ||||
| 40 | Z_FILTERED | ||||
| 41 | Z_HUFFMAN_ONLY | ||||
| 42 | Z_RLE | ||||
| 43 | Z_FIXED | ||||
| 44 | Z_DEFAULT_STRATEGY | ||||
| 45 | }], | ||||
| 46 | |||||
| 47 | ); | ||||
| 48 | |||||
| 49 | { | ||||
| 50 | 4 | 5µs | my %seen; | ||
| 51 | foreach (keys %EXPORT_TAGS ) | ||||
| 52 | { | ||||
| 53 | push @{$EXPORT_TAGS{constants}}, | ||||
| 54 | grep { !$seen{$_}++ } | ||||
| 55 | 3 | 14µs | @{ $EXPORT_TAGS{$_} } | ||
| 56 | } | ||||
| 57 | $EXPORT_TAGS{all} = $EXPORT_TAGS{constants} ; | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | |||||
| 61 | 1 | 2µs | %DEFLATE_CONSTANTS = %EXPORT_TAGS; | ||
| 62 | |||||
| 63 | 1 | 900ns | push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; | ||
| 64 | |||||
| 65 | 1 | 4µs | 1 | 25µs | Exporter::export_ok_tags('all'); # spent 25µs making 1 call to Exporter::export_ok_tags |
| 66 | |||||
| 67 | |||||
| 68 | |||||
| 69 | sub new | ||||
| 70 | { | ||||
| 71 | my $class = shift ; | ||||
| 72 | |||||
| 73 | my $obj = createSelfTiedObject($class, \$RawDeflateError); | ||||
| 74 | |||||
| 75 | return $obj->_create(undef, @_); | ||||
| 76 | } | ||||
| 77 | |||||
| 78 | sub rawdeflate | ||||
| 79 | { | ||||
| 80 | my $obj = createSelfTiedObject(undef, \$RawDeflateError); | ||||
| 81 | return $obj->_def(@_); | ||||
| 82 | } | ||||
| 83 | |||||
| 84 | sub ckParams | ||||
| 85 | { | ||||
| 86 | my $self = shift ; | ||||
| 87 | my $got = shift; | ||||
| 88 | |||||
| 89 | return 1 ; | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | sub mkComp | ||||
| 93 | { | ||||
| 94 | my $self = shift ; | ||||
| 95 | my $got = shift ; | ||||
| 96 | |||||
| 97 | my ($obj, $errstr, $errno) = IO::Compress::Adapter::Deflate::mkCompObject( | ||||
| 98 | $got->value('CRC32'), | ||||
| 99 | $got->value('Adler32'), | ||||
| 100 | $got->value('Level'), | ||||
| 101 | $got->value('Strategy') | ||||
| 102 | ); | ||||
| 103 | |||||
| 104 | return $self->saveErrorString(undef, $errstr, $errno) | ||||
| 105 | if ! defined $obj; | ||||
| 106 | |||||
| 107 | return $obj; | ||||
| 108 | } | ||||
| 109 | |||||
| 110 | |||||
| 111 | sub mkHeader | ||||
| 112 | { | ||||
| 113 | my $self = shift ; | ||||
| 114 | return ''; | ||||
| 115 | } | ||||
| 116 | |||||
| 117 | sub mkTrailer | ||||
| 118 | { | ||||
| 119 | my $self = shift ; | ||||
| 120 | return ''; | ||||
| 121 | } | ||||
| 122 | |||||
| 123 | sub mkFinalTrailer | ||||
| 124 | { | ||||
| 125 | return ''; | ||||
| 126 | } | ||||
| 127 | |||||
| 128 | |||||
| 129 | #sub newHeader | ||||
| 130 | #{ | ||||
| 131 | # my $self = shift ; | ||||
| 132 | # return ''; | ||||
| 133 | #} | ||||
| 134 | |||||
| 135 | sub getExtraParams | ||||
| 136 | { | ||||
| 137 | my $self = shift ; | ||||
| 138 | return $self->getZlibParams(); | ||||
| 139 | } | ||||
| 140 | |||||
| 141 | sub getZlibParams | ||||
| 142 | { | ||||
| 143 | my $self = shift ; | ||||
| 144 | |||||
| 145 | 3 | 67µs | 3 | 401µs | # spent 211µs (20+191) within IO::Compress::RawDeflate::BEGIN@145 which was called:
# once (20µs+191µs) by IO::Compress::Gzip::BEGIN@11 at line 145 # spent 211µs making 1 call to IO::Compress::RawDeflate::BEGIN@145
# spent 175µs making 1 call to Exporter::import
# spent 15µs making 1 call to UNIVERSAL::VERSION |
| 146 | 3 | 202µs | 3 | 142µs | # spent 79µs (15+63) within IO::Compress::RawDeflate::BEGIN@146 which was called:
# once (15µs+63µs) by IO::Compress::Gzip::BEGIN@11 at line 146 # spent 79µs making 1 call to IO::Compress::RawDeflate::BEGIN@146
# spent 49µs making 1 call to Exporter::import
# spent 15µs making 1 call to UNIVERSAL::VERSION |
| 147 | |||||
| 148 | |||||
| 149 | return ( | ||||
| 150 | |||||
| 151 | # zlib behaviour | ||||
| 152 | #'Method' => [0, 1, Parse_unsigned, Z_DEFLATED], | ||||
| 153 | 'Level' => [0, 1, Parse_signed, Z_DEFAULT_COMPRESSION], | ||||
| 154 | 'Strategy' => [0, 1, Parse_signed, Z_DEFAULT_STRATEGY], | ||||
| 155 | |||||
| 156 | 'CRC32' => [0, 1, Parse_boolean, 0], | ||||
| 157 | 'ADLER32' => [0, 1, Parse_boolean, 0], | ||||
| 158 | 'Merge' => [1, 1, Parse_boolean, 0], | ||||
| 159 | ); | ||||
| 160 | |||||
| 161 | |||||
| 162 | } | ||||
| 163 | |||||
| 164 | sub getInverseClass | ||||
| 165 | { | ||||
| 166 | return ('IO::Uncompress::RawInflate', | ||||
| 167 | \$IO::Uncompress::RawInflate::RawInflateError); | ||||
| 168 | } | ||||
| 169 | |||||
| 170 | sub getFileInfo | ||||
| 171 | { | ||||
| 172 | my $self = shift ; | ||||
| 173 | my $params = shift; | ||||
| 174 | my $file = shift ; | ||||
| 175 | |||||
| 176 | } | ||||
| 177 | |||||
| 178 | 3 | 396µs | 2 | 126µs | # spent 71µs (16+55) within IO::Compress::RawDeflate::BEGIN@178 which was called:
# once (16µs+55µs) by IO::Compress::Gzip::BEGIN@11 at line 178 # spent 71µs making 1 call to IO::Compress::RawDeflate::BEGIN@178
# spent 55µs making 1 call to Exporter::import |
| 179 | |||||
| 180 | sub createMerge | ||||
| 181 | { | ||||
| 182 | my $self = shift ; | ||||
| 183 | my $outValue = shift ; | ||||
| 184 | my $outType = shift ; | ||||
| 185 | |||||
| 186 | my ($invClass, $error_ref) = $self->getInverseClass(); | ||||
| 187 | eval "require $invClass" | ||||
| 188 | or die "aaaahhhh" ; | ||||
| 189 | |||||
| 190 | my $inf = $invClass->new( $outValue, | ||||
| 191 | Transparent => 0, | ||||
| 192 | #Strict => 1, | ||||
| 193 | AutoClose => 0, | ||||
| 194 | Scan => 1) | ||||
| 195 | or return $self->saveErrorString(undef, "Cannot create InflateScan object: $$error_ref" ) ; | ||||
| 196 | |||||
| 197 | my $end_offset = 0; | ||||
| 198 | $inf->scan() | ||||
| 199 | or return $self->saveErrorString(undef, "Error Scanning: $$error_ref", $inf->errorNo) ; | ||||
| 200 | $inf->zap($end_offset) | ||||
| 201 | or return $self->saveErrorString(undef, "Error Zapping: $$error_ref", $inf->errorNo) ; | ||||
| 202 | |||||
| 203 | my $def = *$self->{Compress} = $inf->createDeflate(); | ||||
| 204 | |||||
| 205 | *$self->{Header} = *$inf->{Info}{Header}; | ||||
| 206 | *$self->{UnCompSize} = *$inf->{UnCompSize}->clone(); | ||||
| 207 | *$self->{CompSize} = *$inf->{CompSize}->clone(); | ||||
| 208 | # TODO -- fix this | ||||
| 209 | #*$self->{CompSize} = new U64(0, *$self->{UnCompSize_32bit}); | ||||
| 210 | |||||
| 211 | |||||
| 212 | if ( $outType eq 'buffer') | ||||
| 213 | { substr( ${ *$self->{Buffer} }, $end_offset) = '' } | ||||
| 214 | elsif ($outType eq 'handle' || $outType eq 'filename') { | ||||
| 215 | *$self->{FH} = *$inf->{FH} ; | ||||
| 216 | delete *$inf->{FH}; | ||||
| 217 | *$self->{FH}->flush() ; | ||||
| 218 | *$self->{Handle} = 1 if $outType eq 'handle'; | ||||
| 219 | |||||
| 220 | #seek(*$self->{FH}, $end_offset, SEEK_SET) | ||||
| 221 | *$self->{FH}->seek($end_offset, SEEK_SET) | ||||
| 222 | or return $self->saveErrorString(undef, $!, $!) ; | ||||
| 223 | } | ||||
| 224 | |||||
| 225 | return $def ; | ||||
| 226 | } | ||||
| 227 | |||||
| 228 | #### zlib specific methods | ||||
| 229 | |||||
| 230 | sub deflateParams | ||||
| 231 | { | ||||
| 232 | my $self = shift ; | ||||
| 233 | |||||
| 234 | my $level = shift ; | ||||
| 235 | my $strategy = shift ; | ||||
| 236 | |||||
| 237 | my $status = *$self->{Compress}->deflateParams(Level => $level, Strategy => $strategy) ; | ||||
| 238 | return $self->saveErrorString(0, *$self->{Compress}{Error}, *$self->{Compress}{ErrorNo}) | ||||
| 239 | if $status == STATUS_ERROR; | ||||
| 240 | |||||
| 241 | return 1; | ||||
| 242 | } | ||||
| 243 | |||||
| - - | |||||
| 247 | 1 | 15µs | 1; | ||
| 248 | |||||
| 249 | __END__ |