← 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/IdCache.pm
StatementsExecuted 1699 statements in 10.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
238218.21ms9.94msOpenBSD::IdCache::::lookup OpenBSD::IdCache::lookup
238111.30ms1.45msOpenBSD::SimpleIdCache::::lookupOpenBSD::SimpleIdCache::lookup
23811285µs285µsOpenBSD::IdCache::::CORE:match OpenBSD::IdCache::CORE:match (opcode)
21163µs63µsOpenBSD::GidCache::::CORE:ggrnam OpenBSD::GidCache::CORE:ggrnam (opcode)
11151µs51µsOpenBSD::UidCache::::CORE:gpwnam OpenBSD::UidCache::CORE:gpwnam (opcode)
21120µs83µsOpenBSD::GidCache::::convert OpenBSD::GidCache::convert
11116µs19µsOpenBSD::Ustar::::BEGIN@17 OpenBSD::Ustar::BEGIN@17
11114µs65µsOpenBSD::UidCache::::convert OpenBSD::UidCache::convert
44112µs12µsOpenBSD::SimpleIdCache::::newOpenBSD::SimpleIdCache::new
11111µs18µsOpenBSD::Ustar::::BEGIN@18 OpenBSD::Ustar::BEGIN@18
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
17226µs223µs
# spent 19µ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 19µs making 1 call to OpenBSD::Ustar::BEGIN@17 # spent 4µs making 1 call to strict::import
182347µs225µs
# spent 18µs (11+7) within OpenBSD::Ustar::BEGIN@18 which was called: # once (11µs+7µs) by OpenBSD::Ustar::BEGIN@49 at line 18
use warnings;
# spent 18µs making 1 call to OpenBSD::Ustar::BEGIN@18 # spent 7µ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 (5µ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 55 of OpenBSD/Ustar.pm # once (2µs+0s) by OpenBSD::PackageLocation::_opened at line 54 of OpenBSD/Ustar.pm
{
2343µs my $class = shift;
24420µs bless {}, $class;
25}
26
27sub lookup
28
# spent 1.45ms (1.30+148µs) within OpenBSD::SimpleIdCache::lookup which was called 238 times, avg 6µs/call: # 238 times (1.30ms+148µs) by OpenBSD::IdCache::lookup at line 55, avg 6µs/call
{
29238214µs my ($self, $name, $default) = @_;
30238173µs my $r;
31
32238321µs if (defined $self->{$name}) {
33 $r = $self->{$name};
34 } else {
3538µs3148µs $r = $self->convert($name);
# spent 83µs making 2 calls to OpenBSD::GidCache::convert, avg 42µs/call # spent 65µs making 1 call to OpenBSD::UidCache::convert
3632µs if (!defined $r) {
37 $r = $default;
38 }
3934µs $self->{$name} = $r;
40 }
41238800µs return $r;
42}
43
44
45package OpenBSD::IdCache;
4616µsour @ISA=qw(OpenBSD::SimpleIdCache);
47
48sub lookup
49
# spent 9.94ms (8.21+1.74) within OpenBSD::IdCache::lookup which was called 238 times, avg 42µs/call: # 119 times (6.44ms+747µs) by OpenBSD::Ustar::next at line 219 of OpenBSD/Ustar.pm, avg 60µs/call # 119 times (1.77ms+990µs) by OpenBSD::Ustar::next at line 218 of OpenBSD/Ustar.pm, avg 23µs/call
{
50238258µs my ($self, $name, $default) = @_;
51
522386.43ms238285µs if ($name =~ m/^\d+$/o) {
# spent 285µs making 238 calls to OpenBSD::IdCache::CORE:match, avg 1µs/call
53 return $name;
54 } else {
552381.56ms2381.45ms return $self->SUPER::lookup($name, $default);
# spent 1.45ms making 238 calls to OpenBSD::SimpleIdCache::lookup, avg 6µ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
{
64161µ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 83µs (20+63) within OpenBSD::GidCache::convert which was called 2 times, avg 42µs/call: # 2 times (20µs+63µs) by OpenBSD::SimpleIdCache::lookup at line 35, avg 42µs/call
{
73277µs263µs my @entry = getgrnam($_[1]);
# spent 63µs making 2 calls to OpenBSD::GidCache::CORE:ggrnam, avg 32µs/call
7428µ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
9315µs1;
 
# spent 63µs within OpenBSD::GidCache::CORE:ggrnam which was called 2 times, avg 32µs/call: # 2 times (63µs+0s) by OpenBSD::GidCache::convert at line 73, avg 32µs/call
sub OpenBSD::GidCache::CORE:ggrnam; # opcode
# spent 285µs within OpenBSD::IdCache::CORE:match which was called 238 times, avg 1µs/call: # 238 times (285µ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