| Filename | /usr/libdata/perl5/OpenBSD/Temp.pm |
| Statements | Executed 1639 statements in 76.6ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 40 | 1 | 1 | 34.7ms | 38.1ms | OpenBSD::Temp::dir |
| 81 | 2 | 1 | 8.29ms | 8.29ms | OpenBSD::Temp::reclaim |
| 41 | 2 | 1 | 2.57ms | 6.65ms | OpenBSD::Temp::file |
| 40 | 1 | 1 | 1.40ms | 3.36ms | OpenBSD::Temp::permanent_dir |
| 41 | 1 | 1 | 774µs | 4.08ms | OpenBSD::Temp::permanent_file |
| 1 | 1 | 1 | 556µs | 1.03ms | OpenBSD::Temp::BEGIN@23 |
| 1 | 1 | 1 | 238µs | 5.24ms | OpenBSD::Temp::__ANON__[:39] |
| 1 | 1 | 1 | 30µs | 54µs | OpenBSD::PackageLocation::BEGIN@19 |
| 1 | 1 | 1 | 19µs | 23µs | OpenBSD::PackageLocation::BEGIN@18 |
| 1 | 1 | 1 | 13µs | 81µs | OpenBSD::Temp::BEGIN@25 |
| 1 | 1 | 1 | 11µs | 5.25ms | OpenBSD::Temp::END |
| 1 | 1 | 1 | 8µs | 8µs | OpenBSD::Temp::BEGIN@24 |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Temp::__ANON__[:49] |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Temp::__ANON__[:70] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # ex:ts=8 sw=4: | ||||
| 2 | # $OpenBSD: Temp.pm,v 1.27 2015/03/04 13:55:32 espie Exp $ | ||||
| 3 | # | ||||
| 4 | # Copyright (c) 2003-2005 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 | 2 | 18.7ms | 2 | 26µs | # spent 23µs (19+4) within OpenBSD::PackageLocation::BEGIN@18 which was called:
# once (19µs+4µs) by OpenBSD::PackageLocation::BEGIN@24 at line 18 # spent 23µs making 1 call to OpenBSD::PackageLocation::BEGIN@18
# spent 4µs making 1 call to strict::import |
| 19 | 2 | 70µs | 2 | 78µs | # spent 54µs (30+24) within OpenBSD::PackageLocation::BEGIN@19 which was called:
# once (30µs+24µs) by OpenBSD::PackageLocation::BEGIN@24 at line 19 # spent 54µs making 1 call to OpenBSD::PackageLocation::BEGIN@19
# spent 24µs making 1 call to warnings::import |
| 20 | |||||
| 21 | package OpenBSD::Temp; | ||||
| 22 | |||||
| 23 | 2 | 278µs | 2 | 1.09ms | # spent 1.03ms (556µs+473µs) within OpenBSD::Temp::BEGIN@23 which was called:
# once (556µs+473µs) by OpenBSD::PackageLocation::BEGIN@24 at line 23 # spent 1.03ms making 1 call to OpenBSD::Temp::BEGIN@23
# spent 60µs making 1 call to Exporter::import |
| 24 | 2 | 29µs | 1 | 8µs | # spent 8µs within OpenBSD::Temp::BEGIN@24 which was called:
# once (8µs+0s) by OpenBSD::PackageLocation::BEGIN@24 at line 24 # spent 8µs making 1 call to OpenBSD::Temp::BEGIN@24 |
| 25 | 2 | 7.53ms | 2 | 150µs | # spent 81µs (13+68) within OpenBSD::Temp::BEGIN@25 which was called:
# once (13µs+68µs) by OpenBSD::PackageLocation::BEGIN@24 at line 25 # spent 81µs making 1 call to OpenBSD::Temp::BEGIN@25
# spent 68µs making 1 call to Exporter::import |
| 26 | |||||
| 27 | 1 | 23µs | 1 | 3µs | our $tempbase = $ENV{'PKG_TMPDIR'} || OpenBSD::Paths->vartmp; # spent 3µs making 1 call to OpenBSD::Paths::vartmp |
| 28 | |||||
| 29 | 1 | 2µs | my $dirs = {}; | ||
| 30 | 1 | 1µs | my $files = {}; | ||
| 31 | |||||
| 32 | # spent 5.24ms (238µs+5.01) within OpenBSD::Temp::__ANON__[/usr/libdata/perl5/OpenBSD/Temp.pm:39] which was called:
# once (238µs+5.01ms) by OpenBSD::Temp::END at line 42 | ||||
| 33 | 1 | 5µs | while (my ($name, $pid) = each %$files) { | ||
| 34 | unlink($name) if $pid == $$; | ||||
| 35 | } | ||||
| 36 | 1 | 206µs | 40 | 5.01ms | while (my ($dir, $pid) = each %$dirs) { # spent 5.01ms making 40 calls to OpenBSD::Error::rmtree, avg 125µs/call |
| 37 | OpenBSD::Error->rmtree([$dir]) if $pid == $$; | ||||
| 38 | } | ||||
| 39 | 1 | 4µs | }; | ||
| 40 | |||||
| 41 | # spent 5.25ms (11µs+5.24) within OpenBSD::Temp::END which was called:
# once (11µs+5.24ms) by main::RUNTIME at line 0 of /usr/sbin/pkg_info | ||||
| 42 | 1 | 7µs | 1 | 5.24ms | &$cleanup; # spent 5.24ms making 1 call to OpenBSD::Temp::__ANON__[OpenBSD/Temp.pm:39] |
| 43 | } | ||||
| 44 | 1 | 7µs | 1 | 8µs | OpenBSD::Handler->register($cleanup); # spent 8µs making 1 call to OpenBSD::Handler::register |
| 45 | |||||
| 46 | sub dir | ||||
| 47 | # spent 38.1ms (34.7+3.36) within OpenBSD::Temp::dir which was called 40 times, avg 951µs/call:
# 40 times (34.7ms+3.36ms) by OpenBSD::PackageLocation::grab_info at line 152 of OpenBSD/PackageLocation.pm, avg 951µs/call | ||||
| 48 | 40 | 36µs | my $caught; | ||
| 49 | 40 | 494µs | my $h = sub { $caught = shift; }; | ||
| 50 | 40 | 35µs | my $dir; | ||
| 51 | |||||
| 52 | { | ||||
| 53 | 80 | 416µs | local $SIG{'INT'} = $h; | ||
| 54 | 40 | 179µs | local $SIG{'QUIT'} = $h; | ||
| 55 | 40 | 168µs | local $SIG{'HUP'} = $h; | ||
| 56 | 40 | 31.4ms | local $SIG{'KILL'} = $h; | ||
| 57 | 40 | 312µs | local $SIG{'TERM'} = $h; | ||
| 58 | 40 | 314µs | 40 | 3.36ms | $dir = permanent_dir($tempbase, "pkginfo"); # spent 3.36ms making 40 calls to OpenBSD::Temp::permanent_dir, avg 84µs/call |
| 59 | 40 | 1.15ms | $dirs->{$dir} = $$; | ||
| 60 | } | ||||
| 61 | 40 | 47µs | if (defined $caught) { | ||
| 62 | kill $caught, $$; | ||||
| 63 | } | ||||
| 64 | 40 | 313µs | return "$dir/"; | ||
| 65 | } | ||||
| 66 | |||||
| 67 | sub file | ||||
| 68 | # spent 6.65ms (2.57+4.08) within OpenBSD::Temp::file which was called 41 times, avg 162µs/call:
# 40 times (2.44ms+3.88ms) by OpenBSD::PackageRepository::make_error_file at line 38 of OpenBSD/PackageRepository.pm, avg 158µs/call
# once (128µs+194µs) by OpenBSD::PackageRepository::HTTPorFTP::list at line 894 of OpenBSD/PackageRepository.pm | ||||
| 69 | 41 | 37µs | my $caught; | ||
| 70 | 41 | 157µs | my $h = sub { $caught = shift; }; | ||
| 71 | 41 | 39µs | my ($fh, $file); | ||
| 72 | |||||
| 73 | { | ||||
| 74 | 82 | 283µs | local $SIG{'INT'} = $h; | ||
| 75 | 41 | 165µs | local $SIG{'QUIT'} = $h; | ||
| 76 | 41 | 154µs | local $SIG{'HUP'} = $h; | ||
| 77 | 41 | 157µs | local $SIG{'KILL'} = $h; | ||
| 78 | 41 | 157µs | local $SIG{'TERM'} = $h; | ||
| 79 | 41 | 190µs | 41 | 4.08ms | ($fh, $file) = permanent_file($tempbase, "pkgout"); # spent 4.08ms making 41 calls to OpenBSD::Temp::permanent_file, avg 99µs/call |
| 80 | 41 | 724µs | if (defined $file) { | ||
| 81 | $files->{$file} = $$; | ||||
| 82 | } | ||||
| 83 | } | ||||
| 84 | 41 | 40µs | if (defined $caught) { | ||
| 85 | kill $caught, $$; | ||||
| 86 | } | ||||
| 87 | 41 | 467µs | return $file; | ||
| 88 | } | ||||
| 89 | |||||
| 90 | sub reclaim | ||||
| 91 | # spent 8.29ms within OpenBSD::Temp::reclaim which was called 81 times, avg 102µs/call:
# 41 times (8.06ms+0s) by OpenBSD::PackageRepository::parse_problems at line 359 of OpenBSD/PackageRepository.pm, avg 196µs/call
# 40 times (230µs+0s) by OpenBSD::PackageRepository::wipe_info at line 185 of OpenBSD/PackageRepository.pm, avg 6µs/call | ||||
| 92 | 81 | 118µs | my ($class, $name) = @_; | ||
| 93 | 81 | 7.69ms | delete $files->{$name}; | ||
| 94 | 81 | 387µs | delete $dirs->{$name}; | ||
| 95 | } | ||||
| 96 | |||||
| 97 | sub permanent_file | ||||
| 98 | # spent 4.08ms (774µs+3.30) within OpenBSD::Temp::permanent_file which was called 41 times, avg 99µs/call:
# 41 times (774µs+3.30ms) by OpenBSD::Temp::file at line 79, avg 99µs/call | ||||
| 99 | 41 | 47µs | my ($dir, $stem) = @_; | ||
| 100 | 41 | 196µs | my $template = "$stem.XXXXXXXXXX"; | ||
| 101 | 41 | 86µs | if (defined $dir) { | ||
| 102 | $template = "$dir/$template"; | ||||
| 103 | } | ||||
| 104 | 41 | 477µs | 41 | 3.30ms | return OpenBSD::MkTemp::mkstemp($template); # spent 3.30ms making 41 calls to OpenBSD::MkTemp::mkstemp, avg 81µs/call |
| 105 | } | ||||
| 106 | |||||
| 107 | sub permanent_dir | ||||
| 108 | # spent 3.36ms (1.40+1.95) within OpenBSD::Temp::permanent_dir which was called 40 times, avg 84µs/call:
# 40 times (1.40ms+1.95ms) by OpenBSD::Temp::dir at line 58, avg 84µs/call | ||||
| 109 | 40 | 313µs | my ($dir, $stem) = @_; | ||
| 110 | 40 | 352µs | my $template = "$stem.XXXXXXXXXX"; | ||
| 111 | 40 | 240µs | if (defined $dir) { | ||
| 112 | $template = "$dir/$template"; | ||||
| 113 | } | ||||
| 114 | 40 | 2.36ms | 40 | 1.95ms | return OpenBSD::MkTemp::mkdtemp($template); # spent 1.95ms making 40 calls to OpenBSD::MkTemp::mkdtemp, avg 49µs/call |
| 115 | } | ||||
| 116 | |||||
| 117 | 1 | 10µs | 1; |