← 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/Temp.pm
StatementsExecuted 1639 statements in 76.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
401134.7ms38.1msOpenBSD::Temp::::dir OpenBSD::Temp::dir
81218.29ms8.29msOpenBSD::Temp::::reclaim OpenBSD::Temp::reclaim
41212.57ms6.65msOpenBSD::Temp::::file OpenBSD::Temp::file
40111.40ms3.36msOpenBSD::Temp::::permanent_dir OpenBSD::Temp::permanent_dir
4111774µs4.08msOpenBSD::Temp::::permanent_file OpenBSD::Temp::permanent_file
111556µs1.03msOpenBSD::Temp::::BEGIN@23 OpenBSD::Temp::BEGIN@23
111238µs5.24msOpenBSD::Temp::::__ANON__[:39] OpenBSD::Temp::__ANON__[:39]
11130µs54µsOpenBSD::PackageLocation::::BEGIN@19OpenBSD::PackageLocation::BEGIN@19
11119µs23µsOpenBSD::PackageLocation::::BEGIN@18OpenBSD::PackageLocation::BEGIN@18
11113µs81µsOpenBSD::Temp::::BEGIN@25 OpenBSD::Temp::BEGIN@25
11111µs5.25msOpenBSD::Temp::::END OpenBSD::Temp::END
1118µs8µsOpenBSD::Temp::::BEGIN@24 OpenBSD::Temp::BEGIN@24
0000s0sOpenBSD::Temp::::__ANON__[:49] OpenBSD::Temp::__ANON__[:49]
0000s0sOpenBSD::Temp::::__ANON__[:70] OpenBSD::Temp::__ANON__[:70]
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: 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
18218.7ms226µ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
use strict;
# spent 23µs making 1 call to OpenBSD::PackageLocation::BEGIN@18 # spent 4µs making 1 call to strict::import
19270µs278µ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
use warnings;
# spent 54µs making 1 call to OpenBSD::PackageLocation::BEGIN@19 # spent 24µs making 1 call to warnings::import
20
21package OpenBSD::Temp;
22
232278µs21.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
use OpenBSD::MkTemp;
# spent 1.03ms making 1 call to OpenBSD::Temp::BEGIN@23 # spent 60µs making 1 call to Exporter::import
24229µs18µs
# spent 8µs within OpenBSD::Temp::BEGIN@24 which was called: # once (8µs+0s) by OpenBSD::PackageLocation::BEGIN@24 at line 24
use OpenBSD::Paths;
# spent 8µs making 1 call to OpenBSD::Temp::BEGIN@24
2527.53ms2150µ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
use OpenBSD::Error;
# spent 81µs making 1 call to OpenBSD::Temp::BEGIN@25 # spent 68µs making 1 call to Exporter::import
26
27123µs13µsour $tempbase = $ENV{'PKG_TMPDIR'} || OpenBSD::Paths->vartmp;
# spent 3µs making 1 call to OpenBSD::Paths::vartmp
28
2912µsmy $dirs = {};
3011µsmy $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
my $cleanup = sub {
3315µs while (my ($name, $pid) = each %$files) {
34 unlink($name) if $pid == $$;
35 }
361206µs405.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 }
3914µ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
END {
4217µs15.24ms &$cleanup;
# spent 5.24ms making 1 call to OpenBSD::Temp::__ANON__[OpenBSD/Temp.pm:39]
43}
4417µs18µsOpenBSD::Handler->register($cleanup);
# spent 8µs making 1 call to OpenBSD::Handler::register
45
46sub 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
{
484036µs my $caught;
4940494µs my $h = sub { $caught = shift; };
504035µs my $dir;
51
52 {
5380416µs local $SIG{'INT'} = $h;
5440179µs local $SIG{'QUIT'} = $h;
5540168µs local $SIG{'HUP'} = $h;
564031.4ms local $SIG{'KILL'} = $h;
5740312µs local $SIG{'TERM'} = $h;
5840314µs403.36ms $dir = permanent_dir($tempbase, "pkginfo");
# spent 3.36ms making 40 calls to OpenBSD::Temp::permanent_dir, avg 84µs/call
59401.15ms $dirs->{$dir} = $$;
60 }
614047µs if (defined $caught) {
62 kill $caught, $$;
63 }
6440313µs return "$dir/";
65}
66
67sub 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
{
694137µs my $caught;
7041157µs my $h = sub { $caught = shift; };
714139µs my ($fh, $file);
72
73 {
7482283µs local $SIG{'INT'} = $h;
7541165µs local $SIG{'QUIT'} = $h;
7641154µs local $SIG{'HUP'} = $h;
7741157µs local $SIG{'KILL'} = $h;
7841157µs local $SIG{'TERM'} = $h;
7941190µs414.08ms ($fh, $file) = permanent_file($tempbase, "pkgout");
# spent 4.08ms making 41 calls to OpenBSD::Temp::permanent_file, avg 99µs/call
8041724µs if (defined $file) {
81 $files->{$file} = $$;
82 }
83 }
844140µs if (defined $caught) {
85 kill $caught, $$;
86 }
8741467µs return $file;
88}
89
90sub 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
{
9281118µs my ($class, $name) = @_;
93817.69ms delete $files->{$name};
9481387µs delete $dirs->{$name};
95}
96
97sub 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
{
994147µs my ($dir, $stem) = @_;
10041196µs my $template = "$stem.XXXXXXXXXX";
1014186µs if (defined $dir) {
102 $template = "$dir/$template";
103 }
10441477µs413.30ms return OpenBSD::MkTemp::mkstemp($template);
# spent 3.30ms making 41 calls to OpenBSD::MkTemp::mkstemp, avg 81µs/call
105}
106
107sub 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
{
10940313µs my ($dir, $stem) = @_;
11040352µs my $template = "$stem.XXXXXXXXXX";
11140240µs if (defined $dir) {
112 $template = "$dir/$template";
113 }
114402.36ms401.95ms return OpenBSD::MkTemp::mkdtemp($template);
# spent 1.95ms making 40 calls to OpenBSD::MkTemp::mkdtemp, avg 49µs/call
115}
116
117110µs1;