← Index
NYTProf Performance Profile   « line view »
For /usr/sbin/pkg_info
  Run on Fri Aug 4 10:15:59 2017
Reported on Fri Aug 4 10:16:18 2017

Filename/usr/libdata/perl5/OpenBSD/Paths.pm
StatementsExecuted 19 statements in 6.39ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.95ms2.95msOpenBSD::Paths::::CORE:backtick OpenBSD::Paths::CORE:backtick (opcode)
1111.76ms1.76msOpenBSD::Paths::::CORE:open OpenBSD::Paths::CORE:open (opcode)
111218µs2.13msOpenBSD::Paths::::compute_osversion OpenBSD::Paths::compute_osversion
11172µs72µsOpenBSD::Paths::::CORE:readline OpenBSD::Paths::CORE:readline (opcode)
11170µs70µsOpenBSD::Paths::::CORE:close OpenBSD::Paths::CORE:close (opcode)
11166µs3.02msOpenBSD::Paths::::machine_architecture OpenBSD::Paths::machine_architecture
11122µs2.15msOpenBSD::Paths::::os_directory OpenBSD::Paths::os_directory
11118µs22µsOpenBSD::PackageInfo::::BEGIN@18.6OpenBSD::PackageInfo::BEGIN@18.6
11115µs15µsOpenBSD::Paths::::CORE:match OpenBSD::Paths::CORE:match (opcode)
1119µs17µsOpenBSD::PackageInfo::::BEGIN@19.7OpenBSD::PackageInfo::BEGIN@19.7
1119µs9µsOpenBSD::Paths::::ftp OpenBSD::Paths::ftp
2223µs3µsOpenBSD::Paths::::pkgdb OpenBSD::Paths::pkgdb (xsub)
1112µs2µsOpenBSD::Paths::::vartmp OpenBSD::Paths::vartmp (xsub)
1112µs2µsOpenBSD::Paths::::sysctl OpenBSD::Paths::sysctl (xsub)
1111µs1µsOpenBSD::Paths::::installurl OpenBSD::Paths::installurl (xsub)
0000s0sOpenBSD::Paths::::architecture OpenBSD::Paths::architecture
0000s0sOpenBSD::Paths::::font_cruft OpenBSD::Paths::font_cruft
0000s0sOpenBSD::Paths::::library_dirs OpenBSD::Paths::library_dirs
0000s0sOpenBSD::Paths::::man_cruft OpenBSD::Paths::man_cruft
0000s0sOpenBSD::Paths::::os_version OpenBSD::Paths::os_version
0000s0sOpenBSD::Paths::::signifykey OpenBSD::Paths::signifykey
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: 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
18228µs226µ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
use strict;
# spent 22µs making 1 call to OpenBSD::PackageInfo::BEGIN@18.6 # spent 4µs making 1 call to strict::import
1921.16ms224µ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
use warnings;
# spent 17µs making 1 call to OpenBSD::PackageInfo::BEGIN@19.7 # spent 8µs making 1 call to warnings::import
20
21package OpenBSD::Paths;
22
23# Commands
24sub ldconfig() { '/sbin/ldconfig' }
25sub chroot() { '/usr/sbin/chroot' }
26sub mkfontscale() { '/usr/X11R6/bin/mkfontscale' }
27sub mkfontdir() { '/usr/X11R6/bin/mkfontdir' }
28sub fc_cache() { '/usr/X11R6/bin/fc-cache' }
29sub install_info() { '/usr/bin/install-info' }
30sub useradd() { '/usr/sbin/useradd' }
31sub groupadd() { '/usr/sbin/groupadd' }
32sub sysctl() { '/sbin/sysctl' }
33sub openssl() { '/usr/bin/openssl' }
34sub pkgca() { '/etc/ssl/pkgca.pem' }
35sub signify() { '/usr/bin/signify' }
36sub signifykey { my $s = $_[1]; "/etc/signify/$s.pub" }
37sub pkg_add() { '/usr/sbin/pkg_add' }
38sub chmod() { '/bin/chmod' } # external command is used for symbolic modes.
39sub gzip() { '/usr/bin/gzip' }
4019µ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
sub ftp() { $ENV{'FETCH_CMD'} || '/usr/bin/ftp' }
41sub groff() { '/usr/local/bin/groff' }
42sub sh() { '/bin/sh' }
43sub arch() { '/usr/bin/arch' }
44sub uname() { '/usr/bin/uname' }
45sub userdel() { '/usr/sbin/userdel' }
46sub groupdel() { '/usr/sbin/groupdel' }
47sub makewhatis() { '/usr/sbin/makewhatis' }
48sub mknod() { '/sbin/mknod' }
49sub mount() { '/sbin/mount' }
50sub df() { '/bin/df' }
51sub ssh() { '/usr/bin/ssh' }
52sub make() { '/usr/bin/make' }
53sub mklocatedb() { '/usr/libexec/locate.mklocatedb' }
54sub hostname() { '/bin/hostname' }
55sub doas() { '/usr/bin/doas' }
56sub env() { '/usr/bin/env' }
57sub du() { '/usr/bin/du' }
58sub diff() { '/usr/bin/diff' }
59sub sha256() { '/bin/sha256' }
60
61# Various paths
62sub shells() { '/etc/shells' }
63sub pkgdb() { '/var/db/pkg' }
64sub localbase() { '/usr/local' }
65sub vartmp() { '/var/tmp' }
66sub portsdir() { '/usr/ports' }
67
68sub library_dirs() { ("/usr", "/usr/X11R6") }
69sub master_keys() { ("/etc/master_key") }
70sub installurl() { "/etc/installurl" }
71sub srclocatedb() { "/usr/lib/locate/src.db" }
72sub xlocatedb() { "/usr/X11R6/lib/locate/xorg.db" }
73
74sub font_cruft() { ("fonts.alias", "fonts.dir", "fonts.cache-1", "fonts.scale") }
75sub man_cruft() { ("whatis.db", "mandoc.db", "mandoc.index") }
76sub info_cruft() { ("dir") }
77
78# a bit of code, OS-dependent stuff that's run-time detected and has no
79# home yet.
80
811700nsmy ($machine_arch, $arch, $osversion, $osdirectory);
82
83sub architecture
84{
85 if (!defined $arch) {
86 my $cmd = uname()." -m";
87 chomp($arch = `$cmd`);
88 }
89 return $arch;
90}
91
92sub 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
{
9412µs if (!defined $machine_arch) {
9512µs my $cmd = arch()." -s";
9613.01ms12.95ms chomp($machine_arch = `$cmd`);
# spent 2.95ms making 1 call to OpenBSD::Paths::CORE:backtick
97 }
98127µs return $machine_arch;
99}
100
101sub 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
{
10311.87ms21.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
1041100µs172µs my $line = <$cmd>;
# spent 72µs making 1 call to OpenBSD::Paths::CORE:readline
105195µs170µs close($cmd);
# spent 70µs making 1 call to OpenBSD::Paths::CORE:close
106157µs115µs if ($line =~ m/^OpenBSD (\d\.\d)(\S*)\s/) {
# spent 15µs making 1 call to OpenBSD::Paths::CORE:match
107114µs $osversion = $1;
10819µs if ($2 eq '-current' or $2 eq '-beta') {
109 $osdirectory = 'snapshots';
110 } else {
111 $osdirectory = $osversion;
112 }
113 }
114}
115
116sub os_version
117{
118 if (!defined $osversion) {
119 compute_osversion();
120 }
121 return $osversion;
122}
123
124sub 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
{
12614µs12.13ms if (!defined $osversion) {
# spent 2.13ms making 1 call to OpenBSD::Paths::compute_osversion
127 compute_osversion();
128 }
12918µs return $osdirectory;
130}
131
13214µs1;
 
# spent 2.95ms within OpenBSD::Paths::CORE:backtick which was called: # once (2.95ms+0s) by OpenBSD::Paths::machine_architecture at line 96
sub OpenBSD::Paths::CORE:backtick; # opcode
# spent 70µs within OpenBSD::Paths::CORE:close which was called: # once (70µs+0s) by OpenBSD::Paths::compute_osversion at line 105
sub OpenBSD::Paths::CORE:close; # opcode
# spent 15µs within OpenBSD::Paths::CORE:match which was called: # once (15µs+0s) by OpenBSD::Paths::compute_osversion at line 106
sub OpenBSD::Paths::CORE:match; # opcode
# spent 1.76ms within OpenBSD::Paths::CORE:open which was called: # once (1.76ms+0s) by OpenBSD::Paths::compute_osversion at line 103
sub OpenBSD::Paths::CORE:open; # opcode
# spent 72µs within OpenBSD::Paths::CORE:readline which was called: # once (72µs+0s) by OpenBSD::Paths::compute_osversion at line 104
sub OpenBSD::Paths::CORE:readline; # opcode
# 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
sub OpenBSD::Paths::installurl; # xsub
# 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
sub OpenBSD::Paths::pkgdb; # xsub
# spent 2µs within OpenBSD::Paths::sysctl which was called: # once (2µs+0s) by OpenBSD::Paths::compute_osversion at line 103
sub OpenBSD::Paths::sysctl; # xsub
# 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
sub OpenBSD::Paths::vartmp; # xsub