← 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/Paths.pm
StatementsExecuted 19 statements in 101ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.96ms2.96msOpenBSD::Paths::::CORE:backtick OpenBSD::Paths::CORE:backtick (opcode)
1111.79ms1.79msOpenBSD::Paths::::CORE:open OpenBSD::Paths::CORE:open (opcode)
111209µs2.12msOpenBSD::Paths::::compute_osversion OpenBSD::Paths::compute_osversion
111190µs190µsOpenBSD::PackageInfo::::CORE:openOpenBSD::PackageInfo::CORE:open (opcode)
11169µs3.03msOpenBSD::Paths::::machine_architecture OpenBSD::Paths::machine_architecture
11159µs70µsOpenBSD::PackageInfo::::BEGIN@18.6OpenBSD::PackageInfo::BEGIN@18.6
11156µs56µsOpenBSD::Paths::::CORE:close OpenBSD::Paths::CORE:close (opcode)
11154µs54µsOpenBSD::Paths::::CORE:readline OpenBSD::Paths::CORE:readline (opcode)
11133µs33µsOpenBSD::PackageInfo::::CORE:flockOpenBSD::PackageInfo::CORE:flock (opcode)
11132µs54µsOpenBSD::PackageInfo::::BEGIN@19.7OpenBSD::PackageInfo::BEGIN@19.7
11123µs2.14msOpenBSD::Paths::::os_directory OpenBSD::Paths::os_directory
61116µs16µsOpenBSD::PackageInfo::::CORE:substOpenBSD::PackageInfo::CORE:subst (opcode)
11112µs12µsOpenBSD::Paths::::CORE:match OpenBSD::Paths::CORE:match (opcode)
2229µs9µsOpenBSD::Paths::::pkgdb OpenBSD::Paths::pkgdb (xsub)
1117µs7µsOpenBSD::Paths::::ftp OpenBSD::Paths::ftp
1113µs3µ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
182126µs282µs
# spent 70µs (59+12) within OpenBSD::PackageInfo::BEGIN@18.6 which was called: # once (59µs+12µs) by OpenBSD::PackageInfo::BEGIN@30 at line 18
use strict;
# spent 70µs making 1 call to OpenBSD::PackageInfo::BEGIN@18.6 # spent 12µs making 1 call to strict::import
19295.5ms276µs
# spent 54µs (32+22) within OpenBSD::PackageInfo::BEGIN@19.7 which was called: # once (32µs+22µs) by OpenBSD::PackageInfo::BEGIN@30 at line 19
use warnings;
# spent 54µs making 1 call to OpenBSD::PackageInfo::BEGIN@19.7 # spent 22µ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' }
4017µs
# spent 7µs within OpenBSD::Paths::ftp which was called: # once (7µ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
811900nsmy ($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.03ms (69µs+2.96) within OpenBSD::Paths::machine_architecture which was called: # once (69µs+2.96ms) by OpenBSD::PackageRepositoryBase::expand_locations at line 40 of OpenBSD/PackageRepository/Installed.pm
{
9412µs if (!defined $machine_arch) {
9511µs my $cmd = arch()." -s";
9613.02ms12.96ms chomp($machine_arch = `$cmd`);
# spent 2.96ms making 1 call to OpenBSD::Paths::CORE:backtick
97 }
98124µs return $machine_arch;
99}
100
101sub compute_osversion
102
# spent 2.12ms (209µs+1.91) within OpenBSD::Paths::compute_osversion which was called: # once (209µs+1.91ms) by OpenBSD::Paths::os_directory at line 126
{
10311.89ms21.79ms open my $cmd, '-|', OpenBSD::Paths->sysctl, '-n', 'kern.version';
# spent 1.79ms making 1 call to OpenBSD::Paths::CORE:open # spent 2µs making 1 call to OpenBSD::Paths::sysctl
1041102µs154µs my $line = <$cmd>;
# spent 54µs making 1 call to OpenBSD::Paths::CORE:readline
105167µs156µs close($cmd);
# spent 56µs making 1 call to OpenBSD::Paths::CORE:close
106152µs112µs if ($line =~ m/^OpenBSD (\d\.\d)(\S*)\s/) {
# spent 12µs making 1 call to OpenBSD::Paths::CORE:match
107114µs $osversion = $1;
10818µ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.14ms (23µs+2.12) within OpenBSD::Paths::os_directory which was called: # once (23µs+2.12ms) by OpenBSD::PackageRepositoryBase::parse_url at line 73 of OpenBSD/PackageRepository/Installed.pm
{
12614µs12.12ms if (!defined $osversion) {
# spent 2.12ms making 1 call to OpenBSD::Paths::compute_osversion
127 compute_osversion();
128 }
129110µs return $osdirectory;
130}
131
13216µs1;
 
# spent 33µs within OpenBSD::PackageInfo::CORE:flock which was called: # once (33µs+0s) by OpenBSD::PackageInfo::lock_db at line 195 of OpenBSD/PackageInfo.pm
sub OpenBSD::PackageInfo::CORE:flock; # opcode
# spent 190µs within OpenBSD::PackageInfo::CORE:open which was called: # once (190µs+0s) by OpenBSD::PackageInfo::lock_db at line 194 of OpenBSD/PackageInfo.pm
sub OpenBSD::PackageInfo::CORE:open; # opcode
# spent 16µs within OpenBSD::PackageInfo::CORE:subst which was called 6 times, avg 3µs/call: # 6 times (16µs+0s) by OpenBSD::PkgInfo::State::BEGIN@65 at line 49 of OpenBSD/PackageInfo.pm, avg 3µs/call
sub OpenBSD::PackageInfo::CORE:subst; # opcode
# spent 2.96ms within OpenBSD::Paths::CORE:backtick which was called: # once (2.96ms+0s) by OpenBSD::Paths::machine_architecture at line 96
sub OpenBSD::Paths::CORE:backtick; # opcode
# spent 56µs within OpenBSD::Paths::CORE:close which was called: # once (56µs+0s) by OpenBSD::Paths::compute_osversion at line 105
sub OpenBSD::Paths::CORE:close; # opcode
# spent 12µs within OpenBSD::Paths::CORE:match which was called: # once (12µs+0s) by OpenBSD::Paths::compute_osversion at line 106
sub OpenBSD::Paths::CORE:match; # opcode
# spent 1.79ms within OpenBSD::Paths::CORE:open which was called: # once (1.79ms+0s) by OpenBSD::Paths::compute_osversion at line 103
sub OpenBSD::Paths::CORE:open; # opcode
# spent 54µs within OpenBSD::Paths::CORE:readline which was called: # once (54µ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 9µs within OpenBSD::Paths::pkgdb which was called 2 times, avg 5µs/call: # once (5µs+0s) by OpenBSD::PackageRepository::Local::pkg_db at line 472 of OpenBSD/PackageRepository.pm # once (5µs+0s) by OpenBSD::PkgInfo::State::BEGIN@65 at line 40 of OpenBSD/PackageInfo.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 3µs within OpenBSD::Paths::vartmp which was called: # once (3µs+0s) by OpenBSD::PackageLocation::BEGIN@24 at line 27 of OpenBSD/Temp.pm
sub OpenBSD::Paths::vartmp; # xsub