Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/IO/Compress/Deflate.pm |
Statements | Executed 28 statements in 625µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 683µs | 12.9ms | BEGIN@11 | IO::Compress::Deflate::
1 | 1 | 1 | 351µs | 776µs | BEGIN@14 | IO::Compress::Deflate::
1 | 1 | 1 | 14µs | 108µs | BEGIN@12 | IO::Compress::Deflate::
1 | 1 | 1 | 8µs | 9µs | BEGIN@5 | IO::Compress::Deflate::
1 | 1 | 1 | 6µs | 7µs | BEGIN@7 | IO::Compress::Deflate::
1 | 1 | 1 | 5µs | 9µs | BEGIN@15 | IO::Compress::Deflate::
1 | 1 | 1 | 4µs | 8µs | BEGIN@6 | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | bitmask | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | ckParams | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | deflate | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | getExtraParams | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | getFileInfo | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | getInverseClass | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | mkDeflateHdr | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | mkFinalTrailer | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | mkHeader | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | mkTrailer | IO::Compress::Deflate::
0 | 0 | 0 | 0s | 0s | new | IO::Compress::Deflate::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package IO::Compress::Deflate ; | ||||
2 | |||||
3 | 1 | 5µs | require 5.006 ; | ||
4 | |||||
5 | 2 | 14µs | 2 | 11µs | # spent 9µs (8+1) within IO::Compress::Deflate::BEGIN@5 which was called:
# once (8µs+1µs) by Search::Elasticsearch::Role::Cxn::BEGIN@8 at line 5 # spent 9µs making 1 call to IO::Compress::Deflate::BEGIN@5
# spent 2µs making 1 call to strict::import |
6 | 2 | 11µs | 2 | 11µs | # spent 8µs (4+3) within IO::Compress::Deflate::BEGIN@6 which was called:
# once (4µs+3µs) by Search::Elasticsearch::Role::Cxn::BEGIN@8 at line 6 # spent 8µs making 1 call to IO::Compress::Deflate::BEGIN@6
# spent 3µs making 1 call to warnings::import |
7 | 2 | 22µs | 2 | 9µs | # spent 7µs (6+2) within IO::Compress::Deflate::BEGIN@7 which was called:
# once (6µs+2µs) by Search::Elasticsearch::Role::Cxn::BEGIN@8 at line 7 # spent 7µs making 1 call to IO::Compress::Deflate::BEGIN@7
# spent 2µs making 1 call to bytes::import |
8 | |||||
9 | 1 | 300ns | require Exporter ; | ||
10 | |||||
11 | 3 | 73µs | 2 | 12.9ms | # spent 12.9ms (683µs+12.2) within IO::Compress::Deflate::BEGIN@11 which was called:
# once (683µs+12.2ms) by Search::Elasticsearch::Role::Cxn::BEGIN@8 at line 11 # spent 12.9ms making 1 call to IO::Compress::Deflate::BEGIN@11
# spent 5µs making 1 call to UNIVERSAL::VERSION |
12 | 3 | 31µs | 3 | 201µs | # spent 108µs (14+94) within IO::Compress::Deflate::BEGIN@12 which was called:
# once (14µs+94µs) by Search::Elasticsearch::Role::Cxn::BEGIN@8 at line 12 # spent 108µs making 1 call to IO::Compress::Deflate::BEGIN@12
# spent 91µs making 1 call to Exporter::import
# spent 3µs making 1 call to UNIVERSAL::VERSION |
13 | |||||
14 | 3 | 76µs | 3 | 826µs | # spent 776µs (351+425) within IO::Compress::Deflate::BEGIN@14 which was called:
# once (351µs+425µs) by Search::Elasticsearch::Role::Cxn::BEGIN@8 at line 14 # spent 776µs making 1 call to IO::Compress::Deflate::BEGIN@14
# spent 44µs making 1 call to Exporter::import
# spent 5µs making 1 call to UNIVERSAL::VERSION |
15 | 3 | 376µs | 2 | 13µs | # spent 9µs (5+4) within IO::Compress::Deflate::BEGIN@15 which was called:
# once (5µs+4µs) by Search::Elasticsearch::Role::Cxn::BEGIN@8 at line 15 # spent 9µs making 1 call to IO::Compress::Deflate::BEGIN@15
# spent 4µs making 1 call to UNIVERSAL::VERSION |
16 | |||||
17 | |||||
18 | our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, %DEFLATE_CONSTANTS, $DeflateError); | ||||
19 | |||||
20 | 1 | 200ns | $VERSION = '2.068'; | ||
21 | 1 | 100ns | $DeflateError = ''; | ||
22 | |||||
23 | 1 | 6µs | @ISA = qw(Exporter IO::Compress::RawDeflate); | ||
24 | 1 | 400ns | @EXPORT_OK = qw( $DeflateError deflate ) ; | ||
25 | 1 | 2µs | %EXPORT_TAGS = %IO::Compress::RawDeflate::DEFLATE_CONSTANTS ; | ||
26 | |||||
27 | 1 | 600ns | push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ; | ||
28 | 1 | 2µs | 1 | 11µs | Exporter::export_ok_tags('all'); # spent 11µs making 1 call to Exporter::export_ok_tags |
29 | |||||
30 | |||||
31 | sub new | ||||
32 | { | ||||
33 | my $class = shift ; | ||||
34 | |||||
35 | my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$DeflateError); | ||||
36 | return $obj->_create(undef, @_); | ||||
37 | } | ||||
38 | |||||
39 | sub deflate | ||||
40 | { | ||||
41 | my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$DeflateError); | ||||
42 | return $obj->_def(@_); | ||||
43 | } | ||||
44 | |||||
45 | |||||
46 | sub bitmask($$$$) | ||||
47 | { | ||||
48 | my $into = shift ; | ||||
49 | my $value = shift ; | ||||
50 | my $offset = shift ; | ||||
51 | my $mask = shift ; | ||||
52 | |||||
53 | return $into | (($value & $mask) << $offset ) ; | ||||
54 | } | ||||
55 | |||||
56 | sub mkDeflateHdr($$$;$) | ||||
57 | { | ||||
58 | my $method = shift ; | ||||
59 | my $cinfo = shift; | ||||
60 | my $level = shift; | ||||
61 | my $fdict_adler = shift ; | ||||
62 | |||||
63 | my $cmf = 0; | ||||
64 | my $flg = 0; | ||||
65 | my $fdict = 0; | ||||
66 | $fdict = 1 if defined $fdict_adler; | ||||
67 | |||||
68 | $cmf = bitmask($cmf, $method, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS); | ||||
69 | $cmf = bitmask($cmf, $cinfo, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS); | ||||
70 | |||||
71 | $flg = bitmask($flg, $fdict, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS); | ||||
72 | $flg = bitmask($flg, $level, ZLIB_FLG_LEVEL_OFFSET, ZLIB_FLG_LEVEL_BITS); | ||||
73 | |||||
74 | my $fcheck = 31 - ($cmf * 256 + $flg) % 31 ; | ||||
75 | $flg = bitmask($flg, $fcheck, ZLIB_FLG_FCHECK_OFFSET, ZLIB_FLG_FCHECK_BITS); | ||||
76 | |||||
77 | my $hdr = pack("CC", $cmf, $flg) ; | ||||
78 | $hdr .= pack("N", $fdict_adler) if $fdict ; | ||||
79 | |||||
80 | return $hdr; | ||||
81 | } | ||||
82 | |||||
83 | sub mkHeader | ||||
84 | { | ||||
85 | my $self = shift ; | ||||
86 | my $param = shift ; | ||||
87 | |||||
88 | my $level = $param->getValue('level'); | ||||
89 | my $strategy = $param->getValue('strategy'); | ||||
90 | |||||
91 | my $lflag ; | ||||
92 | $level = 6 | ||||
93 | if $level == Z_DEFAULT_COMPRESSION ; | ||||
94 | |||||
95 | if (ZLIB_VERNUM >= 0x1210) | ||||
96 | { | ||||
97 | if ($strategy >= Z_HUFFMAN_ONLY || $level < 2) | ||||
98 | { $lflag = ZLIB_FLG_LEVEL_FASTEST } | ||||
99 | elsif ($level < 6) | ||||
100 | { $lflag = ZLIB_FLG_LEVEL_FAST } | ||||
101 | elsif ($level == 6) | ||||
102 | { $lflag = ZLIB_FLG_LEVEL_DEFAULT } | ||||
103 | else | ||||
104 | { $lflag = ZLIB_FLG_LEVEL_SLOWEST } | ||||
105 | } | ||||
106 | else | ||||
107 | { | ||||
108 | $lflag = ($level - 1) >> 1 ; | ||||
109 | $lflag = 3 if $lflag > 3 ; | ||||
110 | } | ||||
111 | |||||
112 | #my $wbits = (MAX_WBITS - 8) << 4 ; | ||||
113 | my $wbits = 7; | ||||
114 | mkDeflateHdr(ZLIB_CMF_CM_DEFLATED, $wbits, $lflag); | ||||
115 | } | ||||
116 | |||||
117 | sub ckParams | ||||
118 | { | ||||
119 | my $self = shift ; | ||||
120 | my $got = shift; | ||||
121 | |||||
122 | $got->setValue('adler32' => 1); | ||||
123 | return 1 ; | ||||
124 | } | ||||
125 | |||||
126 | |||||
127 | sub mkTrailer | ||||
128 | { | ||||
129 | my $self = shift ; | ||||
130 | return pack("N", *$self->{Compress}->adler32()) ; | ||||
131 | } | ||||
132 | |||||
133 | sub mkFinalTrailer | ||||
134 | { | ||||
135 | return ''; | ||||
136 | } | ||||
137 | |||||
138 | #sub newHeader | ||||
139 | #{ | ||||
140 | # my $self = shift ; | ||||
141 | # return *$self->{Header}; | ||||
142 | #} | ||||
143 | |||||
144 | sub getExtraParams | ||||
145 | { | ||||
146 | my $self = shift ; | ||||
147 | return $self->getZlibParams(), | ||||
148 | } | ||||
149 | |||||
150 | sub getInverseClass | ||||
151 | { | ||||
152 | return ('IO::Uncompress::Inflate', | ||||
153 | \$IO::Uncompress::Inflate::InflateError); | ||||
154 | } | ||||
155 | |||||
156 | sub getFileInfo | ||||
157 | { | ||||
158 | my $self = shift ; | ||||
159 | my $params = shift; | ||||
160 | my $file = shift ; | ||||
161 | |||||
162 | } | ||||
163 | |||||
- - | |||||
166 | 1 | 5µs | 1; | ||
167 | |||||
168 | __END__ |