← Index
NYTProf Performance Profile   « line view »
For /usr/sbin/pkg_info
  Run on Fri Aug 4 10:12:01 2017
Reported on Fri Aug 4 10:12:17 2017

Filename/usr/libdata/perl5/OpenBSD/IdCache.pm
StatementsExecuted 56 statements in 697µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11151µs51µsOpenBSD::UidCache::::CORE:gpwnam OpenBSD::UidCache::CORE:gpwnam (opcode)
42147µs213µsOpenBSD::IdCache::::lookup OpenBSD::IdCache::lookup
11147µs47µsOpenBSD::GidCache::::CORE:ggrnam OpenBSD::GidCache::CORE:ggrnam (opcode)
41137µs161µsOpenBSD::SimpleIdCache::::lookupOpenBSD::SimpleIdCache::lookup
11116µs20µsOpenBSD::Ustar::::BEGIN@17 OpenBSD::Ustar::BEGIN@17
11114µs65µsOpenBSD::UidCache::::convert OpenBSD::UidCache::convert
11113µs59µsOpenBSD::GidCache::::convert OpenBSD::GidCache::convert
11112µs20µsOpenBSD::Ustar::::BEGIN@18 OpenBSD::Ustar::BEGIN@18
44112µs12µsOpenBSD::SimpleIdCache::::newOpenBSD::SimpleIdCache::new
4114µs4µsOpenBSD::IdCache::::CORE:match OpenBSD::IdCache::CORE:match (opcode)
0000s0sOpenBSD::GnameCache::::convert OpenBSD::GnameCache::convert
0000s0sOpenBSD::UnameCache::::convert OpenBSD::UnameCache::convert
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: IdCache.pm,v 1.10 2010/12/24 09:04:14 espie Exp $
3#
4# Copyright (c) 2002-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
17231µs224µs
# spent 20µs (16+4) within OpenBSD::Ustar::BEGIN@17 which was called: # once (16µs+4µs) by OpenBSD::Ustar::BEGIN@49 at line 17
use strict;
# spent 20µs making 1 call to OpenBSD::Ustar::BEGIN@17 # spent 4µs making 1 call to strict::import
182388µs228µs
# spent 20µs (12+8) within OpenBSD::Ustar::BEGIN@18 which was called: # once (12µs+8µs) by OpenBSD::Ustar::BEGIN@49 at line 18
use warnings;
# spent 20µs making 1 call to OpenBSD::Ustar::BEGIN@18 # spent 8µs making 1 call to warnings::import
19
20package OpenBSD::SimpleIdCache;
21sub new
22
# spent 12µs within OpenBSD::SimpleIdCache::new which was called 4 times, avg 3µs/call: # once (4µs+0s) by OpenBSD::PackageLocation::_opened at line 52 of OpenBSD/Ustar.pm # once (3µs+0s) by OpenBSD::PackageLocation::_opened at line 53 of OpenBSD/Ustar.pm # once (2µs+0s) by OpenBSD::PackageLocation::_opened at line 54 of OpenBSD/Ustar.pm # once (2µs+0s) by OpenBSD::PackageLocation::_opened at line 55 of OpenBSD/Ustar.pm
{
2343µs my $class = shift;
24420µs bless {}, $class;
25}
26
27sub lookup
28
# spent 161µs (37+125) within OpenBSD::SimpleIdCache::lookup which was called 4 times, avg 40µs/call: # 4 times (37µs+125µs) by OpenBSD::IdCache::lookup at line 55, avg 40µs/call
{
2943µs my ($self, $name, $default) = @_;
3043µs my $r;
31
3249µs if (defined $self->{$name}) {
33 $r = $self->{$name};
34 } else {
3525µs2125µs $r = $self->convert($name);
# spent 65µs making 1 call to OpenBSD::UidCache::convert # spent 59µs making 1 call to OpenBSD::GidCache::convert
3621µs if (!defined $r) {
37 $r = $default;
38 }
3923µs $self->{$name} = $r;
40 }
41412µs return $r;
42}
43
44
45package OpenBSD::IdCache;
46117µsour @ISA=qw(OpenBSD::SimpleIdCache);
47
48sub lookup
49
# spent 213µs (47+166) within OpenBSD::IdCache::lookup which was called 4 times, avg 53µs/call: # 2 times (32µs+88µs) by OpenBSD::Ustar::next at line 218 of OpenBSD/Ustar.pm, avg 60µs/call # 2 times (15µs+78µs) by OpenBSD::Ustar::next at line 219 of OpenBSD/Ustar.pm, avg 46µs/call
{
5047µs my ($self, $name, $default) = @_;
51
52417µs44µs if ($name =~ m/^\d+$/o) {
# spent 4µs making 4 calls to OpenBSD::IdCache::CORE:match, avg 1µs/call
53 return $name;
54 } else {
55425µs4161µs return $self->SUPER::lookup($name, $default);
# spent 161µs making 4 calls to OpenBSD::SimpleIdCache::lookup, avg 40µs/call
56 }
57}
58
59package OpenBSD::UidCache;
6013µsour @ISA=qw(OpenBSD::IdCache);
61
62sub convert
63
# spent 65µs (14+51) within OpenBSD::UidCache::convert which was called: # once (14µs+51µs) by OpenBSD::SimpleIdCache::lookup at line 35
{
64162µs151µs my @entry = getpwnam($_[1]);
# spent 51µs making 1 call to OpenBSD::UidCache::CORE:gpwnam
6516µs return @entry == 0 ? undef : $entry[2];
66}
67
68package OpenBSD::GidCache;
6913µsour @ISA=qw(OpenBSD::IdCache);
70
71sub convert
72
# spent 59µs (13+47) within OpenBSD::GidCache::convert which was called: # once (13µs+47µs) by OpenBSD::SimpleIdCache::lookup at line 35
{
73156µs147µs my @entry = getgrnam($_[1]);
# spent 47µs making 1 call to OpenBSD::GidCache::CORE:ggrnam
7415µs return @entry == 0 ? undef : $entry[2];
75}
76
77package OpenBSD::UnameCache;
7812µsour @ISA=qw(OpenBSD::SimpleIdCache);
79
80sub convert
81{
82 return getpwuid($_[1]);
83}
84
85package OpenBSD::GnameCache;
8612µsour @ISA=qw(OpenBSD::SimpleIdCache);
87
88sub convert
89{
90 return getgrgid($_[1]);
91}
92
93114µs1;
 
# spent 47µs within OpenBSD::GidCache::CORE:ggrnam which was called: # once (47µs+0s) by OpenBSD::GidCache::convert at line 73
sub OpenBSD::GidCache::CORE:ggrnam; # opcode
# spent 4µs within OpenBSD::IdCache::CORE:match which was called 4 times, avg 1µs/call: # 4 times (4µs+0s) by OpenBSD::IdCache::lookup at line 52, avg 1µs/call
sub OpenBSD::IdCache::CORE:match; # opcode
# spent 51µs within OpenBSD::UidCache::CORE:gpwnam which was called: # once (51µs+0s) by OpenBSD::UidCache::convert at line 64
sub OpenBSD::UidCache::CORE:gpwnam; # opcode