| Filename | /usr/libdata/perl5/OpenBSD/Paths.pm |
| Statements | Executed 19 statements in 6.39ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.95ms | 2.95ms | OpenBSD::Paths::CORE:backtick (opcode) |
| 1 | 1 | 1 | 1.76ms | 1.76ms | OpenBSD::Paths::CORE:open (opcode) |
| 1 | 1 | 1 | 218µs | 2.13ms | OpenBSD::Paths::compute_osversion |
| 1 | 1 | 1 | 72µs | 72µs | OpenBSD::Paths::CORE:readline (opcode) |
| 1 | 1 | 1 | 70µs | 70µs | OpenBSD::Paths::CORE:close (opcode) |
| 1 | 1 | 1 | 66µs | 3.02ms | OpenBSD::Paths::machine_architecture |
| 1 | 1 | 1 | 22µs | 2.15ms | OpenBSD::Paths::os_directory |
| 1 | 1 | 1 | 18µs | 22µs | OpenBSD::PackageInfo::BEGIN@18.6 |
| 1 | 1 | 1 | 15µs | 15µs | OpenBSD::Paths::CORE:match (opcode) |
| 1 | 1 | 1 | 9µs | 17µs | OpenBSD::PackageInfo::BEGIN@19.7 |
| 1 | 1 | 1 | 9µs | 9µs | OpenBSD::Paths::ftp |
| 2 | 2 | 2 | 3µs | 3µs | OpenBSD::Paths::pkgdb (xsub) |
| 1 | 1 | 1 | 2µs | 2µs | OpenBSD::Paths::vartmp (xsub) |
| 1 | 1 | 1 | 2µs | 2µs | OpenBSD::Paths::sysctl (xsub) |
| 1 | 1 | 1 | 1µs | 1µs | OpenBSD::Paths::installurl (xsub) |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Paths::architecture |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Paths::font_cruft |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Paths::library_dirs |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Paths::man_cruft |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Paths::os_version |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::Paths::signifykey |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # ex:ts=8 sw=4: | ||||
| 2 | # $OpenBSD: Paths.pm,v 1.35 2017/03/01 17:52:00 rpe Exp $ | ||||
| 3 | # | ||||
| 4 | # Copyright (c) 2007-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 | 2 | 28µs | 2 | 26µs | # spent 22µs (18+4) within OpenBSD::PackageInfo::BEGIN@18.6 which was called:
# once (18µs+4µs) by OpenBSD::PackageInfo::BEGIN@30 at line 18 # spent 22µs making 1 call to OpenBSD::PackageInfo::BEGIN@18.6
# spent 4µs making 1 call to strict::import |
| 19 | 2 | 1.16ms | 2 | 24µs | # spent 17µs (9+8) within OpenBSD::PackageInfo::BEGIN@19.7 which was called:
# once (9µs+8µs) by OpenBSD::PackageInfo::BEGIN@30 at line 19 # spent 17µs making 1 call to OpenBSD::PackageInfo::BEGIN@19.7
# spent 8µs making 1 call to warnings::import |
| 20 | |||||
| 21 | package OpenBSD::Paths; | ||||
| 22 | |||||
| 23 | # Commands | ||||
| 24 | sub ldconfig() { '/sbin/ldconfig' } | ||||
| 25 | sub chroot() { '/usr/sbin/chroot' } | ||||
| 26 | sub mkfontscale() { '/usr/X11R6/bin/mkfontscale' } | ||||
| 27 | sub mkfontdir() { '/usr/X11R6/bin/mkfontdir' } | ||||
| 28 | sub fc_cache() { '/usr/X11R6/bin/fc-cache' } | ||||
| 29 | sub install_info() { '/usr/bin/install-info' } | ||||
| 30 | sub useradd() { '/usr/sbin/useradd' } | ||||
| 31 | sub groupadd() { '/usr/sbin/groupadd' } | ||||
| 32 | sub sysctl() { '/sbin/sysctl' } | ||||
| 33 | sub openssl() { '/usr/bin/openssl' } | ||||
| 34 | sub pkgca() { '/etc/ssl/pkgca.pem' } | ||||
| 35 | sub signify() { '/usr/bin/signify' } | ||||
| 36 | sub signifykey { my $s = $_[1]; "/etc/signify/$s.pub" } | ||||
| 37 | sub pkg_add() { '/usr/sbin/pkg_add' } | ||||
| 38 | sub chmod() { '/bin/chmod' } # external command is used for symbolic modes. | ||||
| 39 | sub gzip() { '/usr/bin/gzip' } | ||||
| 40 | 1 | 9µs | # spent 9µs within OpenBSD::Paths::ftp which was called:
# once (9µs+0s) by OpenBSD::PackageRepository::HTTPorFTP::get_http_list at line 911 of OpenBSD/PackageRepository.pm | ||
| 41 | sub groff() { '/usr/local/bin/groff' } | ||||
| 42 | sub sh() { '/bin/sh' } | ||||
| 43 | sub arch() { '/usr/bin/arch' } | ||||
| 44 | sub uname() { '/usr/bin/uname' } | ||||
| 45 | sub userdel() { '/usr/sbin/userdel' } | ||||
| 46 | sub groupdel() { '/usr/sbin/groupdel' } | ||||
| 47 | sub makewhatis() { '/usr/sbin/makewhatis' } | ||||
| 48 | sub mknod() { '/sbin/mknod' } | ||||
| 49 | sub mount() { '/sbin/mount' } | ||||
| 50 | sub df() { '/bin/df' } | ||||
| 51 | sub ssh() { '/usr/bin/ssh' } | ||||
| 52 | sub make() { '/usr/bin/make' } | ||||
| 53 | sub mklocatedb() { '/usr/libexec/locate.mklocatedb' } | ||||
| 54 | sub hostname() { '/bin/hostname' } | ||||
| 55 | sub doas() { '/usr/bin/doas' } | ||||
| 56 | sub env() { '/usr/bin/env' } | ||||
| 57 | sub du() { '/usr/bin/du' } | ||||
| 58 | sub diff() { '/usr/bin/diff' } | ||||
| 59 | sub sha256() { '/bin/sha256' } | ||||
| 60 | |||||
| 61 | # Various paths | ||||
| 62 | sub shells() { '/etc/shells' } | ||||
| 63 | sub pkgdb() { '/var/db/pkg' } | ||||
| 64 | sub localbase() { '/usr/local' } | ||||
| 65 | sub vartmp() { '/var/tmp' } | ||||
| 66 | sub portsdir() { '/usr/ports' } | ||||
| 67 | |||||
| 68 | sub library_dirs() { ("/usr", "/usr/X11R6") } | ||||
| 69 | sub master_keys() { ("/etc/master_key") } | ||||
| 70 | sub installurl() { "/etc/installurl" } | ||||
| 71 | sub srclocatedb() { "/usr/lib/locate/src.db" } | ||||
| 72 | sub xlocatedb() { "/usr/X11R6/lib/locate/xorg.db" } | ||||
| 73 | |||||
| 74 | sub font_cruft() { ("fonts.alias", "fonts.dir", "fonts.cache-1", "fonts.scale") } | ||||
| 75 | sub man_cruft() { ("whatis.db", "mandoc.db", "mandoc.index") } | ||||
| 76 | sub info_cruft() { ("dir") } | ||||
| 77 | |||||
| 78 | # a bit of code, OS-dependent stuff that's run-time detected and has no | ||||
| 79 | # home yet. | ||||
| 80 | |||||
| 81 | 1 | 700ns | my ($machine_arch, $arch, $osversion, $osdirectory); | ||
| 82 | |||||
| 83 | sub architecture | ||||
| 84 | { | ||||
| 85 | if (!defined $arch) { | ||||
| 86 | my $cmd = uname()." -m"; | ||||
| 87 | chomp($arch = `$cmd`); | ||||
| 88 | } | ||||
| 89 | return $arch; | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | sub machine_architecture | ||||
| 93 | # spent 3.02ms (66µs+2.95) within OpenBSD::Paths::machine_architecture which was called:
# once (66µs+2.95ms) by OpenBSD::PackageRepositoryBase::expand_locations at line 40 of OpenBSD/PackageRepository/Installed.pm | ||||
| 94 | 1 | 2µs | if (!defined $machine_arch) { | ||
| 95 | 1 | 2µs | my $cmd = arch()." -s"; | ||
| 96 | 1 | 3.01ms | 1 | 2.95ms | chomp($machine_arch = `$cmd`); # spent 2.95ms making 1 call to OpenBSD::Paths::CORE:backtick |
| 97 | } | ||||
| 98 | 1 | 27µs | return $machine_arch; | ||
| 99 | } | ||||
| 100 | |||||
| 101 | sub compute_osversion | ||||
| 102 | # spent 2.13ms (218µs+1.91) within OpenBSD::Paths::compute_osversion which was called:
# once (218µs+1.91ms) by OpenBSD::Paths::os_directory at line 126 | ||||
| 103 | 1 | 1.87ms | 2 | 1.76ms | open my $cmd, '-|', OpenBSD::Paths->sysctl, '-n', 'kern.version'; # spent 1.76ms making 1 call to OpenBSD::Paths::CORE:open
# spent 2µs making 1 call to OpenBSD::Paths::sysctl |
| 104 | 1 | 100µs | 1 | 72µs | my $line = <$cmd>; # spent 72µs making 1 call to OpenBSD::Paths::CORE:readline |
| 105 | 1 | 95µs | 1 | 70µs | close($cmd); # spent 70µs making 1 call to OpenBSD::Paths::CORE:close |
| 106 | 1 | 57µs | 1 | 15µs | if ($line =~ m/^OpenBSD (\d\.\d)(\S*)\s/) { # spent 15µs making 1 call to OpenBSD::Paths::CORE:match |
| 107 | 1 | 14µs | $osversion = $1; | ||
| 108 | 1 | 9µs | if ($2 eq '-current' or $2 eq '-beta') { | ||
| 109 | $osdirectory = 'snapshots'; | ||||
| 110 | } else { | ||||
| 111 | $osdirectory = $osversion; | ||||
| 112 | } | ||||
| 113 | } | ||||
| 114 | } | ||||
| 115 | |||||
| 116 | sub os_version | ||||
| 117 | { | ||||
| 118 | if (!defined $osversion) { | ||||
| 119 | compute_osversion(); | ||||
| 120 | } | ||||
| 121 | return $osversion; | ||||
| 122 | } | ||||
| 123 | |||||
| 124 | sub os_directory | ||||
| 125 | # spent 2.15ms (22µs+2.13) within OpenBSD::Paths::os_directory which was called:
# once (22µs+2.13ms) by OpenBSD::PackageRepositoryBase::parse_url at line 73 of OpenBSD/PackageRepository/Installed.pm | ||||
| 126 | 1 | 4µs | 1 | 2.13ms | if (!defined $osversion) { # spent 2.13ms making 1 call to OpenBSD::Paths::compute_osversion |
| 127 | compute_osversion(); | ||||
| 128 | } | ||||
| 129 | 1 | 8µs | return $osdirectory; | ||
| 130 | } | ||||
| 131 | |||||
| 132 | 1 | 4µs | 1; | ||
# spent 2.95ms within OpenBSD::Paths::CORE:backtick which was called:
# once (2.95ms+0s) by OpenBSD::Paths::machine_architecture at line 96 | |||||
# spent 70µs within OpenBSD::Paths::CORE:close which was called:
# once (70µs+0s) by OpenBSD::Paths::compute_osversion at line 105 | |||||
# spent 15µs within OpenBSD::Paths::CORE:match which was called:
# once (15µs+0s) by OpenBSD::Paths::compute_osversion at line 106 | |||||
# spent 1.76ms within OpenBSD::Paths::CORE:open which was called:
# once (1.76ms+0s) by OpenBSD::Paths::compute_osversion at line 103 | |||||
# spent 72µs within OpenBSD::Paths::CORE:readline which was called:
# once (72µs+0s) by OpenBSD::Paths::compute_osversion at line 104 | |||||
# spent 1µs within OpenBSD::Paths::installurl which was called:
# once (1µs+0s) by OpenBSD::State::__ANON__[/usr/libdata/perl5/OpenBSD/State.pm:137] at line 130 of OpenBSD/State.pm | |||||
# spent 3µs within OpenBSD::Paths::pkgdb which was called 2 times, avg 2µs/call:
# once (2µs+0s) by OpenBSD::PkgInfo::State::BEGIN@65 at line 40 of OpenBSD/PackageInfo.pm
# once (1µs+0s) by OpenBSD::PackageRepository::Local::pkg_db at line 472 of OpenBSD/PackageRepository.pm | |||||
# spent 2µs within OpenBSD::Paths::sysctl which was called:
# once (2µs+0s) by OpenBSD::Paths::compute_osversion at line 103 | |||||
# spent 2µs within OpenBSD::Paths::vartmp which was called:
# once (2µs+0s) by OpenBSD::PackageLocation::BEGIN@24 at line 27 of OpenBSD/Temp.pm |