File | /project/perl/lib/IO/Compress/Gzip/Constants.pm |
Statements Executed | 101 |
Statement Execution Time | 3.52ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 2 | 11µs | 11µs | CORE:pack (opcode) | IO::Compress::Gzip::Constants::
0 | 0 | 0 | 0s | 0s | BEGIN | IO::Compress::Gzip::Constants::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package IO::Compress::Gzip::Constants; | ||||
2 | |||||
3 | 3 | 88µs | 1 | 25µs | use strict ; # spent 25µs making 1 call to strict::import |
4 | 3 | 78µs | 1 | 119µs | use warnings; # spent 119µs making 1 call to warnings::import |
5 | 3 | 315µs | 1 | 15µs | use bytes; # spent 15µs making 1 call to bytes::import |
6 | |||||
7 | 1 | 6µs | require Exporter; | ||
8 | |||||
9 | 1 | 5µs | our ($VERSION, @ISA, @EXPORT, %GZIP_OS_Names); | ||
10 | 1 | 4µs | our ($GZIP_FNAME_INVALID_CHAR_RE, $GZIP_FCOMMENT_INVALID_CHAR_RE); | ||
11 | |||||
12 | 1 | 5µs | $VERSION = '2.005'; | ||
13 | |||||
14 | 1 | 10µs | @ISA = qw(Exporter); | ||
15 | |||||
16 | 1 | 18µs | @EXPORT= qw( | ||
17 | |||||
18 | GZIP_ID_SIZE | ||||
19 | GZIP_ID1 | ||||
20 | GZIP_ID2 | ||||
21 | |||||
22 | GZIP_FLG_DEFAULT | ||||
23 | GZIP_FLG_FTEXT | ||||
24 | GZIP_FLG_FHCRC | ||||
25 | GZIP_FLG_FEXTRA | ||||
26 | GZIP_FLG_FNAME | ||||
27 | GZIP_FLG_FCOMMENT | ||||
28 | GZIP_FLG_RESERVED | ||||
29 | |||||
30 | GZIP_CM_DEFLATED | ||||
31 | |||||
32 | GZIP_MIN_HEADER_SIZE | ||||
33 | GZIP_TRAILER_SIZE | ||||
34 | |||||
35 | GZIP_MTIME_DEFAULT | ||||
36 | GZIP_XFL_DEFAULT | ||||
37 | GZIP_FEXTRA_HEADER_SIZE | ||||
38 | GZIP_FEXTRA_MAX_SIZE | ||||
39 | GZIP_FEXTRA_SUBFIELD_HEADER_SIZE | ||||
40 | GZIP_FEXTRA_SUBFIELD_ID_SIZE | ||||
41 | GZIP_FEXTRA_SUBFIELD_LEN_SIZE | ||||
42 | GZIP_FEXTRA_SUBFIELD_MAX_SIZE | ||||
43 | |||||
44 | $GZIP_FNAME_INVALID_CHAR_RE | ||||
45 | $GZIP_FCOMMENT_INVALID_CHAR_RE | ||||
46 | |||||
47 | GZIP_FHCRC_SIZE | ||||
48 | |||||
49 | GZIP_ISIZE_MAX | ||||
50 | GZIP_ISIZE_MOD_VALUE | ||||
51 | |||||
52 | |||||
53 | GZIP_NULL_BYTE | ||||
54 | |||||
55 | GZIP_OS_DEFAULT | ||||
56 | |||||
57 | %GZIP_OS_Names | ||||
58 | |||||
59 | GZIP_MINIMUM_HEADER | ||||
60 | |||||
61 | ); | ||||
62 | |||||
63 | # Constant names derived from RFC 1952 | ||||
64 | |||||
65 | 3 | 99µs | 1 | 201µs | use constant GZIP_ID_SIZE => 2 ; # spent 201µs making 1 call to constant::import |
66 | 3 | 92µs | 1 | 182µs | use constant GZIP_ID1 => 0x1F; # spent 182µs making 1 call to constant::import |
67 | 3 | 92µs | 1 | 232µs | use constant GZIP_ID2 => 0x8B; # spent 232µs making 1 call to constant::import |
68 | |||||
69 | 3 | 89µs | 1 | 192µs | use constant GZIP_MIN_HEADER_SIZE => 10 ;# minimum gzip header size # spent 192µs making 1 call to constant::import |
70 | 3 | 91µs | 1 | 193µs | use constant GZIP_TRAILER_SIZE => 8 ; # spent 193µs making 1 call to constant::import |
71 | |||||
72 | |||||
73 | 3 | 89µs | 1 | 173µs | use constant GZIP_FLG_DEFAULT => 0x00 ; # spent 173µs making 1 call to constant::import |
74 | 3 | 89µs | 1 | 172µs | use constant GZIP_FLG_FTEXT => 0x01 ; # spent 172µs making 1 call to constant::import |
75 | 3 | 93µs | 1 | 188µs | use constant GZIP_FLG_FHCRC => 0x02 ; # called CONTINUATION in gzip # spent 188µs making 1 call to constant::import |
76 | 3 | 93µs | 1 | 187µs | use constant GZIP_FLG_FEXTRA => 0x04 ; # spent 187µs making 1 call to constant::import |
77 | 3 | 95µs | 1 | 193µs | use constant GZIP_FLG_FNAME => 0x08 ; # spent 193µs making 1 call to constant::import |
78 | 3 | 104µs | 1 | 175µs | use constant GZIP_FLG_FCOMMENT => 0x10 ; # spent 175µs making 1 call to constant::import |
79 | #use constant GZIP_FLG_ENCRYPTED => 0x20 ; # documented in gzip sources | ||||
80 | 3 | 113µs | 1 | 177µs | use constant GZIP_FLG_RESERVED => (0x20 | 0x40 | 0x80) ; # spent 177µs making 1 call to constant::import |
81 | |||||
82 | 3 | 94µs | 1 | 174µs | use constant GZIP_XFL_DEFAULT => 0x00 ; # spent 174µs making 1 call to constant::import |
83 | |||||
84 | 3 | 89µs | 1 | 174µs | use constant GZIP_MTIME_DEFAULT => 0x00 ; # spent 174µs making 1 call to constant::import |
85 | |||||
86 | 3 | 87µs | 1 | 196µs | use constant GZIP_FEXTRA_HEADER_SIZE => 2 ; # spent 196µs making 1 call to constant::import |
87 | 3 | 91µs | 1 | 178µs | use constant GZIP_FEXTRA_MAX_SIZE => 0xFF ; # spent 178µs making 1 call to constant::import |
88 | 3 | 94µs | 1 | 182µs | use constant GZIP_FEXTRA_SUBFIELD_ID_SIZE => 2 ; # spent 182µs making 1 call to constant::import |
89 | 3 | 101µs | 1 | 203µs | use constant GZIP_FEXTRA_SUBFIELD_LEN_SIZE => 2 ; # spent 203µs making 1 call to constant::import |
90 | use constant GZIP_FEXTRA_SUBFIELD_HEADER_SIZE => GZIP_FEXTRA_SUBFIELD_ID_SIZE + # spent 173µs making 1 call to constant::import | ||||
91 | 3 | 116µs | GZIP_FEXTRA_SUBFIELD_LEN_SIZE; | ||
92 | use constant GZIP_FEXTRA_SUBFIELD_MAX_SIZE => GZIP_FEXTRA_MAX_SIZE - # spent 175µs making 1 call to constant::import | ||||
93 | 3 | 199µs | GZIP_FEXTRA_SUBFIELD_HEADER_SIZE ; | ||
94 | |||||
95 | |||||
96 | 1 | 10µs | if (ord('A') == 193) | ||
97 | { | ||||
98 | # EBCDIC | ||||
99 | $GZIP_FNAME_INVALID_CHAR_RE = '[\x00-\x03\x37\x2d-\x2f\x16\x05\x15\x0b-\x13\x3c\x3d\x32\x26\x18\x19\x3f\x27\x1c-\x1f\x07\x20-\x25\x06\x17\x28-\x2c\x09\x0a\x1b\x30\x31\x1a\x33-\x36\x08\x38-\x3b\x04\x14\x3e\xff]'; | ||||
100 | $GZIP_FCOMMENT_INVALID_CHAR_RE = '[\x00-\x03\x37\x2d-\x2f\x16\x05\x15\x0b-\x0f\x11-\x13\x3c\x3d\x32\x26\x18\x19\x3f\x27\x1c-\x1f\x07\x20-\x25\x06\x17\x28-\x2c\x09\x0a\x1b\x30\x31\x1a\x33-\x36\x08\x38-\x3b\x04\x14\x3e\xff]'; | ||||
101 | |||||
102 | } | ||||
103 | else | ||||
104 | { | ||||
105 | 1 | 5µs | $GZIP_FNAME_INVALID_CHAR_RE = '[\x00-\x1F\x7F-\x9F]'; | ||
106 | 1 | 5µs | $GZIP_FCOMMENT_INVALID_CHAR_RE = '[\x00-\x09\x11-\x1F\x7F-\x9F]'; | ||
107 | } | ||||
108 | |||||
109 | 3 | 91µs | 1 | 177µs | use constant GZIP_FHCRC_SIZE => 2 ; # aka CONTINUATION in gzip # spent 177µs making 1 call to constant::import |
110 | |||||
111 | 3 | 110µs | 1 | 204µs | use constant GZIP_CM_DEFLATED => 8 ; # spent 204µs making 1 call to constant::import |
112 | |||||
113 | 3 | 93µs | 1 | 185µs | use constant GZIP_NULL_BYTE => "\x00"; # spent 185µs making 1 call to constant::import |
114 | 3 | 99µs | 1 | 182µs | use constant GZIP_ISIZE_MAX => 0xFFFFFFFF ; # spent 182µs making 1 call to constant::import |
115 | 3 | 93µs | 1 | 186µs | use constant GZIP_ISIZE_MOD_VALUE => GZIP_ISIZE_MAX + 1 ; # spent 186µs making 1 call to constant::import |
116 | |||||
117 | # OS Names sourced from http://www.gzip.org/format.txt | ||||
118 | |||||
119 | 3 | 255µs | 1 | 182µs | use constant GZIP_OS_DEFAULT=> 0xFF ; # spent 182µs making 1 call to constant::import |
120 | 1 | 40µs | %GZIP_OS_Names = ( | ||
121 | 0 => 'MS-DOS', | ||||
122 | 1 => 'Amiga', | ||||
123 | 2 => 'VMS', | ||||
124 | 3 => 'Unix', | ||||
125 | 4 => 'VM/CMS', | ||||
126 | 5 => 'Atari TOS', | ||||
127 | 6 => 'HPFS (OS/2, NT)', | ||||
128 | 7 => 'Macintosh', | ||||
129 | 8 => 'Z-System', | ||||
130 | 9 => 'CP/M', | ||||
131 | 10 => 'TOPS-20', | ||||
132 | 11 => 'NTFS (NT)', | ||||
133 | 12 => 'SMS QDOS', | ||||
134 | 13 => 'Acorn RISCOS', | ||||
135 | 14 => 'VFAT file system (Win95, NT)', | ||||
136 | 15 => 'MVS', | ||||
137 | 16 => 'BeOS', | ||||
138 | 17 => 'Tandem/NSK', | ||||
139 | 18 => 'THEOS', | ||||
140 | GZIP_OS_DEFAULT() => 'Unknown', | ||||
141 | ) ; | ||||
142 | |||||
143 | use constant GZIP_MINIMUM_HEADER => pack("C4 V C C", # spent 185µs making 1 call to constant::import
# spent 11µs making 1 call to IO::Compress::Gzip::Constants::CORE:pack | ||||
144 | GZIP_ID1, GZIP_ID2, GZIP_CM_DEFLATED, GZIP_FLG_DEFAULT, | ||||
145 | 3 | 149µs | GZIP_MTIME_DEFAULT, GZIP_XFL_DEFAULT, GZIP_OS_DEFAULT) ; | ||
146 | |||||
147 | |||||
148 | 1 | 33µs | 1; | ||
# spent 11µs within IO::Compress::Gzip::Constants::CORE:pack which was called
# once (11µs+0s) by Net::HTTP::Methods::zlib_ok at line 143 of IO/Compress/Gzip/Constants.pm |