| Filename | /usr/libdata/perl5/OpenBSD/PackageRepositoryList.pm |
| Statements | Executed 33 statements in 10.2ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 51µs | 2.06s | OpenBSD::PackageRepositoryList::match_locations |
| 2 | 1 | 1 | 32µs | 32µs | OpenBSD::PackageRepositoryList::filter_new |
| 2 | 1 | 1 | 28µs | 60µs | OpenBSD::PackageRepositoryList::add |
| 1 | 1 | 1 | 24µs | 29µs | OpenBSD::PackageLocator::BEGIN@18 |
| 1 | 1 | 1 | 13µs | 21µs | OpenBSD::PackageLocator::BEGIN@19 |
| 1 | 1 | 1 | 7µs | 7µs | OpenBSD::PackageRepositoryList::new |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageRepositoryList::do_something |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageRepositoryList::find |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageRepositoryList::grabPlist |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageRepositoryList::prepend |
| 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 | |||||
| 18 | 2 | 37µs | 2 | 33µ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 # spent 29µs making 1 call to OpenBSD::PackageLocator::BEGIN@18
# spent 4µs making 1 call to strict::import |
| 19 | 2 | 10.0ms | 2 | 29µ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 # spent 21µs making 1 call to OpenBSD::PackageLocator::BEGIN@19
# spent 8µs making 1 call to warnings::import |
| 20 | |||||
| 21 | package OpenBSD::PackageRepositoryList; | ||||
| 22 | |||||
| 23 | sub 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 | ||||
| 25 | 1 | 1µs | my ($class, $state) = @_; | ||
| 26 | 1 | 10µs | return bless {l => [], k => {}, state => $state}, $class; | ||
| 27 | } | ||||
| 28 | |||||
| 29 | sub 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 | ||||
| 31 | 2 | 2µs | my $self = shift; | ||
| 32 | 2 | 3µs | my @l = (); | ||
| 33 | 2 | 7µs | for my $r (@_) { | ||
| 34 | 2 | 2µs | next if !defined $r; | ||
| 35 | 2 | 3µs | next if $self->{k}{$r}; | ||
| 36 | 2 | 4µs | $self->{k}{$r} = 1; | ||
| 37 | 2 | 7µs | push @l, $r; | ||
| 38 | } | ||||
| 39 | 2 | 13µs | return @l; | ||
| 40 | } | ||||
| 41 | |||||
| 42 | sub 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 | ||||
| 44 | 2 | 2µs | my $self = shift; | ||
| 45 | 2 | 17µs | 2 | 32µs | push @{$self->{l}}, $self->filter_new(@_); # spent 32µs making 2 calls to OpenBSD::PackageRepositoryList::filter_new, avg 16µs/call |
| 46 | } | ||||
| 47 | |||||
| 48 | sub prepend | ||||
| 49 | { | ||||
| 50 | my $self = shift; | ||||
| 51 | unshift @{$self->{l}}, $self->filter_new(@_); | ||||
| 52 | } | ||||
| 53 | |||||
| 54 | sub 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 | |||||
| 67 | sub find | ||||
| 68 | { | ||||
| 69 | my ($self, @args) = @_; | ||||
| 70 | |||||
| 71 | return $self->do_something('find', @args); | ||||
| 72 | } | ||||
| 73 | |||||
| 74 | sub grabPlist | ||||
| 75 | { | ||||
| 76 | my ($self, @args) = @_; | ||||
| 77 | return $self->do_something('grabPlist', @args); | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | sub 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 | ||||
| 82 | 1 | 1µs | my ($self, @search) = @_; | ||
| 83 | 1 | 3µs | for my $repo (@{$self->{l}}) { | ||
| 84 | 2 | 21µs | 2 | 2.06s | my $l = $repo->match_locations(@search); # spent 2.06s making 2 calls to OpenBSD::PackageRepositoryBase::match_locations, avg 1.03s/call |
| 85 | 2 | 18µs | if (@$l > 0) { | ||
| 86 | return $l; | ||||
| 87 | } | ||||
| 88 | } | ||||
| 89 | return []; | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | 1 | 7µs | 1; |