← Index
NYTProf Performance Profile   « line view »
For /usr/sbin/pkg_info
  Run on Mon Aug 7 09:39:31 2017
Reported on Mon Aug 7 09:40:21 2017

Filename/usr/libdata/perl5/OpenBSD/Ustar.pm
StatementsExecuted 8890 statements in 46.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1222214.4ms79.4msOpenBSD::Ustar::::next OpenBSD::Ustar::next (recurses: max depth 2, inclusive time 123µs)
476414.09ms4.09msOpenBSD::Ustar::::CORE:subst OpenBSD::Ustar::CORE:subst (opcode)
40113.43ms21.4msOpenBSD::Ustar::File::::create OpenBSD::Ustar::File::create
40111.75ms78.6msOpenBSD::Ustar::File::::contents OpenBSD::Ustar::File::contents
119111.60ms1.60msOpenBSD::Ustar::::new_object OpenBSD::Ustar::new_object
1111.58ms1.76msOpenBSD::Ustar::::BEGIN@48 OpenBSD::Ustar::BEGIN@48
40111.54ms2.80msOpenBSD::CompactWriter::::new OpenBSD::CompactWriter::new
238211.53ms1.53msOpenBSD::Ustar::::CORE:unpack OpenBSD::Ustar::CORE:unpack (opcode)
40111.51ms1.51msOpenBSD::Ustar::::new OpenBSD::Ustar::new
40111.48ms7.57msOpenBSD::Ustar::Object::::make_basedir OpenBSD::Ustar::Object::make_basedir
122111.39ms5.03msOpenBSD::Ustar::::skip OpenBSD::Ustar::skip
40111.30ms1.30msOpenBSD::Ustar::::set_description OpenBSD::Ustar::set_description
40111.27ms1.27msOpenBSD::CompactWriter::::CORE:syswrite OpenBSD::CompactWriter::CORE:syswrite (opcode)
201211.18ms45.8msOpenBSD::Ustar::::CORE:read OpenBSD::Ustar::CORE:read (opcode)
40111.16ms1.16msOpenBSD::CompactWriter::::CORE:open OpenBSD::CompactWriter::CORE:open (opcode)
4011925µs2.30msOpenBSD::Ustar::Object::::set_modes OpenBSD::Ustar::Object::set_modes
4011830µs2.10msOpenBSD::CompactWriter::::write OpenBSD::CompactWriter::write
4011819µs819µsOpenBSD::Ustar::Object::::CORE:chown OpenBSD::Ustar::Object::CORE:chown (opcode)
16041546µs546µsOpenBSD::Ustar::Object::::name OpenBSD::Ustar::Object::name
8021495µs79.5msOpenBSD::Ustar::File::::CORE:read OpenBSD::Ustar::File::CORE:read (opcode)
111473µs511µsOpenBSD::Ustar::::BEGIN@49 OpenBSD::Ustar::BEGIN@49
23832466µs466µsOpenBSD::Ustar::File::::isFile OpenBSD::Ustar::File::isFile (xsub)
11911463µs463µsOpenBSD::Ustar::::CORE:match OpenBSD::Ustar::CORE:match (opcode)
4011462µs462µsOpenBSD::Ustar::Object::::CORE:ftdir OpenBSD::Ustar::Object::CORE:ftdir (opcode)
4011314µs776µsOpenBSD::Ustar::Object::::ensure_dir OpenBSD::Ustar::Object::ensure_dir
4011309µs309µsOpenBSD::Ustar::Object::::CORE:chmod OpenBSD::Ustar::Object::CORE:chmod (opcode)
4011213µs213µsOpenBSD::Ustar::Object::::left_todo OpenBSD::Ustar::Object::left_todo
4011200µs200µsOpenBSD::CompactWriter::::close OpenBSD::CompactWriter::close
4011100µs100µsOpenBSD::CompactWriter::::CORE:stat OpenBSD::CompactWriter::CORE:stat (opcode)
11130µs36µsOpenBSD::PackageLocation::::BEGIN@20OpenBSD::PackageLocation::BEGIN@20
11122µs565µsOpenBSD::Ustar::::BEGIN@25 OpenBSD::Ustar::BEGIN@25
11113µs162µsOpenBSD::CompactWriter::::BEGIN@738 OpenBSD::CompactWriter::BEGIN@738
11113µs27µsOpenBSD::PackageLocation::::BEGIN@21OpenBSD::PackageLocation::BEGIN@21
11112µs33µsOpenBSD::Ustar::::BEGIN@221 OpenBSD::Ustar::BEGIN@221
11110µs10µsOpenBSD::Ustar::::BEGIN@50 OpenBSD::Ustar::BEGIN@50
0000s0sOpenBSD::UStar::Device::::create OpenBSD::UStar::Device::create
0000s0sOpenBSD::Ustar::Dir::::create OpenBSD::Ustar::Dir::create
0000s0sOpenBSD::Ustar::Fifo::::create OpenBSD::Ustar::Fifo::create
0000s0sOpenBSD::Ustar::File::::copy_contents OpenBSD::Ustar::File::copy_contents
0000s0sOpenBSD::Ustar::File::::write_contents OpenBSD::Ustar::File::write_contents
0000s0sOpenBSD::Ustar::HardLink::::createOpenBSD::Ustar::HardLink::create
0000s0sOpenBSD::Ustar::HardLink::::resolve_linksOpenBSD::Ustar::HardLink::resolve_links
0000s0sOpenBSD::Ustar::Object::::alias OpenBSD::Ustar::Object::alias
0000s0sOpenBSD::Ustar::Object::::copy OpenBSD::Ustar::Object::copy
0000s0sOpenBSD::Ustar::Object::::copy_contents OpenBSD::Ustar::Object::copy_contents
0000s0sOpenBSD::Ustar::Object::::errsay OpenBSD::Ustar::Object::errsay
0000s0sOpenBSD::Ustar::Object::::fatal OpenBSD::Ustar::Object::fatal
0000s0sOpenBSD::Ustar::Object::::recheck_owner OpenBSD::Ustar::Object::recheck_owner
0000s0sOpenBSD::Ustar::Object::::resolve_links OpenBSD::Ustar::Object::resolve_links
0000s0sOpenBSD::Ustar::Object::::set_name OpenBSD::Ustar::Object::set_name
0000s0sOpenBSD::Ustar::Object::::system OpenBSD::Ustar::Object::system
0000s0sOpenBSD::Ustar::Object::::write OpenBSD::Ustar::Object::write
0000s0sOpenBSD::Ustar::Object::::write_contents OpenBSD::Ustar::Object::write_contents
0000s0sOpenBSD::Ustar::SoftLink::::createOpenBSD::Ustar::SoftLink::create
0000s0sOpenBSD::Ustar::::close OpenBSD::Ustar::close
0000s0sOpenBSD::Ustar::::destdir OpenBSD::Ustar::destdir
0000s0sOpenBSD::Ustar::::extended_record OpenBSD::Ustar::extended_record
0000s0sOpenBSD::Ustar::::fatal OpenBSD::Ustar::fatal
0000s0sOpenBSD::Ustar::::fh OpenBSD::Ustar::fh
0000s0sOpenBSD::Ustar::::mkheader OpenBSD::Ustar::mkheader
0000s0sOpenBSD::Ustar::::pack_header OpenBSD::Ustar::pack_header
0000s0sOpenBSD::Ustar::::pad OpenBSD::Ustar::pad
0000s0sOpenBSD::Ustar::::parse_records OpenBSD::Ustar::parse_records
0000s0sOpenBSD::Ustar::::prepare OpenBSD::Ustar::prepare
0000s0sOpenBSD::Ustar::::read_records OpenBSD::Ustar::read_records
0000s0sOpenBSD::Ustar::::set_callback OpenBSD::Ustar::set_callback
0000s0sOpenBSD::Ustar::::split_name OpenBSD::Ustar::split_name
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# ex:ts=8 sw=4:
2# $OpenBSD: Ustar.pm,v 1.88 2017/07/23 10:34:44 espie Exp $
3#
4# Copyright (c) 2002-2014 Marc Espie <espie@openbsd.org>
5#
6# Permission to use, copy, modify, and distribute this software for any
7# purpose with or without fee is hereby granted, provided that the above
8# copyright notice and this permission notice appear in all copies.
9#
10# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18# Handle utar archives
19
20254µs242µs
# spent 36µs (30+6) within OpenBSD::PackageLocation::BEGIN@20 which was called: # once (30µs+6µs) by OpenBSD::PackageLocation::_opened at line 20
use strict;
# spent 36µs making 1 call to OpenBSD::PackageLocation::BEGIN@20 # spent 6µs making 1 call to strict::import
212109µs242µs
# spent 27µs (13+14) within OpenBSD::PackageLocation::BEGIN@21 which was called: # once (13µs+14µs) by OpenBSD::PackageLocation::_opened at line 21
use warnings;
# spent 27µs making 1 call to OpenBSD::PackageLocation::BEGIN@21 # spent 14µs making 1 call to warnings::import
22
23package OpenBSD::Ustar;
24
25
# spent 565µs (22+543) within OpenBSD::Ustar::BEGIN@25 which was called: # once (22µs+543µs) by OpenBSD::PackageLocation::_opened at line 46
use constant {
2611µs FILE => "\0",
27 FILE1 => '0',
28 HARDLINK => '1',
29 SOFTLINK => '2',
30 CHARDEVICE => '3',
31 BLOCKDEVICE => '4',
32 DIR => '5',
33 FIFO => '6',
34 CONTFILE => '7',
35 USTAR_HEADER => 'a100a8a8a8a12a12a8aa100a6a2a32a32a8a8a155a12',
36 MAXFILENAME => 100,
37 MAXLINKNAME => 100,
38 MAXPREFIX => 155,
39 MAXUSERNAME => 32,
40 MAXGROUPNAME => 32,
41 XHDR => 'x',
42 # XXX those are NOT supported, just recognized
43 GHDR => 'g',
44 LONGLINK => 'K',
45 LONGNAME => 'L',
46158µs21.11ms};
# spent 565µs making 1 call to OpenBSD::Ustar::BEGIN@25 # spent 543µs making 1 call to constant::import
47
482221µs11.76ms
# spent 1.76ms (1.58+174µs) within OpenBSD::Ustar::BEGIN@48 which was called: # once (1.58ms+174µs) by OpenBSD::PackageLocation::_opened at line 48
use File::Basename ();
# spent 1.76ms making 1 call to OpenBSD::Ustar::BEGIN@48
492127µs1511µs
# spent 511µs (473+37) within OpenBSD::Ustar::BEGIN@49 which was called: # once (473µs+37µs) by OpenBSD::PackageLocation::_opened at line 49
use OpenBSD::IdCache;
# spent 511µs making 1 call to OpenBSD::Ustar::BEGIN@49
502826µs110µs
# spent 10µs within OpenBSD::Ustar::BEGIN@50 which was called: # once (10µs+0s) by OpenBSD::PackageLocation::_opened at line 50
use OpenBSD::Paths;
# spent 10µs making 1 call to OpenBSD::Ustar::BEGIN@50
51
5216µs15µsour $uidcache = new OpenBSD::UidCache;
# spent 5µs making 1 call to OpenBSD::SimpleIdCache::new
5313µs13µsour $gidcache = new OpenBSD::GidCache;
# spent 3µs making 1 call to OpenBSD::SimpleIdCache::new
5413µs12µsour $unamecache = new OpenBSD::UnameCache;
# spent 2µs making 1 call to OpenBSD::SimpleIdCache::new
5513µs12µsour $gnamecache = new OpenBSD::GnameCache;
# spent 2µs making 1 call to OpenBSD::SimpleIdCache::new
56
57# This is a multiple of st_blksize everywhere....
581700nsmy $buffsize = 2 * 1024 * 1024;
59
60sub new
61
# spent 1.51ms within OpenBSD::Ustar::new which was called 40 times, avg 38µs/call: # 40 times (1.51ms+0s) by OpenBSD::PackageLocation::_opened at line 87 of OpenBSD/PackageLocation.pm, avg 38µs/call
{
6240220µs my ($class, $fh, $state, $destdir) = @_;
63
644058µs $destdir = '' unless defined $destdir;
65
6640913µs return bless {
67 fh => $fh,
68 swallow => 0,
69 state => $state,
70 key => {},
71 destdir => $destdir} , $class;
72}
73
74sub set_description
75
# spent 1.30ms within OpenBSD::Ustar::set_description which was called 40 times, avg 33µs/call: # 40 times (1.30ms+0s) by OpenBSD::PackageLocation::_opened at line 88 of OpenBSD/PackageLocation.pm, avg 33µs/call
{
7640288µs my ($self, $d) = @_;
7740767µs $self->{description} = $d;
78}
79
80sub set_callback
81{
82 my ($self, $code) = @_;
83 $self->{callback} = $code;
84}
85
86sub fatal
87{
88 my ($self, $msg, @args) = @_;
89 $self->{state}->fatal("Ustar [#1][#2]: #3",
90 $self->{description} // '?', $self->{lastname} // '?',
91 $self->{state}->f($msg, @args));
92}
93
94sub new_object
95
# spent 1.60ms within OpenBSD::Ustar::new_object which was called 119 times, avg 13µs/call: # 119 times (1.60ms+0s) by OpenBSD::Ustar::next at line 256, avg 13µs/call
{
96119126µs my ($self, $h, $class) = @_;
97119150µs $h->{archive} = $self;
98119245µs $h->{destdir} = $self->{destdir};
99119637µs bless $h, $class;
100119456µs return $h;
101}
102
103sub skip
104
# spent 5.03ms (1.39+3.64) within OpenBSD::Ustar::skip which was called 122 times, avg 41µs/call: # 122 times (1.39ms+3.64ms) by OpenBSD::Ustar::next at line 186, avg 41µs/call
{
105122104µs my $self = shift;
106122106µs my $temp;
107
1081221.30ms while ($self->{swallow} > 0) {
1097988µs my $toread = $self->{swallow};
1107974µs if ($toread >$buffsize) {
111 $toread = $buffsize;
112 }
11379635µs1586.85ms my $actual = read($self->{fh}, $temp, $toread);
# spent 3.64ms making 79 calls to OpenBSD::Ustar::CORE:read, avg 46µs/call # spent 3.21ms making 79 calls to IO::Uncompress::Base::read, avg 41µs/call
1147966µs if (!defined $actual) {
115 $self->fatal("Error while skipping archive: #1", $!);
116 }
1177967µs if ($actual == 0) {
118 $self->fatal("Premature end of archive in header: #1", $!);
119 }
12079161µs $self->{swallow} -= $actual;
121 }
122}
123
12415µsmy $types = {
125 DIR , 'OpenBSD::Ustar::Dir',
126 HARDLINK , 'OpenBSD::Ustar::HardLink',
127 SOFTLINK , 'OpenBSD::Ustar::SoftLink',
128 FILE , 'OpenBSD::Ustar::File',
129 FILE1 , 'OpenBSD::Ustar::File',
130 FIFO , 'OpenBSD::Ustar::Fifo',
131 CHARDEVICE , 'OpenBSD::Ustar::CharDevice',
132 BLOCKDEVICE , 'OpenBSD::Ustar::BlockDevice',
133};
134
13512µsmy $unsupported = {
136 XHDR => 'Extended header',
137 GHDR => 'GNU header',
138 LONGLINK => 'Long symlink',
139 LONGNAME => 'Long file',
140};
141
142sub read_records
143{
144 my ($self, $size) = @_;
145 my $toread = $self->{swallow};
146 my $result = '';
147 while ($toread > 0) {
148 my $buffer;
149 my $maxread = $buffsize;
150 $maxread = $toread if $maxread > $toread;
151 my $actual = read($self->{fh}, $buffer, $maxread);
152 if (!defined $actual) {
153 $self->fatal("Error reading from archive: #1", $!);
154 }
155 if ($actual == 0) {
156 $self->fatal("Premature end of archive");
157 }
158 $self->{swallow} -= $actual;
159 $toread -= $actual;
160 $result .= $buffer;
161 }
162 return substr($result, 0, $size);
163}
164
165sub parse_records
166{
167 my ($self, $result, $h) = @_;
168 open(my $fh, '<', \$h);
169 while (<$fh>) {
170 chomp;
171 if (m/^(\d+)\s+(\w+?)\=(.*)$/) {
172 my ($k, $v) = ($2, $3);
173 if ($k eq 'path') {
174 $result->{name} = $v;
175 } elsif ($k eq 'linkpath') {
176 $result->{linkname} = $v;
177 }
178 }
179 }
180}
181
182sub next
183
# spent 79.4ms (14.4+65.0) within OpenBSD::Ustar::next which was called 122 times, avg 651µs/call: # 120 times (14.4ms+65.0ms) by OpenBSD::PackageLocation::getNext at line 319 of OpenBSD/PackageLocation.pm, avg 662µs/call # 2 times (34µs+-34µs) by OpenBSD::Ustar::next at line 192, avg 0s/call
{
184122110µs my $self = shift;
185 # get rid of the current object
186122424µs1225.03ms $self->skip;
# spent 5.03ms making 122 calls to OpenBSD::Ustar::skip, avg 41µs/call
18712297µs my $header;
1881221.14ms24483.5ms my $n = read($self->{fh}, $header, 512);
# spent 42.1ms making 122 calls to OpenBSD::Ustar::CORE:read, avg 345µs/call # spent 41.4ms making 122 calls to IO::Uncompress::Base::read, avg 339µs/call
189122134µs return if (defined $n) and $n == 0;
190121108µs $self->fatal("Error while reading header")
191 unless defined $n and $n == 512;
192121136µs20s if ($header eq "\0"x512) {
# spent 123µs making 2 calls to OpenBSD::Ustar::next, avg 61µs/call, recursion: max depth 2, sum of overlapping time 123µs
193 return $self->next;
194 }
195 # decode header
1961192.48ms1191.15ms my ($name, $mode, $uid, $gid, $size, $mtime, $chksum, $type,
# spent 1.15ms making 119 calls to OpenBSD::Ustar::CORE:unpack, avg 10µs/call
197 $linkname, $magic, $version, $uname, $gname, $major, $minor,
198 $prefix, $pad) = unpack(USTAR_HEADER, $header);
199119134µs if ($magic ne "ustar\0" || $version ne '00') {
200 $self->fatal("Not an ustar archive header");
201 }
202 # verify checksum
203119114µs my $value = $header;
204119132µs substr($value, 148, 8) = " "x8;
205119758µs119388µs my $ck2 = unpack("%C*", $value);
# spent 388µs making 119 calls to OpenBSD::Ustar::CORE:unpack, avg 3µs/call
206119139µs if ($ck2 != oct($chksum)) {
207 $self->fatal("Bad archive checksum");
208 }
2091193.22ms1192.66ms $name =~ s/\0*$//o;
# spent 2.66ms making 119 calls to OpenBSD::Ustar::CORE:subst, avg 22µs/call
210119133µs $mode = oct($mode) & 0xfff;
2111191.10ms119712µs $uname =~ s/\0*$//o;
# spent 712µs making 119 calls to OpenBSD::Ustar::CORE:subst, avg 6µs/call
212119801µs119460µs $gname =~ s/\0*$//o;
# spent 460µs making 119 calls to OpenBSD::Ustar::CORE:subst, avg 4µs/call
213119582µs119258µs $linkname =~ s/\0*$//o;
# spent 258µs making 119 calls to OpenBSD::Ustar::CORE:subst, avg 2µs/call
214119109µs $major = oct($major);
21511993µs $minor = oct($minor);
21611987µs $uid = oct($uid);
21711990µs $gid = oct($gid);
218119869µs1192.76ms $uid = $uidcache->lookup($uname, $uid);
# spent 2.76ms making 119 calls to OpenBSD::IdCache::lookup, avg 23µs/call
219119371µs1197.18ms $gid = $gidcache->lookup($gname, $gid);
# spent 7.18ms making 119 calls to OpenBSD::IdCache::lookup, avg 60µs/call
220 {
2211212.79ms254µs
# spent 33µs (12+21) within OpenBSD::Ustar::BEGIN@221 which was called: # once (12µs+21µs) by OpenBSD::PackageLocation::_opened at line 221
no warnings; # XXX perl warns if oct converts >= 2^32 values
# spent 33µs making 1 call to OpenBSD::Ustar::BEGIN@221 # spent 21µs making 1 call to warnings::unimport
222119109µs $mtime = oct($mtime);
223 }
224119834µs119463µs unless ($prefix =~ m/^\0/o) {
# spent 463µs making 119 calls to OpenBSD::Ustar::CORE:match, avg 4µs/call
225 $prefix =~ s/\0*$//o;
226 $name = "$prefix/$name";
227 }
228
229119169µs $self->{lastname} = $name;
230119104µs $size = oct($size);
2311192.71ms my $result= {
232 name => $name,
233 mode => $mode,
234 atime => $mtime,
235 mtime => $mtime,
236 linkname=> $linkname,
237 uname => $uname,
238 uid => $uid,
239 gname => $gname,
240 gid => $gid,
241 size => $size,
242 major => $major,
243 minor => $minor,
244 };
245 # adjust swallow
246119131µs $self->{swallow} = $size;
247119202µs if ($size % 512) {
248 $self->{swallow} += 512 - $size % 512;
249 }
250119125µs if ($type eq XHDR) {
251 my $h = $self->read_records($size);
252 $result = $self->next;
253 $self->parse_records($result, $h);
254 return $result;
255 }
256119686µs1191.60ms if (defined $types->{$type}) {
# spent 1.60ms making 119 calls to OpenBSD::Ustar::new_object, avg 13µs/call
257 $self->new_object($result, $types->{$type});
258 } else {
259 $self->fatal("Unsupported type #1 (#2)", $type,
260 $unsupported->{$type} // "unknown");
261 }
262119631µs119190µs if (!$result->isFile && $result->{size} != 0) {
# spent 190µs making 119 calls to OpenBSD::Ustar::File::isFile, avg 2µs/call
263 $self->fatal("Bad archive: non null size for #1 (#2)",
264 $types->{$type}, $result->{name});
265 }
266
267119196µs $self->{cachename} = $name;
268119588µs return $result;
269}
270
271sub split_name
272{
273 my $name = shift;
274 my $prefix = '';
275
276 my $l = length $name;
277 if ($l > MAXFILENAME && $l <= MAXFILENAME+MAXPREFIX+1) {
278 while (length($name) > MAXFILENAME &&
279 $name =~ m/^(.*?\/)(.*)$/o) {
280 $prefix .= $1;
281 $name = $2;
282 }
283 $prefix =~ s|/$||;
284 }
285 return ($prefix, $name);
286}
287
288sub extended_record
289{
290 my ($k, $v) = @_;
291 my $string = " $k=$v\n";
292 my $len = length($string);
293 if ($len < 995) {
294 return sprintf("%3d", $len+3).$string;
295 } elsif ($len < 9995) {
296 return sprintf("%04d", $len+4).$string;
297 } else {
298 return sprintf("%05d", $len+5).$string;
299 }
300}
301
302sub pack_header
303{
304 my ($archive, $type, $size, $entry, $prefix, $name, $linkname,
305 $uname, $gname, $major, $minor) = @_;
306
307 my $header;
308 my $cksum = ' 'x8;
309 for (1 .. 2) {
310 $header = pack(USTAR_HEADER,
311 $name,
312 sprintf("%07o", $entry->{mode}),
313 sprintf("%07o", $entry->{uid} // 0),
314 sprintf("%07o", $entry->{gid} // 0),
315 sprintf("%011o", $size),
316 sprintf("%011o", $entry->{mtime} // 0),
317 $cksum,
318 $type,
319 $linkname,
320 'ustar', '00',
321 $uname,
322 $gname,
323 sprintf("%07o", $major),
324 sprintf("%07o", $minor),
325 $prefix, "\0");
326 $cksum = sprintf("%07o", unpack("%C*", $header));
327 }
328 return $header;
329}
330
3311700nsmy $whatever = "usualSuspect000";
332
333sub mkheader
334{
335 my ($archive, $entry, $type) = @_;
336 my ($prefix, $name) = split_name($entry->name);
337 my ($extendedname, $extendedlink);
338 my $linkname = $entry->{linkname};
339 my $size = $entry->{size};
340 my ($major, $minor);
341 if ($entry->isDevice) {
342 $major = $entry->{major};
343 $minor = $entry->{minor};
344 } else {
345 $major = 0;
346 $minor = 0;
347 }
348 my ($uname, $gname);
349 if (defined $entry->{uname}) {
350 $uname = $entry->{uname};
351 } else {
352 $uname = $entry->{uid};
353 }
354 if (defined $entry->{gname}) {
355 $gname = $entry->{gname};
356 } else {
357 $gname = $entry->{gid};
358 }
359
360 if (defined $entry->{cwd}) {
361 my $cwd = $entry->{cwd};
362 $cwd.='/' unless $cwd =~ m/\/$/o;
363 $linkname =~ s/^\Q$cwd\E//;
364 }
365 if (!defined $linkname) {
366 $linkname = '';
367 }
368 if (length $prefix > MAXPREFIX) {
369 $prefix = substr($prefix, 0, MAXPREFIX);
370 $extendedname = 1;
371 }
372 if (length $name > MAXFILENAME) {
373 $name = substr($name, 0, MAXPREFIX);
374 $extendedname = 1;
375 }
376 if (length $linkname > MAXLINKNAME) {
377 $linkname = substr($linkname, 0, MAXLINKNAME);
378 $extendedlink = 1;
379 }
380 if (length $uname > MAXUSERNAME) {
381 $archive->fatal("Username too long #1", $uname);
382 }
383 if (length $gname > MAXGROUPNAME) {
384 $archive->fatal("Groupname too long #1", $gname);
385 }
386 my $header = $archive->pack_header($type, $size, $entry,
387 $prefix, $name, $linkname, $uname, $gname, $major, $minor);
388 my $x;
389 if ($extendedname) {
390 $x .= extended_record("path", $entry->name);
391 }
392 if ($extendedlink) {
393 $x .= extended_record("linkpath",$entry->{linkname});
394 }
395 if ($x) {
396 my $extended = $archive->pack_header(XHDR, length($x), $entry,
397 '', $whatever, '', $uname, $gname, $major, $minor);
398 $whatever++;
399 if ((length $x) % 512) {
400 $x .= "\0" x (512 - ((length $x) % 512));
401 }
402 return $extended.$x.$header;
403 }
404 return $header;
405}
406
407sub prepare
408{
409 my ($self, $filename, $destdir) = @_;
410
411 $destdir //= $self->{destdir};
412 my $realname = "$destdir/$filename";
413
414 my ($dev, $ino, $mode, $uid, $gid, $rdev, $size, $mtime) =
415 (lstat $realname)[0,1,2, 4,5,6,7, 9];
416
417 my $entry = {
418 key => "$dev/$ino",
419 name => $filename,
420 realname => $realname,
421 mode => $mode,
422 uid => $uid,
423 gid => $gid,
424 size => $size,
425 mtime => $mtime,
426 uname => $unamecache->lookup($uid),
427 gname => $gnamecache->lookup($gid),
428 major => $rdev/256,
429 minor => $rdev%256,
430 };
431 my $k = $entry->{key};
432 my $class = "OpenBSD::Ustar::File"; # default
433 if (defined $self->{key}{$k}) {
434 $entry->{linkname} = $self->{key}{$k};
435 $class = "OpenBSD::Ustar::HardLink";
436 } elsif (-l $realname) {
437 $entry->{linkname} = readlink($realname);
438 $class = "OpenBSD::Ustar::SoftLink";
439 } elsif (-p _) {
440 $class = "OpenBSD::Ustar::Fifo";
441 } elsif (-c _) {
442 $class = "OpenBSD::Ustar::CharDevice";
443 } elsif (-b _) {
444 $class ="OpenBSD::Ustar::BlockDevice";
445 } elsif (-d _) {
446 $class = "OpenBSD::Ustar::Dir";
447 }
448 $self->new_object($entry, $class);
449 if (!$entry->isFile) {
450 $entry->{size} = 0;
451 }
452 return $entry;
453}
454
455sub pad
456{
457 my $self = shift;
458 my $fh = $self->{fh};
459 print $fh "\0"x1024 or $self->fatal("Error writing to archive: #1", $!);
460}
461
462sub close
463{
464 my $self = shift;
465 if (defined $self->{padout}) {
466 $self->pad;
467 }
468 close($self->{fh});
469}
470
471sub destdir
472{
473 my $self = shift;
474 if (@_ > 0) {
475 $self->{destdir} = shift;
476 } else {
477 return $self->{destdir};
478 }
479}
480
481sub fh
482{
483 return $_[0]->{fh};
484}
485
486package OpenBSD::Ustar::Object;
487
488sub recheck_owner
489{
490 my $entry = shift;
491 # XXX weird format to prevent cvs from expanding OpenBSD id
492 $entry->{uid} //= $OpenBSD::Ustar::uidcache
493 ->lookup($entry->{uname});
494 $entry->{gid} //= $OpenBSD::Ustar::gidcache
495 ->lookup($entry->{gname});
496}
497
498sub fatal
499{
500 my ($self, @args) = @_;
501 $self->{archive}->fatal(@args);
502}
503
504sub system
505{
506 my ($self, @args) = @_;
507 $self->{archive}{state}->system(@args);
508}
509
510sub errsay
511{
512 my ($self, @args) = @_;
513 $self->{archive}{state}->errsay(@args);
514}
515sub left_todo
516
# spent 213µs within OpenBSD::Ustar::Object::left_todo which was called 40 times, avg 5µs/call: # 40 times (213µs+0s) by OpenBSD::Ustar::File::create at line 843, avg 5µs/call
{
5174043µs my ($self, $toread) = @_;
51840149µs return if $toread == 0;
519 return unless defined $self->{archive}{callback};
520 &{$self->{archive}{callback}}($self->{size} - $toread);
521}
522
523sub name
524
# spent 546µs within OpenBSD::Ustar::Object::name which was called 160 times, avg 3µs/call: # 40 times (156µs+0s) by OpenBSD::Ustar::Object::make_basedir at line 560, avg 4µs/call # 40 times (137µs+0s) by OpenBSD::Ustar::File::create at line 813, avg 3µs/call # 40 times (133µs+0s) by OpenBSD::Ustar::Object::set_modes at line 539, avg 3µs/call # 40 times (120µs+0s) by OpenBSD::Ustar::Object::set_modes at line 538, avg 3µs/call
{
525160137µs my $self = shift;
526160759µs return $self->{name};
527}
528
529sub set_name
530{
531 my ($self, $v) = @_;
532 $self->{name} = $v;
533}
534
535sub set_modes
536
# spent 2.30ms (925µs+1.38) within OpenBSD::Ustar::Object::set_modes which was called 40 times, avg 58µs/call: # 40 times (925µs+1.38ms) by OpenBSD::Ustar::File::create at line 847, avg 58µs/call
{
5374043µs my $self = shift;
538401.14ms80938µs chown $self->{uid}, $self->{gid}, $self->{destdir}.$self->name;
# spent 819µs making 40 calls to OpenBSD::Ustar::Object::CORE:chown, avg 20µs/call # spent 120µs making 40 calls to OpenBSD::Ustar::Object::name, avg 3µs/call
53940606µs80442µs chmod $self->{mode}, $self->{destdir}.$self->name;
# spent 309µs making 40 calls to OpenBSD::Ustar::Object::CORE:chmod, avg 8µs/call # spent 133µs making 40 calls to OpenBSD::Ustar::Object::name, avg 3µs/call
54040194µs if (defined $self->{mtime} || defined $self->{atime}) {
541 utime $self->{atime} // time, $self->{mtime} // time,
542 $self->{destdir}.$self->name;
543 }
544}
545
546sub ensure_dir
547
# spent 776µs (314+462) within OpenBSD::Ustar::Object::ensure_dir which was called 40 times, avg 19µs/call: # 40 times (314µs+462µs) by OpenBSD::Ustar::Object::make_basedir at line 561, avg 19µs/call
{
5484042µs my ($self, $dir) = @_;
54940784µs40462µs return if -d $dir;
# spent 462µs making 40 calls to OpenBSD::Ustar::Object::CORE:ftdir, avg 12µs/call
550 $self->ensure_dir(File::Basename::dirname($dir));
551 if (mkdir($dir)) {
552 return;
553 }
554 $self->fatal("Error making directory #1: #2", $dir, $!);
555}
556
557sub make_basedir
558
# spent 7.57ms (1.48+6.09) within OpenBSD::Ustar::Object::make_basedir which was called 40 times, avg 189µs/call: # 40 times (1.48ms+6.09ms) by OpenBSD::Ustar::File::create at line 811, avg 189µs/call
{
5594043µs my $self = shift;
56040372µs805.32ms my $dir = $self->{destdir}.File::Basename::dirname($self->name);
# spent 5.16ms making 40 calls to File::Basename::dirname, avg 129µs/call # spent 156µs making 40 calls to OpenBSD::Ustar::Object::name, avg 4µs/call
56140300µs40776µs $self->ensure_dir($dir);
# spent 776µs making 40 calls to OpenBSD::Ustar::Object::ensure_dir, avg 19µs/call
562}
563
564sub write
565{
566 my $self = shift;
567 my $arc = $self->{archive};
568 my $out = $arc->{fh};
569
570 $arc->{padout} = 1;
571 my $header = $arc->mkheader($self, $self->type);
572 print $out $header or $self->fatal("Error writing to archive: #1", $!);
573 $self->write_contents($arc);
574 my $k = $self->{key};
575 if (!defined $arc->{key}{$k}) {
576 $arc->{key}{$k} = $self->name;
577 }
578}
579
580sub alias
581{
582 my ($self, $arc, $alias) = @_;
583
584 my $k = $self->{archive}.":".$self->{archive}{cachename};
585 if (!defined $arc->{key}{$k}) {
586 $arc->{key}{$k} = $alias;
587 }
588}
589
590sub write_contents
591{
592 # only files have anything to write
593}
594
595sub resolve_links
596{
597 # only hard links must cheat
598}
599
600sub copy_contents
601{
602 # only files need copying
603}
604
605sub copy
606{
607 my ($self, $wrarc) = @_;
608 my $out = $wrarc->{fh};
609 $self->resolve_links($wrarc);
610 $wrarc->{padout} = 1;
611 my $header = $wrarc->mkheader($self, $self->type);
612 print $out $header or $self->fatal("Error writing to archive: #1", $!);
613
614 $self->copy_contents($wrarc);
615}
616
617sub isDir() { 0 }
618sub isFile() { 0 }
619sub isDevice() { 0 }
620sub isFifo() { 0 }
621sub isLink() { 0 }
622sub isSymLink() { 0 }
623sub isHardLink() { 0 }
624
625package OpenBSD::Ustar::Dir;
62616µsour @ISA=qw(OpenBSD::Ustar::Object);
627
628sub create
629{
630 my $self = shift;
631 $self->ensure_dir($self->{destdir}.$self->name);
632 $self->set_modes;
633}
634
635sub isDir() { 1 }
636
637sub type() { OpenBSD::Ustar::DIR }
638
639package OpenBSD::Ustar::HardLink;
64013µsour @ISA=qw(OpenBSD::Ustar::Object);
641
642sub create
643{
644 my $self = shift;
645 $self->make_basedir;
646 my $linkname = $self->{linkname};
647 if (defined $self->{cwd}) {
648 $linkname=$self->{cwd}.'/'.$linkname;
649 }
650 link $self->{destdir}.$linkname, $self->{destdir}.$self->name or
651 $self->fatal("Can't link #1#2 to #1#3: #4",
652 $self->{destdir}, $linkname, $self->name, $!);
653}
654
655sub resolve_links
656{
657 my ($self, $arc) = @_;
658
659 my $k = $self->{archive}.":".$self->{linkname};
660 if (defined $arc->{key}{$k}) {
661 $self->{linkname} = $arc->{key}{$k};
662 } else {
663 print join("\n", keys(%{$arc->{key}})), "\n";
664 $self->fatal("Can't copy link over: original for #1 NOT available", $k);
665 }
666}
667
668sub isLink() { 1 }
669sub isHardLink() { 1 }
670
671sub type() { OpenBSD::Ustar::HARDLINK }
672
673package OpenBSD::Ustar::SoftLink;
67412µsour @ISA=qw(OpenBSD::Ustar::Object);
675
676sub create
677{
678 my $self = shift;
679 $self->make_basedir;
680 symlink $self->{linkname}, $self->{destdir}.$self->name or
681 $self->fatal("Can't symlink #1 to #2#3: #4",
682 $self->{linkname}, $self->{destdir}, $self->name, $!);
683 require POSIX;
684 POSIX::lchown($self->{uid}, $self->{gid}, $self->{destdir}.$self->name);
685}
686
687sub isLink() { 1 }
688sub isSymLink() { 1 }
689
690sub type() { OpenBSD::Ustar::SOFTLINK }
691
692package OpenBSD::Ustar::Fifo;
69312µsour @ISA=qw(OpenBSD::Ustar::Object);
694
695sub create
696{
697 my $self = shift;
698 $self->make_basedir;
699 require POSIX;
700 POSIX::mkfifo($self->{destdir}.$self->name, $self->{mode}) or
701 $self->fatal("Can't create fifo #1#2: #3", $self->{destdir},
702 $self->name, $!);
703 $self->set_modes;
704}
705
706sub isFifo() { 1 }
707sub type() { OpenBSD::Ustar::FIFO }
708
709package OpenBSD::UStar::Device;
71013µsour @ISA=qw(OpenBSD::Ustar::Object);
711
712sub create
713{
714 my $self = shift;
715 $self->make_basedir;
716 $self->system(OpenBSD::Paths->mknod,
717 '-m', $self->{mode}, '--', $self->{destdir}.$self->name,
718 $self->devicetype, $self->{major}, $self->{minor});
719 $self->set_modes;
720}
721
722sub isDevice() { 1 }
723
724package OpenBSD::Ustar::BlockDevice;
72514µsour @ISA=qw(OpenBSD::Ustar::Device);
726
727sub type() { OpenBSD::Ustar::BLOCKDEVICE }
728sub devicetype() { 'b' }
729
730package OpenBSD::Ustar::CharDevice;
73113µsour @ISA=qw(OpenBSD::Ustar::Device);
732
733sub type() { OpenBSD::Ustar::BLOCKDEVICE }
734sub devicetype() { 'c' }
735
736package OpenBSD::CompactWriter;
737
738
# spent 162µs (13+149) within OpenBSD::CompactWriter::BEGIN@738 which was called: # once (13µs+149µs) by OpenBSD::PackageLocation::_opened at line 743
use constant {
73911µs FH => 0,
740 BS => 1,
741 ZEROES => 2,
742 UNFINISHED => 3,
74311.06ms2311µs};
# spent 162µs making 1 call to OpenBSD::CompactWriter::BEGIN@738 # spent 149µs making 1 call to constant::import
744
745sub new
746
# spent 2.80ms (1.54+1.26) within OpenBSD::CompactWriter::new which was called 40 times, avg 70µs/call: # 40 times (1.54ms+1.26ms) by OpenBSD::Ustar::File::create at line 813, avg 70µs/call
{
7474048µs my ($class, $fname) = @_;
748401.65ms401.16ms open (my $out, '>', $fname) or return;
# spent 1.16ms making 40 calls to OpenBSD::CompactWriter::CORE:open, avg 29µs/call
74940436µs40100µs my $bs = (stat $out)[11];
# spent 100µs making 40 calls to OpenBSD::CompactWriter::CORE:stat, avg 3µs/call
7504031µs my $zeroes;
75140349µs if (defined $bs) {
752 $zeroes = "\x00"x$bs;
753 }
75440320µs bless [ $out, $bs, $zeroes, 0 ], $class;
755}
756
757sub write
758
# spent 2.10ms (830µs+1.27) within OpenBSD::CompactWriter::write which was called 40 times, avg 53µs/call: # 40 times (830µs+1.27ms) by OpenBSD::Ustar::File::create at line 837, avg 53µs/call
{
75940146µs my ($self, $buffer) = @_;
7604076µs my ($fh, $bs, $zeroes, $e) = @$self;
761START:
7624070µs if (defined $bs) {
76340135µs for (my $i = 0; $i + $bs <= length($buffer); $i+= $bs) {
764 if (substr($buffer, $i, $bs) eq $zeroes) {
765 my $r = syswrite($fh, $buffer, $i);
766 unless (defined $r && $r == $i) {
767 return 0;
768 }
769 $i+=$bs;
770 my $seek_forward = $bs;
771 while (substr($buffer, $i, $bs) eq $zeroes) {
772 $i += $bs;
773 $seek_forward += $bs;
774 }
775 defined(sysseek($fh, $seek_forward, 1))
776 or return 0;
777 $buffer = substr($buffer, $i);
778 if (length $buffer == 0) {
779 $self->[UNFINISHED] = 1;
780 return 1;
781 }
782 goto START;
783 }
784 }
785 }
7864045µs $self->[UNFINISHED] = 0;
787401.48ms401.27ms my $r = syswrite($fh, $buffer);
# spent 1.27ms making 40 calls to OpenBSD::CompactWriter::CORE:syswrite, avg 32µs/call
78840191µs if (defined $r && $r == length $buffer) {
789 return 1;
790 } else {
791 return 0;
792 }
793}
794
795sub close
796
# spent 200µs within OpenBSD::CompactWriter::close which was called 40 times, avg 5µs/call: # 40 times (200µs+0s) by OpenBSD::Ustar::File::create at line 846, avg 5µs/call
{
7974048µs my ($self) = @_;
7984052µs if ($self->[UNFINISHED]) {
799 defined(sysseek($self->[FH], -1, 1)) or return 0;
800 defined(syswrite($self->[FH], "\0")) or return 0;
801 }
80240157µs return 1;
803}
804
805package OpenBSD::Ustar::File;
80612µsour @ISA=qw(OpenBSD::Ustar::Object);
807
808sub create
809
# spent 21.4ms (3.43+17.9) within OpenBSD::Ustar::File::create which was called 40 times, avg 534µs/call: # 40 times (3.43ms+17.9ms) by OpenBSD::PackageLocation::grab_info at line 170 of OpenBSD/PackageLocation.pm, avg 534µs/call
{
8104043µs my $self = shift;
81140698µs407.57ms $self->make_basedir;
# spent 7.57ms making 40 calls to OpenBSD::Ustar::Object::make_basedir, avg 189µs/call
8124036µs my $buffer;
81340797µs802.94ms my $out = OpenBSD::CompactWriter->new($self->{destdir}.$self->name);
# spent 2.80ms making 40 calls to OpenBSD::CompactWriter::new, avg 70µs/call # spent 137µs making 40 calls to OpenBSD::Ustar::Object::name, avg 3µs/call
8144040µs if (!defined $out) {
815 $self->fatal("Can't write to #1#2: #3", $self->{destdir},
816 $self->name, $!);
817 }
8184055µs my $toread = $self->{size};
8194048µs if ($self->{partial}) {
820 $toread -= length($self->{partial});
821 unless ($out->write($self->{partial})) {
822 $self->fatal("Error writing to #1#2: #3",
823 $self->{destdir}, $self->name, $!);
824 }
825 }
8264084µs while ($toread > 0) {
8274039µs my $maxread = $buffsize;
8284047µs $maxread = $toread if $maxread > $toread;
82940357µs804.95ms my $actual = read($self->{archive}{fh}, $buffer, $maxread);
# spent 2.60ms making 40 calls to OpenBSD::Ustar::File::CORE:read, avg 65µs/call # spent 2.36ms making 40 calls to IO::Uncompress::Base::read, avg 59µs/call
8304035µs if (!defined $actual) {
831 $self->fatal("Error reading from archive: #1", $!);
832 }
8334062µs if ($actual == 0) {
834 $self->fatal("Premature end of archive");
835 }
8364058µs $self->{archive}{swallow} -= $actual;
83740174µs402.10ms unless ($out->write($buffer)) {
# spent 2.10ms making 40 calls to OpenBSD::CompactWriter::write, avg 53µs/call
838 $self->fatal("Error writing to #1#2: #3",
839 $self->{destdir}, $self->name, $!);
840 }
841
8424066µs $toread -= $actual;
84340350µs40213µs $self->left_todo($toread);
# spent 213µs making 40 calls to OpenBSD::Ustar::Object::left_todo, avg 5µs/call
844 }
845 $out->close or $self->fatal("Error closing #1#2: #3",
84640144µs40200µs $self->{destdir}, $self->name, $!);
# spent 200µs making 40 calls to OpenBSD::CompactWriter::close, avg 5µs/call
84740821µs402.30ms $self->set_modes;
# spent 2.30ms making 40 calls to OpenBSD::Ustar::Object::set_modes, avg 58µs/call
848}
849
850sub contents
851
# spent 78.6ms (1.75+76.9) within OpenBSD::Ustar::File::contents which was called 40 times, avg 1.97ms/call: # 40 times (1.75ms+76.9ms) by OpenBSD::PackageLocation::find_contents at line 119 of OpenBSD/PackageLocation.pm, avg 1.97ms/call
{
8524060µs my ($self, $lookfor) = @_;
8534058µs my $toread = $self->{size};
8544038µs my $buffer;
8554044µs my $offset = 0;
8564051µs if ($self->{partial}) {
857 $buffer = $self->{partial};
858 $offset = length($self->{partial});
859 $toread -= $offset;
860 }
861
8624082µs while ($toread != 0) {
8634037µs my $sz = $toread;
8644038µs if (defined $lookfor) {
865 last if (defined $buffer) and &$lookfor($buffer);
866 $sz = 1024 if $sz > 1024;
867 }
86840387µs80153ms my $actual = read($self->{archive}{fh}, $buffer, $sz, $offset);
# spent 76.9ms making 40 calls to OpenBSD::Ustar::File::CORE:read, avg 1.92ms/call # spent 76.6ms making 40 calls to IO::Uncompress::Base::read, avg 1.92ms/call
8694035µs if (!defined $actual) {
870 $self->fatal("Error reading from archive: #1", $!);
871 }
8724044µs if ($actual != $sz) {
873 $self->fatal("Error: short read from archive");
874 }
8754066µs $self->{archive}{swallow} -= $actual;
8764035µs $toread -= $actual;
8774086µs $offset += $actual;
878 }
879
88040215µs $self->{partial} = $buffer;
88140162µs return $buffer;
882}
883
884sub write_contents
885{
886 my ($self, $arc) = @_;
887 my $filename = $self->{realname};
888 my $size = $self->{size};
889 my $out = $arc->{fh};
890 open my $fh, "<", $filename or $self->fatal("Can't read file #1: #2",
891 $filename, $!);
892
893 my $buffer;
894 my $toread = $size;
895 while ($toread > 0) {
896 my $maxread = $buffsize;
897 $maxread = $toread if $maxread > $toread;
898 my $actual = read($fh, $buffer, $maxread);
899 if (!defined $actual) {
900 $self->fatal("Error reading from file: #1", $!);
901 }
902 if ($actual == 0) {
903 $self->fatal("Premature end of file");
904 }
905 unless (print $out $buffer) {
906 $self->fatal("Error writing to archive: #1", $!);
907 }
908
909 $toread -= $actual;
910 $self->left_todo($toread);
911 }
912 if ($size % 512) {
913 print $out "\0" x (512 - $size % 512) or
914 $self->fatal("Error writing to archive: #1", $!);
915 }
916}
917
918sub copy_contents
919{
920 my ($self, $arc) = @_;
921 my $out = $arc->{fh};
922 my $buffer;
923 my $size = $self->{size};
924 my $toread = $size;
925 while ($toread > 0) {
926 my $maxread = $buffsize;
927 $maxread = $toread if $maxread > $toread;
928 my $actual = read($self->{archive}{fh}, $buffer, $maxread);
929 if (!defined $actual) {
930 $self->fatal("Error reading from archive: #1", $!);
931 }
932 if ($actual == 0) {
933 $self->fatal("Premature end of archive");
934 }
935 $self->{archive}{swallow} -= $actual;
936 unless (print $out $buffer) {
937 $self->fatal("Error writing to archive #1", $!);
938 }
939
940 $toread -= $actual;
941 }
942 if ($size % 512) {
943 print $out "\0" x (512 - $size % 512) or
944 $self->fatal("Error writing to archive: #1", $!);
945 }
946 $self->alias($arc, $self->name);
947}
948
949sub isFile() { 1 }
950
951sub type() { OpenBSD::Ustar::FILE1 }
952
953111µs1;
 
# spent 1.16ms within OpenBSD::CompactWriter::CORE:open which was called 40 times, avg 29µs/call: # 40 times (1.16ms+0s) by OpenBSD::CompactWriter::new at line 748, avg 29µs/call
sub OpenBSD::CompactWriter::CORE:open; # opcode
# spent 100µs within OpenBSD::CompactWriter::CORE:stat which was called 40 times, avg 3µs/call: # 40 times (100µs+0s) by OpenBSD::CompactWriter::new at line 749, avg 3µs/call
sub OpenBSD::CompactWriter::CORE:stat; # opcode
# spent 1.27ms within OpenBSD::CompactWriter::CORE:syswrite which was called 40 times, avg 32µs/call: # 40 times (1.27ms+0s) by OpenBSD::CompactWriter::write at line 787, avg 32µs/call
sub OpenBSD::CompactWriter::CORE:syswrite; # opcode
# spent 463µs within OpenBSD::Ustar::CORE:match which was called 119 times, avg 4µs/call: # 119 times (463µs+0s) by OpenBSD::Ustar::next at line 224, avg 4µs/call
sub OpenBSD::Ustar::CORE:match; # opcode
# spent 45.8ms (1.18+44.6) within OpenBSD::Ustar::CORE:read which was called 201 times, avg 228µs/call: # 122 times (745µs+41.4ms) by OpenBSD::Ustar::next at line 188, avg 345µs/call # 79 times (436µs+3.21ms) by OpenBSD::Ustar::skip at line 113, avg 46µs/call
sub OpenBSD::Ustar::CORE:read; # opcode
# spent 4.09ms within OpenBSD::Ustar::CORE:subst which was called 476 times, avg 9µs/call: # 119 times (2.66ms+0s) by OpenBSD::Ustar::next at line 209, avg 22µs/call # 119 times (712µs+0s) by OpenBSD::Ustar::next at line 211, avg 6µs/call # 119 times (460µs+0s) by OpenBSD::Ustar::next at line 212, avg 4µs/call # 119 times (258µs+0s) by OpenBSD::Ustar::next at line 213, avg 2µs/call
sub OpenBSD::Ustar::CORE:subst; # opcode
# spent 1.53ms within OpenBSD::Ustar::CORE:unpack which was called 238 times, avg 6µs/call: # 119 times (1.15ms+0s) by OpenBSD::Ustar::next at line 196, avg 10µs/call # 119 times (388µs+0s) by OpenBSD::Ustar::next at line 205, avg 3µs/call
sub OpenBSD::Ustar::CORE:unpack; # opcode
# spent 79.5ms (495µs+79.0) within OpenBSD::Ustar::File::CORE:read which was called 80 times, avg 993µs/call: # 40 times (257µs+76.6ms) by OpenBSD::Ustar::File::contents at line 868, avg 1.92ms/call # 40 times (238µs+2.36ms) by OpenBSD::Ustar::File::create at line 829, avg 65µs/call
sub OpenBSD::Ustar::File::CORE:read; # opcode
# spent 466µs within OpenBSD::Ustar::File::isFile which was called 238 times, avg 2µs/call: # 119 times (190µs+0s) by OpenBSD::Ustar::next at line 262, avg 2µs/call # 79 times (228µs+0s) by OpenBSD::PackageLocation::grab_info at line 166 of OpenBSD/PackageLocation.pm, avg 3µs/call # 40 times (48µs+0s) by OpenBSD::PackageLocation::find_contents at line 116 of OpenBSD/PackageLocation.pm, avg 1µs/call
sub OpenBSD::Ustar::File::isFile; # xsub
# spent 309µs within OpenBSD::Ustar::Object::CORE:chmod which was called 40 times, avg 8µs/call: # 40 times (309µs+0s) by OpenBSD::Ustar::Object::set_modes at line 539, avg 8µs/call
sub OpenBSD::Ustar::Object::CORE:chmod; # opcode
# spent 819µs within OpenBSD::Ustar::Object::CORE:chown which was called 40 times, avg 20µs/call: # 40 times (819µs+0s) by OpenBSD::Ustar::Object::set_modes at line 538, avg 20µs/call
sub OpenBSD::Ustar::Object::CORE:chown; # opcode
# spent 462µs within OpenBSD::Ustar::Object::CORE:ftdir which was called 40 times, avg 12µs/call: # 40 times (462µs+0s) by OpenBSD::Ustar::Object::ensure_dir at line 549, avg 12µs/call
sub OpenBSD::Ustar::Object::CORE:ftdir; # opcode