← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/IO/Uncompress/Inflate.pm
StatementsExecuted 24 statements in 579µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111754µs5.66msIO::Uncompress::Inflate::::BEGIN@11IO::Uncompress::Inflate::BEGIN@11
1119µs10µsIO::Uncompress::Inflate::::BEGIN@4IO::Uncompress::Inflate::BEGIN@4
1117µs66µsIO::Uncompress::Inflate::::BEGIN@9IO::Uncompress::Inflate::BEGIN@9
1117µs70µsIO::Uncompress::Inflate::::BEGIN@8IO::Uncompress::Inflate::BEGIN@8
1114µs5µsIO::Uncompress::Inflate::::BEGIN@6IO::Uncompress::Inflate::BEGIN@6
1114µs7µsIO::Uncompress::Inflate::::BEGIN@5IO::Uncompress::Inflate::BEGIN@5
0000s0sIO::Uncompress::Inflate::::_readDeflateHeaderIO::Uncompress::Inflate::_readDeflateHeader
0000s0sIO::Uncompress::Inflate::::bitsIO::Uncompress::Inflate::bits
0000s0sIO::Uncompress::Inflate::::chkTrailerIO::Uncompress::Inflate::chkTrailer
0000s0sIO::Uncompress::Inflate::::ckMagicIO::Uncompress::Inflate::ckMagic
0000s0sIO::Uncompress::Inflate::::ckParamsIO::Uncompress::Inflate::ckParams
0000s0sIO::Uncompress::Inflate::::getExtraParamsIO::Uncompress::Inflate::getExtraParams
0000s0sIO::Uncompress::Inflate::::inflateIO::Uncompress::Inflate::inflate
0000s0sIO::Uncompress::Inflate::::isZlibMagicIO::Uncompress::Inflate::isZlibMagic
0000s0sIO::Uncompress::Inflate::::newIO::Uncompress::Inflate::new
0000s0sIO::Uncompress::Inflate::::readHeaderIO::Uncompress::Inflate::readHeader
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package IO::Uncompress::Inflate ;
2# for RFC1950
3
4215µs212µs
# spent 10µs (9+2) within IO::Uncompress::Inflate::BEGIN@4 which was called: # once (9µs+2µs) by Search::Elasticsearch::Role::Cxn::BEGIN@9 at line 4
use strict ;
# spent 10µs making 1 call to IO::Uncompress::Inflate::BEGIN@4 # spent 2µs making 1 call to strict::import
5212µs210µs
# spent 7µs (4+3) within IO::Uncompress::Inflate::BEGIN@5 which was called: # once (4µs+3µs) by Search::Elasticsearch::Role::Cxn::BEGIN@9 at line 5
use warnings;
# spent 7µs making 1 call to IO::Uncompress::Inflate::BEGIN@5 # spent 3µs making 1 call to warnings::import
6215µs26µs
# spent 5µs (4+700ns) within IO::Uncompress::Inflate::BEGIN@6 which was called: # once (4µs+700ns) by Search::Elasticsearch::Role::Cxn::BEGIN@9 at line 6
use bytes;
# spent 5µs making 1 call to IO::Uncompress::Inflate::BEGIN@6 # spent 700ns making 1 call to bytes::import
7
8326µs3133µs
# spent 70µs (7+63) within IO::Uncompress::Inflate::BEGIN@8 which was called: # once (7µs+63µs) by Search::Elasticsearch::Role::Cxn::BEGIN@9 at line 8
use IO::Compress::Base::Common 2.068 qw(:Status );
# spent 70µs making 1 call to IO::Uncompress::Inflate::BEGIN@8 # spent 58µs making 1 call to Exporter::import # spent 5µs making 1 call to UNIVERSAL::VERSION
9334µs3124µs
# spent 66µs (7+58) within IO::Uncompress::Inflate::BEGIN@9 which was called: # once (7µs+58µs) by Search::Elasticsearch::Role::Cxn::BEGIN@9 at line 9
use IO::Compress::Zlib::Constants 2.068 ;
# spent 66µs making 1 call to IO::Uncompress::Inflate::BEGIN@9 # spent 54µs making 1 call to Exporter::import # spent 4µs making 1 call to UNIVERSAL::VERSION
10
113463µs35.67ms
# spent 5.66ms (754µs+4.90) within IO::Uncompress::Inflate::BEGIN@11 which was called: # once (754µs+4.90ms) by Search::Elasticsearch::Role::Cxn::BEGIN@9 at line 11
use IO::Uncompress::RawInflate 2.068 ;
# spent 5.66ms making 1 call to IO::Uncompress::Inflate::BEGIN@11 # spent 11µs making 1 call to Exporter::import # spent 5µs making 1 call to UNIVERSAL::VERSION
12
131300nsrequire Exporter ;
14our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $InflateError);
15
161100ns$VERSION = '2.068';
171100ns$InflateError = '';
18
1917µs@ISA = qw( Exporter IO::Uncompress::RawInflate );
201400ns@EXPORT_OK = qw( $InflateError inflate ) ;
211600ns%EXPORT_TAGS = %IO::Uncompress::RawInflate::DEFLATE_CONSTANTS ;
221800nspush @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
2312µs112µsExporter::export_ok_tags('all');
# spent 12µs making 1 call to Exporter::export_ok_tags
24
25
26sub new
27{
28 my $class = shift ;
29 my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$InflateError);
30
31 $obj->_create(undef, 0, @_);
32}
33
34sub inflate
35{
36 my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$InflateError);
37 return $obj->_inf(@_);
38}
39
40sub getExtraParams
41{
42 return ();
43}
44
45sub ckParams
46{
47 my $self = shift ;
48 my $got = shift ;
49
50 # gunzip always needs adler32
51 $got->setValue('adler32' => 1);
52
53 return 1;
54}
55
56sub ckMagic
57{
58 my $self = shift;
59
60 my $magic ;
61 $self->smartReadExact(\$magic, ZLIB_HEADER_SIZE);
62
63 *$self->{HeaderPending} = $magic ;
64
65 return $self->HeaderError("Header size is " .
66 ZLIB_HEADER_SIZE . " bytes")
67 if length $magic != ZLIB_HEADER_SIZE;
68
69 #return $self->HeaderError("CRC mismatch.")
70 return undef
71 if ! $self->isZlibMagic($magic) ;
72
73 *$self->{Type} = 'rfc1950';
74 return $magic;
75}
76
77sub readHeader
78{
79 my $self = shift;
80 my $magic = shift ;
81
82 return $self->_readDeflateHeader($magic) ;
83}
84
85sub chkTrailer
86{
87 my $self = shift;
88 my $trailer = shift;
89
90 my $ADLER32 = unpack("N", $trailer) ;
91 *$self->{Info}{ADLER32} = $ADLER32;
92 return $self->TrailerError("CRC mismatch")
93 if *$self->{Strict} && $ADLER32 != *$self->{Uncomp}->adler32() ;
94
95 return STATUS_OK;
96}
97
- -
100sub isZlibMagic
101{
102 my $self = shift;
103 my $buffer = shift ;
104
105 return 0
106 if length $buffer < ZLIB_HEADER_SIZE ;
107
108 my $hdr = unpack("n", $buffer) ;
109 #return 0 if $hdr % 31 != 0 ;
110 return $self->HeaderError("CRC mismatch.")
111 if $hdr % 31 != 0 ;
112
113 my ($CMF, $FLG) = unpack "C C", $buffer;
114 my $cm = bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS) ;
115
116 # Only Deflate supported
117 return $self->HeaderError("Not Deflate (CM is $cm)")
118 if $cm != ZLIB_CMF_CM_DEFLATED ;
119
120 # Max window value is 7 for Deflate.
121 my $cinfo = bits($CMF, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS) ;
122 return $self->HeaderError("CINFO > " . ZLIB_CMF_CINFO_MAX .
123 " (CINFO is $cinfo)")
124 if $cinfo > ZLIB_CMF_CINFO_MAX ;
125
126 return 1;
127}
128
129sub bits
130{
131 my $data = shift ;
132 my $offset = shift ;
133 my $mask = shift ;
134
135 ($data >> $offset ) & $mask & 0xFF ;
136}
137
138
139sub _readDeflateHeader
140{
141 my ($self, $buffer) = @_ ;
142
143# if (! $buffer) {
144# $self->smartReadExact(\$buffer, ZLIB_HEADER_SIZE);
145#
146# *$self->{HeaderPending} = $buffer ;
147#
148# return $self->HeaderError("Header size is " .
149# ZLIB_HEADER_SIZE . " bytes")
150# if length $buffer != ZLIB_HEADER_SIZE;
151#
152# return $self->HeaderError("CRC mismatch.")
153# if ! isZlibMagic($buffer) ;
154# }
155
156 my ($CMF, $FLG) = unpack "C C", $buffer;
157 my $FDICT = bits($FLG, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS ),
158
159 my $cm = bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS) ;
160 $cm == ZLIB_CMF_CM_DEFLATED
161 or return $self->HeaderError("Not Deflate (CM is $cm)") ;
162
163 my $DICTID;
164 if ($FDICT) {
165 $self->smartReadExact(\$buffer, ZLIB_FDICT_SIZE)
166 or return $self->TruncatedHeader("FDICT");
167
168 $DICTID = unpack("N", $buffer) ;
169 }
170
171 *$self->{Type} = 'rfc1950';
172
173 return {
174 'Type' => 'rfc1950',
175 'FingerprintLength' => ZLIB_HEADER_SIZE,
176 'HeaderLength' => ZLIB_HEADER_SIZE,
177 'TrailerLength' => ZLIB_TRAILER_SIZE,
178 'Header' => $buffer,
179
180 CMF => $CMF ,
181 CM => bits($CMF, ZLIB_CMF_CM_OFFSET, ZLIB_CMF_CM_BITS ),
182 CINFO => bits($CMF, ZLIB_CMF_CINFO_OFFSET, ZLIB_CMF_CINFO_BITS ),
183 FLG => $FLG ,
184 FCHECK => bits($FLG, ZLIB_FLG_FCHECK_OFFSET, ZLIB_FLG_FCHECK_BITS),
185 FDICT => bits($FLG, ZLIB_FLG_FDICT_OFFSET, ZLIB_FLG_FDICT_BITS ),
186 FLEVEL => bits($FLG, ZLIB_FLG_LEVEL_OFFSET, ZLIB_FLG_LEVEL_BITS ),
187 DICTID => $DICTID ,
188
189 };
190}
191
- -
19515µs1 ;
196
197__END__