← 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/PackageRepositoryList.pm
StatementsExecuted 33 statements in 10.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11151µs2.06sOpenBSD::PackageRepositoryList::::match_locationsOpenBSD::PackageRepositoryList::match_locations
21132µs32µsOpenBSD::PackageRepositoryList::::filter_newOpenBSD::PackageRepositoryList::filter_new
21128µs60µsOpenBSD::PackageRepositoryList::::addOpenBSD::PackageRepositoryList::add
11124µs29µsOpenBSD::PackageLocator::::BEGIN@18 OpenBSD::PackageLocator::BEGIN@18
11113µs21µsOpenBSD::PackageLocator::::BEGIN@19 OpenBSD::PackageLocator::BEGIN@19
1117µs7µsOpenBSD::PackageRepositoryList::::newOpenBSD::PackageRepositoryList::new
0000s0sOpenBSD::PackageRepositoryList::::do_somethingOpenBSD::PackageRepositoryList::do_something
0000s0sOpenBSD::PackageRepositoryList::::findOpenBSD::PackageRepositoryList::find
0000s0sOpenBSD::PackageRepositoryList::::grabPlistOpenBSD::PackageRepositoryList::grabPlist
0000s0sOpenBSD::PackageRepositoryList::::prependOpenBSD::PackageRepositoryList::prepend
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: PackageRepositoryList.pm,v 1.31 2017/05/29 12:28:54 espie Exp $
3#
4# Copyright (c) 2003-2006 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
18237µs233µs
# spent 29µs (24+4) within OpenBSD::PackageLocator::BEGIN@18 which was called: # once (24µs+4µs) by OpenBSD::PackageLocator::BEGIN@23 at line 18
use strict;
# spent 29µs making 1 call to OpenBSD::PackageLocator::BEGIN@18 # spent 4µs making 1 call to strict::import
19210.0ms229µs
# spent 21µs (13+8) within OpenBSD::PackageLocator::BEGIN@19 which was called: # once (13µs+8µs) by OpenBSD::PackageLocator::BEGIN@23 at line 19
use warnings;
# spent 21µs making 1 call to OpenBSD::PackageLocator::BEGIN@19 # spent 8µs making 1 call to warnings::import
20
21package OpenBSD::PackageRepositoryList;
22
23sub new
24
# spent 7µs within OpenBSD::PackageRepositoryList::new which was called: # once (7µs+0s) by OpenBSD::PackageLocator::build_default_path at line 59 of OpenBSD/PackageLocator.pm
{
2511µs my ($class, $state) = @_;
26110µs return bless {l => [], k => {}, state => $state}, $class;
27}
28
29sub filter_new
30
# spent 32µs within OpenBSD::PackageRepositoryList::filter_new which was called 2 times, avg 16µs/call: # 2 times (32µs+0s) by OpenBSD::PackageRepositoryList::add at line 45, avg 16µs/call
{
3122µs my $self = shift;
3223µs my @l = ();
3327µs for my $r (@_) {
3422µs next if !defined $r;
3523µs next if $self->{k}{$r};
3624µs $self->{k}{$r} = 1;
3727µs push @l, $r;
38 }
39213µs return @l;
40}
41
42sub add
43
# spent 60µs (28+32) within OpenBSD::PackageRepositoryList::add which was called 2 times, avg 30µs/call: # 2 times (28µs+32µs) by OpenBSD::PackageLocator::add_default at line 50 of OpenBSD/PackageLocator.pm, avg 30µs/call
{
4422µs my $self = shift;
45217µs232µs push @{$self->{l}}, $self->filter_new(@_);
# spent 32µs making 2 calls to OpenBSD::PackageRepositoryList::filter_new, avg 16µs/call
46}
47
48sub prepend
49{
50 my $self = shift;
51 unshift @{$self->{l}}, $self->filter_new(@_);
52}
53
54sub do_something
55{
56 my ($self, $do, $pkgname, @args) = @_;
57 if (defined $pkgname && $pkgname eq '-') {
58 return OpenBSD::PackageRepository->pipe->new($self->{state})->$do($pkgname, @args);
59 }
60 for my $repo (@{$self->{l}}) {
61 my $r = $repo->$do($pkgname, @args);
62 return $r if defined $r;
63 }
64 return undef;
65}
66
67sub find
68{
69 my ($self, @args) = @_;
70
71 return $self->do_something('find', @args);
72}
73
74sub grabPlist
75{
76 my ($self, @args) = @_;
77 return $self->do_something('grabPlist', @args);
78}
79
80sub match_locations
81
# spent 2.06s (51µs+2.06) within OpenBSD::PackageRepositoryList::match_locations which was called: # once (51µs+2.06s) by OpenBSD::PackageLocator::match_locations at line 128 of OpenBSD/PackageLocator.pm
{
8211µs my ($self, @search) = @_;
8313µs for my $repo (@{$self->{l}}) {
84221µs22.06s my $l = $repo->match_locations(@search);
# spent 2.06s making 2 calls to OpenBSD::PackageRepositoryBase::match_locations, avg 1.03s/call
85218µs if (@$l > 0) {
86 return $l;
87 }
88 }
89 return [];
90}
91
9217µs1;