| Filename | /usr/lib/perl/5.10/IO/Compress/Adapter/Deflate.pm |
| Statements | Executed 18 statements in 905µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 20µs | 25µs | IO::Compress::Adapter::Deflate::BEGIN@3 |
| 1 | 1 | 1 | 19µs | 185µs | IO::Compress::Adapter::Deflate::BEGIN@7 |
| 1 | 1 | 1 | 17µs | 175µs | IO::Compress::Adapter::Deflate::BEGIN@9 |
| 1 | 1 | 1 | 12µs | 29µs | IO::Compress::Adapter::Deflate::BEGIN@4 |
| 1 | 1 | 1 | 11µs | 14µs | IO::Compress::Adapter::Deflate::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::adler32 |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::close |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::compr |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::compressedBytes |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::crc32 |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::deflateParams |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::flush |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::mkCompObject |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::reset |
| 0 | 0 | 0 | 0s | 0s | IO::Compress::Adapter::Deflate::uncompressedBytes |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package IO::Compress::Adapter::Deflate ; | ||||
| 2 | |||||
| 3 | 3 | 35µs | 2 | 30µs | # spent 25µs (20+5) within IO::Compress::Adapter::Deflate::BEGIN@3 which was called:
# once (20µs+5µs) by IO::Compress::RawDeflate::BEGIN@12 at line 3 # spent 25µs making 1 call to IO::Compress::Adapter::Deflate::BEGIN@3
# spent 5µs making 1 call to strict::import |
| 4 | 3 | 28µs | 2 | 47µs | # spent 29µs (12+17) within IO::Compress::Adapter::Deflate::BEGIN@4 which was called:
# once (12µs+17µs) by IO::Compress::RawDeflate::BEGIN@12 at line 4 # spent 29µs making 1 call to IO::Compress::Adapter::Deflate::BEGIN@4
# spent 17µs making 1 call to warnings::import |
| 5 | 3 | 33µs | 2 | 18µs | # spent 14µs (11+3) within IO::Compress::Adapter::Deflate::BEGIN@5 which was called:
# once (11µs+3µs) by IO::Compress::RawDeflate::BEGIN@12 at line 5 # spent 14µs making 1 call to IO::Compress::Adapter::Deflate::BEGIN@5
# spent 3µs making 1 call to bytes::import |
| 6 | |||||
| 7 | 3 | 76µs | 3 | 351µs | # spent 185µs (19+166) within IO::Compress::Adapter::Deflate::BEGIN@7 which was called:
# once (19µs+166µs) by IO::Compress::RawDeflate::BEGIN@12 at line 7 # spent 185µs making 1 call to IO::Compress::Adapter::Deflate::BEGIN@7
# spent 146µs making 1 call to Exporter::import
# spent 20µs making 1 call to UNIVERSAL::VERSION |
| 8 | |||||
| 9 | 3 | 728µs | 3 | 333µs | # spent 175µs (17+158) within IO::Compress::Adapter::Deflate::BEGIN@9 which was called:
# once (17µs+158µs) by IO::Compress::RawDeflate::BEGIN@12 at line 9 # spent 175µs making 1 call to IO::Compress::Adapter::Deflate::BEGIN@9
# spent 142µs making 1 call to Exporter::import
# spent 16µs making 1 call to UNIVERSAL::VERSION |
| 10 | 1 | 200ns | our ($VERSION); | ||
| 11 | |||||
| 12 | 1 | 800ns | $VERSION = '2.020'; | ||
| 13 | |||||
| 14 | sub mkCompObject | ||||
| 15 | { | ||||
| 16 | my $crc32 = shift ; | ||||
| 17 | my $adler32 = shift ; | ||||
| 18 | my $level = shift ; | ||||
| 19 | my $strategy = shift ; | ||||
| 20 | |||||
| 21 | my ($def, $status) = new Compress::Raw::Zlib::Deflate | ||||
| 22 | -AppendOutput => 1, | ||||
| 23 | -CRC32 => $crc32, | ||||
| 24 | -ADLER32 => $adler32, | ||||
| 25 | -Level => $level, | ||||
| 26 | -Strategy => $strategy, | ||||
| 27 | -WindowBits => - MAX_WBITS; | ||||
| 28 | |||||
| 29 | return (undef, "Cannot create Deflate object: $status", $status) | ||||
| 30 | if $status != Z_OK; | ||||
| 31 | |||||
| 32 | return bless {'Def' => $def, | ||||
| 33 | 'Error' => '', | ||||
| 34 | } ; | ||||
| 35 | } | ||||
| 36 | |||||
| 37 | sub compr | ||||
| 38 | { | ||||
| 39 | my $self = shift ; | ||||
| 40 | |||||
| 41 | my $def = $self->{Def}; | ||||
| 42 | |||||
| 43 | my $status = $def->deflate($_[0], $_[1]) ; | ||||
| 44 | $self->{ErrorNo} = $status; | ||||
| 45 | |||||
| 46 | if ($status != Z_OK) | ||||
| 47 | { | ||||
| 48 | $self->{Error} = "Deflate Error: $status"; | ||||
| 49 | return STATUS_ERROR; | ||||
| 50 | } | ||||
| 51 | |||||
| 52 | return STATUS_OK; | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | sub flush | ||||
| 56 | { | ||||
| 57 | my $self = shift ; | ||||
| 58 | |||||
| 59 | my $def = $self->{Def}; | ||||
| 60 | |||||
| 61 | my $opt = $_[1] || Z_FINISH; | ||||
| 62 | my $status = $def->flush($_[0], $opt); | ||||
| 63 | $self->{ErrorNo} = $status; | ||||
| 64 | |||||
| 65 | if ($status != Z_OK) | ||||
| 66 | { | ||||
| 67 | $self->{Error} = "Deflate Error: $status"; | ||||
| 68 | return STATUS_ERROR; | ||||
| 69 | } | ||||
| 70 | |||||
| 71 | return STATUS_OK; | ||||
| 72 | |||||
| 73 | } | ||||
| 74 | |||||
| 75 | sub close | ||||
| 76 | { | ||||
| 77 | my $self = shift ; | ||||
| 78 | |||||
| 79 | my $def = $self->{Def}; | ||||
| 80 | |||||
| 81 | $def->flush($_[0], Z_FINISH) | ||||
| 82 | if defined $def ; | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | sub reset | ||||
| 86 | { | ||||
| 87 | my $self = shift ; | ||||
| 88 | |||||
| 89 | my $def = $self->{Def}; | ||||
| 90 | |||||
| 91 | my $status = $def->deflateReset() ; | ||||
| 92 | $self->{ErrorNo} = $status; | ||||
| 93 | if ($status != Z_OK) | ||||
| 94 | { | ||||
| 95 | $self->{Error} = "Deflate Error: $status"; | ||||
| 96 | return STATUS_ERROR; | ||||
| 97 | } | ||||
| 98 | |||||
| 99 | return STATUS_OK; | ||||
| 100 | } | ||||
| 101 | |||||
| 102 | sub deflateParams | ||||
| 103 | { | ||||
| 104 | my $self = shift ; | ||||
| 105 | |||||
| 106 | my $def = $self->{Def}; | ||||
| 107 | |||||
| 108 | my $status = $def->deflateParams(@_); | ||||
| 109 | $self->{ErrorNo} = $status; | ||||
| 110 | if ($status != Z_OK) | ||||
| 111 | { | ||||
| 112 | $self->{Error} = "deflateParams Error: $status"; | ||||
| 113 | return STATUS_ERROR; | ||||
| 114 | } | ||||
| 115 | |||||
| 116 | return STATUS_OK; | ||||
| 117 | } | ||||
| 118 | |||||
| - - | |||||
| 121 | #sub total_out | ||||
| 122 | #{ | ||||
| 123 | # my $self = shift ; | ||||
| 124 | # $self->{Def}->total_out(); | ||||
| 125 | #} | ||||
| 126 | # | ||||
| 127 | #sub total_in | ||||
| 128 | #{ | ||||
| 129 | # my $self = shift ; | ||||
| 130 | # $self->{Def}->total_in(); | ||||
| 131 | #} | ||||
| 132 | |||||
| 133 | sub compressedBytes | ||||
| 134 | { | ||||
| 135 | my $self = shift ; | ||||
| 136 | |||||
| 137 | $self->{Def}->compressedBytes(); | ||||
| 138 | } | ||||
| 139 | |||||
| 140 | sub uncompressedBytes | ||||
| 141 | { | ||||
| 142 | my $self = shift ; | ||||
| 143 | $self->{Def}->uncompressedBytes(); | ||||
| 144 | } | ||||
| 145 | |||||
| - - | |||||
| 149 | sub crc32 | ||||
| 150 | { | ||||
| 151 | my $self = shift ; | ||||
| 152 | $self->{Def}->crc32(); | ||||
| 153 | } | ||||
| 154 | |||||
| 155 | sub adler32 | ||||
| 156 | { | ||||
| 157 | my $self = shift ; | ||||
| 158 | $self->{Def}->adler32(); | ||||
| 159 | } | ||||
| 160 | |||||
| 161 | |||||
| 162 | 1 | 3µs | 1; | ||
| 163 | |||||
| 164 | __END__ |