| Filename | /usr/libdata/perl5/OpenBSD/PackageRepositoryList.pm |
| Statements | Executed 33 statements in 515µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 56µs | 12.0s | OpenBSD::PackageRepositoryList::match_locations |
| 2 | 1 | 1 | 30µs | 30µs | OpenBSD::PackageRepositoryList::filter_new |
| 2 | 1 | 1 | 29µs | 59µs | OpenBSD::PackageRepositoryList::add |
| 1 | 1 | 1 | 24µs | 27µs | OpenBSD::PackageLocator::BEGIN@18 |
| 1 | 1 | 1 | 9µs | 16µs | OpenBSD::PackageLocator::BEGIN@19 |
| 1 | 1 | 1 | 6µs | 6µ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 | 33µs | 2 | 31µs | # spent 27µ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 27µs making 1 call to OpenBSD::PackageLocator::BEGIN@18
# spent 4µs making 1 call to strict::import |
| 19 | 2 | 365µs | 2 | 22µs | # spent 16µs (9+7) within OpenBSD::PackageLocator::BEGIN@19 which was called:
# once (9µs+7µs) by OpenBSD::PackageLocator::BEGIN@23 at line 19 # spent 16µs making 1 call to OpenBSD::PackageLocator::BEGIN@19
# spent 7µs making 1 call to warnings::import |
| 20 | |||||
| 21 | package OpenBSD::PackageRepositoryList; | ||||
| 22 | |||||
| 23 | sub new | ||||
| 24 | # spent 6µs within OpenBSD::PackageRepositoryList::new which was called:
# once (6µs+0s) by OpenBSD::PackageLocator::build_default_path at line 59 of OpenBSD/PackageLocator.pm | ||||
| 25 | 1 | 1µs | my ($class, $state) = @_; | ||
| 26 | 1 | 9µs | return bless {l => [], k => {}, state => $state}, $class; | ||
| 27 | } | ||||
| 28 | |||||
| 29 | sub filter_new | ||||
| 30 | # spent 30µs within OpenBSD::PackageRepositoryList::filter_new which was called 2 times, avg 15µs/call:
# 2 times (30µs+0s) by OpenBSD::PackageRepositoryList::add at line 45, avg 15µs/call | ||||
| 31 | 2 | 2µs | my $self = shift; | ||
| 32 | 2 | 2µs | my @l = (); | ||
| 33 | 2 | 6µs | for my $r (@_) { | ||
| 34 | 2 | 2µs | next if !defined $r; | ||
| 35 | 2 | 3µs | next if $self->{k}{$r}; | ||
| 36 | 2 | 5µs | $self->{k}{$r} = 1; | ||
| 37 | 2 | 4µs | push @l, $r; | ||
| 38 | } | ||||
| 39 | 2 | 15µs | return @l; | ||
| 40 | } | ||||
| 41 | |||||
| 42 | sub add | ||||
| 43 | # spent 59µs (29+30) within OpenBSD::PackageRepositoryList::add which was called 2 times, avg 29µs/call:
# 2 times (29µs+30µs) by OpenBSD::PackageLocator::add_default at line 50 of OpenBSD/PackageLocator.pm, avg 29µs/call | ||||
| 44 | 2 | 2µs | my $self = shift; | ||
| 45 | 2 | 15µs | 2 | 30µs | push @{$self->{l}}, $self->filter_new(@_); # spent 30µs making 2 calls to OpenBSD::PackageRepositoryList::filter_new, avg 15µ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 12.0s (56µs+12.0) within OpenBSD::PackageRepositoryList::match_locations which was called:
# once (56µs+12.0s) by OpenBSD::PackageLocator::match_locations at line 128 of OpenBSD/PackageLocator.pm | ||||
| 82 | 1 | 1µs | my ($self, @search) = @_; | ||
| 83 | 1 | 4µs | for my $repo (@{$self->{l}}) { | ||
| 84 | 2 | 24µs | 2 | 12.0s | my $l = $repo->match_locations(@search); # spent 12.0s making 2 calls to OpenBSD::PackageRepositoryBase::match_locations, avg 5.98s/call |
| 85 | 2 | 18µs | if (@$l > 0) { | ||
| 86 | return $l; | ||||
| 87 | } | ||||
| 88 | } | ||||
| 89 | return []; | ||||
| 90 | } | ||||
| 91 | |||||
| 92 | 1 | 3µs | 1; |