| Filename | /usr/libdata/perl5/OpenBSD/PackageLocation.pm |
| Statements | Executed 5402 statements in 74.2ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 26.7ms | 27.9ms | OpenBSD::PackageLocation::BEGIN@24 |
| 40 | 1 | 1 | 23.1ms | 12.0s | OpenBSD::PackageLocation::info |
| 40 | 1 | 1 | 9.47ms | 11.9s | OpenBSD::PackageLocation::grab_info |
| 160 | 2 | 1 | 8.55ms | 11.7s | OpenBSD::PackageLocation::_opened |
| 120 | 2 | 2 | 3.76ms | 6.53ms | OpenBSD::PackageLocation::deref |
| 120 | 2 | 1 | 3.22ms | 84.3ms | OpenBSD::PackageLocation::next |
| 40 | 1 | 1 | 2.45ms | 2.45ms | OpenBSD::PackageLocation::CORE:print (opcode) |
| 40 | 1 | 1 | 1.88ms | 121ms | OpenBSD::PackageLocation::find_contents |
| 40 | 1 | 1 | 1.73ms | 1.73ms | OpenBSD::PackageLocation::CORE:open (opcode) |
| 40 | 1 | 1 | 1.33ms | 54.9ms | OpenBSD::PackageLocation::wipe_info |
| 80 | 2 | 1 | 1.32ms | 11.8s | OpenBSD::PackageLocation::contents |
| 416 | 3 | 2 | 1.12ms | 1.12ms | OpenBSD::PackageLocation::name |
| 40 | 1 | 1 | 1.11ms | 1.11ms | OpenBSD::PackageLocation::CORE:ftfile (opcode) |
| 40 | 1 | 1 | 1.07ms | 1.07ms | OpenBSD::PackageLocation::CORE:close (opcode) |
| 120 | 1 | 1 | 985µs | 80.4ms | OpenBSD::PackageLocation::getNext |
| 40 | 1 | 1 | 836µs | 836µs | OpenBSD::PackageLocation::_set_callback |
| 40 | 1 | 1 | 597µs | 6.76ms | OpenBSD::PackageLocation::url |
| 40 | 1 | 1 | 448µs | 1.08s | OpenBSD::PackageLocation::close_now |
| 40 | 1 | 1 | 281µs | 539µs | OpenBSD::PackageLocation::new |
| 39 | 1 | 1 | 170µs | 170µs | OpenBSD::PackageLocation::unput |
| 1 | 1 | 1 | 34µs | 43µs | OpenBSD::PackageRepository::BEGIN@18 |
| 1 | 1 | 1 | 33µs | 48µs | OpenBSD::PackageRepository::BEGIN@19 |
| 1 | 1 | 1 | 16µs | 108µs | OpenBSD::PackageLocation::BEGIN@25 |
| 1 | 1 | 1 | 16µs | 192µs | OpenBSD::PackageLocation::BEGIN@23 |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::Installed::info |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::Installed::plist |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::__ANON__[:54] |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::__ANON__[:67] |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::__ANON__[:68] |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::close |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::close_after_error |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::close_with_client_error |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::finish_and_close |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::forget |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::grabPlist |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::plist |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::set_callback |
| 0 | 0 | 0 | 0s | 0s | OpenBSD::PackageLocation::skip |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # ex:ts=8 sw=4: | ||||
| 2 | # $OpenBSD: PackageLocation.pm,v 1.51 2017/03/07 14:15:09 espie Exp $ | ||||
| 3 | # | ||||
| 4 | # Copyright (c) 2003-2007 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 | 52µs | 2 | 51µs | # spent 43µs (34+9) within OpenBSD::PackageRepository::BEGIN@18 which was called:
# once (34µs+9µs) by OpenBSD::PackageRepository::BEGIN@30 at line 18 # spent 43µs making 1 call to OpenBSD::PackageRepository::BEGIN@18
# spent 9µs making 1 call to strict::import |
| 19 | 2 | 60µs | 2 | 63µs | # spent 48µs (33+15) within OpenBSD::PackageRepository::BEGIN@19 which was called:
# once (33µs+15µs) by OpenBSD::PackageRepository::BEGIN@30 at line 19 # spent 48µs making 1 call to OpenBSD::PackageRepository::BEGIN@19
# spent 15µs making 1 call to warnings::import |
| 20 | |||||
| 21 | package OpenBSD::PackageLocation; | ||||
| 22 | |||||
| 23 | 2 | 72µs | 2 | 368µs | # spent 192µs (16+176) within OpenBSD::PackageLocation::BEGIN@23 which was called:
# once (16µs+176µs) by OpenBSD::PackageRepository::BEGIN@30 at line 23 # spent 192µs making 1 call to OpenBSD::PackageLocation::BEGIN@23
# spent 176µs making 1 call to Exporter::import |
| 24 | 2 | 330µs | 1 | 27.9ms | # spent 27.9ms (26.7+1.21) within OpenBSD::PackageLocation::BEGIN@24 which was called:
# once (26.7ms+1.21ms) by OpenBSD::PackageRepository::BEGIN@30 at line 24 # spent 27.9ms making 1 call to OpenBSD::PackageLocation::BEGIN@24 |
| 25 | 2 | 1.65ms | 2 | 201µs | # spent 108µs (16+92) within OpenBSD::PackageLocation::BEGIN@25 which was called:
# once (16µs+92µs) by OpenBSD::PackageRepository::BEGIN@30 at line 25 # spent 108µs making 1 call to OpenBSD::PackageLocation::BEGIN@25
# spent 92µs making 1 call to Exporter::import |
| 26 | |||||
| 27 | sub new | ||||
| 28 | # spent 539µs (281+258) within OpenBSD::PackageLocation::new which was called 40 times, avg 13µs/call:
# 40 times (281µs+258µs) by OpenBSD::PackageRepositoryBase::new_location at line 163 of OpenBSD/PackageRepository/Installed.pm, avg 13µs/call | ||||
| 29 | 40 | 29µs | my ($class, $repository, $name) = @_; | ||
| 30 | |||||
| 31 | 40 | 121µs | 40 | 258µs | my $self = { repository => $repository, name => $repository->canonicalize($name) }; # spent 258µs making 40 calls to OpenBSD::PackageRepositoryBase::canonicalize, avg 6µs/call |
| 32 | 40 | 29µs | bless $self, $class; | ||
| 33 | 40 | 98µs | return $self; | ||
| 34 | |||||
| 35 | } | ||||
| 36 | |||||
| 37 | sub url | ||||
| 38 | # spent 6.76ms (597µs+6.17) within OpenBSD::PackageLocation::url which was called 40 times, avg 169µs/call:
# 40 times (597µs+6.17ms) by OpenBSD::PackageRepository::parse_problems at line 288 of OpenBSD/PackageRepository.pm, avg 169µs/call | ||||
| 39 | 40 | 46µs | my $self = shift; | ||
| 40 | |||||
| 41 | 40 | 431µs | 80 | 6.17ms | return $self->{repository}->url($self->name); # spent 5.99ms making 40 calls to OpenBSD::PackageRepositoryBase::url, avg 150µs/call
# spent 180µs making 40 calls to OpenBSD::PackageLocation::name, avg 5µs/call |
| 42 | } | ||||
| 43 | |||||
| 44 | sub name | ||||
| 45 | # spent 1.12ms within OpenBSD::PackageLocation::name which was called 416 times, avg 3µs/call:
# 336 times (715µs+0s) by OpenBSD::PkgInfo::CORE:sort at line 605 of OpenBSD/PkgInfo.pm, avg 2µs/call
# 40 times (227µs+0s) by OpenBSD::PkgInfo::parse_and_run at line 606 of OpenBSD/PkgInfo.pm, avg 6µs/call
# 40 times (180µs+0s) by OpenBSD::PackageLocation::url at line 41, avg 5µs/call | ||||
| 46 | 416 | 287µs | my $self = shift; | ||
| 47 | 416 | 1.26ms | return $self->{name}; | ||
| 48 | } | ||||
| 49 | |||||
| 50 | OpenBSD::Auto::cache(pkgname, | ||||
| 51 | sub { | ||||
| 52 | my $self = shift; | ||||
| 53 | return OpenBSD::PackageName->from_string($self->name); | ||||
| 54 | 1 | 9µs | 1 | 15µs | }); # spent 15µs making 1 call to OpenBSD::Auto::cache |
| 55 | |||||
| 56 | OpenBSD::Auto::cache(update_info, | ||||
| 57 | sub { | ||||
| 58 | my $self = shift; | ||||
| 59 | if ($self->name =~ /^quirks\-/) { | ||||
| 60 | return $self->plist; | ||||
| 61 | } | ||||
| 62 | return $self->plist(\&OpenBSD::PackingList::UpdateInfoOnly, | ||||
| 63 | sub { | ||||
| 64 | return 0 if $_[0] =~ m/^\@option\s+always-update\b/m; | ||||
| 65 | return 1 if $_[0] =~ m/^\@(?:newgroup|newuser|cwd)\b/m; | ||||
| 66 | return 0; | ||||
| 67 | }); | ||||
| 68 | 1 | 4µs | 1 | 7µs | }); # spent 7µs making 1 call to OpenBSD::Auto::cache |
| 69 | |||||
| 70 | |||||
| 71 | # make sure self is opened and move to the right location if need be. | ||||
| 72 | sub _opened | ||||
| 73 | { | ||||
| 74 | 160 | 142µs | my $self = shift; | ||
| 75 | |||||
| 76 | 160 | 984µs | if (defined $self->{fh}) { | ||
| 77 | return $self; | ||||
| 78 | } | ||||
| 79 | 40 | 350µs | 40 | 11.7s | my $fh = $self->{repository}->open($self); # spent 11.7s making 40 calls to OpenBSD::PackageRepository::open, avg 292ms/call |
| 80 | 40 | 38µs | if (!defined $fh) { | ||
| 81 | $self->{repository}->parse_problems($self->{errors}, undef, | ||||
| 82 | $self) if defined $self->{errors}; | ||||
| 83 | undef $self->{errors}; | ||||
| 84 | return; | ||||
| 85 | } | ||||
| 86 | 40 | 300µs | require OpenBSD::Ustar; | ||
| 87 | 40 | 1.02ms | 40 | 1.51ms | my $archive = OpenBSD::Ustar->new($fh, $self->{repository}{state}); # spent 1.51ms making 40 calls to OpenBSD::Ustar::new, avg 38µs/call |
| 88 | 40 | 1.48ms | 80 | 5.53ms | $archive->set_description($self->{repository}->url($self->{name})); # spent 4.23ms making 40 calls to OpenBSD::PackageRepositoryBase::url, avg 106µs/call
# spent 1.30ms making 40 calls to OpenBSD::Ustar::set_description, avg 33µs/call |
| 89 | 40 | 77µs | $self->{_archive} = $archive; | ||
| 90 | 40 | 830µs | 40 | 836µs | $self->_set_callback; # spent 836µs making 40 calls to OpenBSD::PackageLocation::_set_callback, avg 21µs/call |
| 91 | |||||
| 92 | 40 | 51µs | if (defined $self->{_current_name}) { | ||
| 93 | while (my $e = $self->{_archive}->next) { | ||||
| 94 | if ($e->{name} eq $self->{_current_name}) { | ||||
| 95 | $self->{_current} = $e; | ||||
| 96 | return $self; | ||||
| 97 | } | ||||
| 98 | } | ||||
| 99 | } | ||||
| 100 | 40 | 446µs | return $self; | ||
| 101 | } | ||||
| 102 | |||||
| 103 | sub _set_callback | ||||
| 104 | # spent 836µs within OpenBSD::PackageLocation::_set_callback which was called 40 times, avg 21µs/call:
# 40 times (836µs+0s) by OpenBSD::PackageLocation::_opened at line 90, avg 21µs/call | ||||
| 105 | 40 | 45µs | my $self = shift; | ||
| 106 | 40 | 466µs | if (defined $self->{callback} && defined $self->{_archive}) { | ||
| 107 | $self->{_archive}->set_callback($self->{callback}); | ||||
| 108 | } | ||||
| 109 | } | ||||
| 110 | |||||
| 111 | sub find_contents | ||||
| 112 | # spent 121ms (1.88+119) within OpenBSD::PackageLocation::find_contents which was called 40 times, avg 3.01ms/call:
# 40 times (1.88ms+119ms) by OpenBSD::PackageLocation::contents at line 143, avg 3.01ms/call | ||||
| 113 | 40 | 48µs | my ($self, $extra) = @_; | ||
| 114 | |||||
| 115 | 40 | 616µs | 40 | 20.6ms | while (my $e = $self->next) { # spent 20.6ms making 40 calls to OpenBSD::PackageLocation::next, avg 514µs/call |
| 116 | 40 | 10.1ms | 80 | 19.5ms | if ($e->isFile && is_info_name($e->{name})) { # spent 19.5ms making 40 calls to OpenBSD::PackageInfo::is_info_name, avg 486µs/call
# spent 48µs making 40 calls to OpenBSD::Ustar::File::isFile, avg 1µs/call |
| 117 | 40 | 86µs | if ($e->{name} eq CONTENTS ) { | ||
| 118 | my $v = | ||||
| 119 | 40 | 1.46ms | 40 | 78.6ms | $self->{extra_content}.$e->contents($extra); # spent 78.6ms making 40 calls to OpenBSD::Ustar::File::contents, avg 1.97ms/call |
| 120 | 40 | 225µs | return $v; | ||
| 121 | } | ||||
| 122 | } else { | ||||
| 123 | $self->unput; | ||||
| 124 | last; | ||||
| 125 | } | ||||
| 126 | } | ||||
| 127 | } | ||||
| 128 | |||||
| 129 | sub contents | ||||
| 130 | { | ||||
| 131 | 80 | 109µs | my ($self, $extra) = @_; | ||
| 132 | 80 | 139µs | if (!defined $self->{contents}) { | ||
| 133 | 40 | 165µs | 40 | 11.7s | if (!$self->_opened) { # spent 11.7s making 40 calls to OpenBSD::PackageLocation::_opened, avg 292ms/call |
| 134 | return; | ||||
| 135 | } | ||||
| 136 | 40 | 42µs | if (defined $extra) { | ||
| 137 | my $contents = $self->find_contents($extra); | ||||
| 138 | if ($contents) { | ||||
| 139 | $self->unput; | ||||
| 140 | } | ||||
| 141 | return $contents; | ||||
| 142 | } | ||||
| 143 | 40 | 216µs | 40 | 121ms | $self->{contents} = $self->find_contents; # spent 121ms making 40 calls to OpenBSD::PackageLocation::find_contents, avg 3.01ms/call |
| 144 | } | ||||
| 145 | |||||
| 146 | 80 | 515µs | return $self->{contents}; | ||
| 147 | } | ||||
| 148 | |||||
| 149 | sub grab_info | ||||
| 150 | # spent 11.9s (9.47ms+11.9) within OpenBSD::PackageLocation::grab_info which was called 40 times, avg 299ms/call:
# 40 times (9.47ms+11.9s) by OpenBSD::PackageLocation::info at line 222, avg 299ms/call | ||||
| 151 | 40 | 40µs | my $self = shift; | ||
| 152 | 40 | 325µs | 40 | 38.1ms | my $dir = $self->{dir} = OpenBSD::Temp->dir; # spent 38.1ms making 40 calls to OpenBSD::Temp::dir, avg 951µs/call |
| 153 | |||||
| 154 | 40 | 187µs | 40 | 11.8s | my $c = $self->contents; # spent 11.8s making 40 calls to OpenBSD::PackageLocation::contents, avg 295ms/call |
| 155 | 40 | 42µs | if (!defined $c) { | ||
| 156 | return 0; | ||||
| 157 | } | ||||
| 158 | |||||
| 159 | 40 | 1.61ms | 40 | 1.11ms | if (! -f $dir.CONTENTS) { # spent 1.11ms making 40 calls to OpenBSD::PackageLocation::CORE:ftfile, avg 28µs/call |
| 160 | 40 | 3.07ms | 40 | 1.73ms | open my $fh, '>', $dir.CONTENTS or die "Permission denied"; # spent 1.73ms making 40 calls to OpenBSD::PackageLocation::CORE:open, avg 43µs/call |
| 161 | 40 | 2.78ms | 80 | 2.69ms | print $fh $self->contents; # spent 2.45ms making 40 calls to OpenBSD::PackageLocation::CORE:print, avg 61µs/call
# spent 242µs making 40 calls to OpenBSD::PackageLocation::contents, avg 6µs/call |
| 162 | 40 | 1.74ms | 40 | 1.07ms | close $fh; # spent 1.07ms making 40 calls to OpenBSD::PackageLocation::CORE:close, avg 27µs/call |
| 163 | } | ||||
| 164 | |||||
| 165 | 40 | 805µs | 80 | 63.8ms | while (my $e = $self->next) { # spent 63.8ms making 80 calls to OpenBSD::PackageLocation::next, avg 797µs/call |
| 166 | 79 | 782µs | 158 | 602µs | if ($e->isFile && is_info_name($e->{name})) { # spent 375µs making 79 calls to OpenBSD::PackageInfo::is_info_name, avg 5µs/call
# spent 228µs making 79 calls to OpenBSD::Ustar::File::isFile, avg 3µs/call |
| 167 | 40 | 140µs | $e->{name} = $dir.$e->{name}; | ||
| 168 | 40 | 51µs | undef $e->{mtime}; | ||
| 169 | 40 | 38µs | undef $e->{atime}; | ||
| 170 | 80 | 3.50ms | 40 | 21.4ms | eval { $e->create; }; # spent 21.4ms making 40 calls to OpenBSD::Ustar::File::create, avg 534µs/call |
| 171 | 40 | 43µs | if ($@) { | ||
| 172 | unlink($e->{name}); | ||||
| 173 | $@ =~ s/\s+at.*//o; | ||||
| 174 | $self->{repository}{state}->errprint('#1', $@); | ||||
| 175 | return 0; | ||||
| 176 | } | ||||
| 177 | } else { | ||||
| 178 | 39 | 137µs | 39 | 170µs | $self->unput; # spent 170µs making 39 calls to OpenBSD::PackageLocation::unput, avg 4µs/call |
| 179 | 39 | 65µs | last; | ||
| 180 | } | ||||
| 181 | } | ||||
| 182 | 40 | 22.9ms | return 1; | ||
| 183 | } | ||||
| 184 | |||||
| 185 | sub grabPlist | ||||
| 186 | { | ||||
| 187 | my ($self, $code) = @_; | ||||
| 188 | |||||
| 189 | my $plist = $self->plist($code); | ||||
| 190 | if (defined $plist) { | ||||
| 191 | $self->wipe_info; | ||||
| 192 | $self->close_now; | ||||
| 193 | return $plist; | ||||
| 194 | } else { | ||||
| 195 | return; | ||||
| 196 | } | ||||
| 197 | } | ||||
| 198 | |||||
| 199 | sub forget | ||||
| 200 | { | ||||
| 201 | my $self = shift; | ||||
| 202 | $self->wipe_info; | ||||
| 203 | $self->close_now; | ||||
| 204 | } | ||||
| 205 | |||||
| 206 | sub wipe_info | ||||
| 207 | # spent 54.9ms (1.33+53.6) within OpenBSD::PackageLocation::wipe_info which was called 40 times, avg 1.37ms/call:
# 40 times (1.33ms+53.6ms) by OpenBSD::PkgInfo::parse_and_run at line 608 of OpenBSD/PkgInfo.pm, avg 1.37ms/call | ||||
| 208 | 40 | 44µs | my $self = shift; | ||
| 209 | 40 | 364µs | 40 | 52.4ms | $self->{repository}->wipe_info($self); # spent 52.4ms making 40 calls to OpenBSD::PackageRepository::wipe_info, avg 1.31ms/call |
| 210 | 40 | 206µs | 40 | 1.05ms | $self->{repository}->close_now($self); # spent 1.05ms making 40 calls to OpenBSD::PackageRepositoryBase::close_now, avg 26µs/call |
| 211 | 40 | 352µs | delete $self->{contents}; | ||
| 212 | 40 | 122µs | 40 | 195µs | $self->deref; # spent 195µs making 40 calls to OpenBSD::PackageLocation::deref, avg 5µs/call |
| 213 | 40 | 58µs | delete $self->{_current_name}; | ||
| 214 | 40 | 47µs | delete $self->{update_info}; | ||
| 215 | 40 | 183µs | delete $self->{_unput}; | ||
| 216 | } | ||||
| 217 | |||||
| 218 | sub info | ||||
| 219 | # spent 12.0s (23.1ms+11.9) within OpenBSD::PackageLocation::info which was called 40 times, avg 299ms/call:
# 40 times (23.1ms+11.9s) by OpenBSD::PkgInfo::print_info at line 416 of OpenBSD/PkgInfo.pm, avg 299ms/call | ||||
| 220 | 40 | 42µs | my $self = shift; | ||
| 221 | |||||
| 222 | 40 | 194µs | 40 | 11.9s | if (!defined $self->{dir}) { # spent 11.9s making 40 calls to OpenBSD::PackageLocation::grab_info, avg 299ms/call |
| 223 | $self->grab_info; | ||||
| 224 | } | ||||
| 225 | 40 | 316µs | return $self->{dir}; | ||
| 226 | } | ||||
| 227 | |||||
| 228 | sub plist | ||||
| 229 | { | ||||
| 230 | my ($self, $code, $extra) = @_; | ||||
| 231 | require OpenBSD::PackingList; | ||||
| 232 | |||||
| 233 | if (defined $self->{dir} && -f $self->{dir}.CONTENTS) { | ||||
| 234 | my $plist = | ||||
| 235 | OpenBSD::PackingList->fromfile($self->{dir}.CONTENTS, | ||||
| 236 | $code); | ||||
| 237 | $plist->set_infodir($self->{dir}); | ||||
| 238 | return $plist; | ||||
| 239 | } | ||||
| 240 | if (my $value = $self->contents($extra)) { | ||||
| 241 | return OpenBSD::PackingList->fromfile(\$value, $code); | ||||
| 242 | } | ||||
| 243 | # hopeless | ||||
| 244 | $self->close_with_client_error; | ||||
| 245 | |||||
| 246 | return; | ||||
| 247 | } | ||||
| 248 | |||||
| 249 | sub close | ||||
| 250 | { | ||||
| 251 | my ($self, $hint) = @_; | ||||
| 252 | $self->{repository}->close($self, $hint); | ||||
| 253 | } | ||||
| 254 | |||||
| 255 | sub finish_and_close | ||||
| 256 | { | ||||
| 257 | my $self = shift; | ||||
| 258 | $self->{repository}->finish_and_close($self); | ||||
| 259 | } | ||||
| 260 | |||||
| 261 | sub close_now | ||||
| 262 | # spent 1.08s (448µs+1.08) within OpenBSD::PackageLocation::close_now which was called 40 times, avg 27.0ms/call:
# 40 times (448µs+1.08s) by OpenBSD::PkgInfo::parse_and_run at line 607 of OpenBSD/PkgInfo.pm, avg 27.0ms/call | ||||
| 263 | 40 | 44µs | my $self = shift; | ||
| 264 | 40 | 735µs | 40 | 1.08s | $self->{repository}->close_now($self); # spent 1.08s making 40 calls to OpenBSD::PackageRepositoryBase::close_now, avg 27.0ms/call |
| 265 | } | ||||
| 266 | |||||
| 267 | sub close_after_error | ||||
| 268 | { | ||||
| 269 | my $self = shift; | ||||
| 270 | $self->{repository}->close_after_error($self); | ||||
| 271 | } | ||||
| 272 | |||||
| 273 | sub close_with_client_error | ||||
| 274 | { | ||||
| 275 | my $self = shift; | ||||
| 276 | $self->{repository}->close_with_client_error($self); | ||||
| 277 | } | ||||
| 278 | |||||
| 279 | sub deref | ||||
| 280 | # spent 6.53ms (3.76+2.77) within OpenBSD::PackageLocation::deref which was called 120 times, avg 54µs/call:
# 80 times (3.57ms+2.77ms) by OpenBSD::PackageRepository::close at line 220 of OpenBSD/PackageRepository.pm, avg 79µs/call
# 40 times (195µs+0s) by OpenBSD::PackageLocation::wipe_info at line 212, avg 5µs/call | ||||
| 281 | 120 | 122µs | my $self = shift; | ||
| 282 | 120 | 127µs | delete $self->{fh}; | ||
| 283 | 120 | 125µs | delete $self->{pid2}; | ||
| 284 | 120 | 157µs | 2 | 47µs | delete $self->{_archive}; # spent 43µs making 1 call to IO::Uncompress::Base::DESTROY
# spent 4µs making 1 call to Compress::Raw::Zlib::inflateStream::DESTROY |
| 285 | 120 | 4.16ms | 78 | 2.72ms | delete $self->{_current}; # spent 1.93ms making 39 calls to IO::Uncompress::Base::DESTROY, avg 49µs/call
# spent 795µs making 39 calls to Compress::Raw::Zlib::inflateStream::DESTROY, avg 20µs/call |
| 286 | } | ||||
| 287 | |||||
| 288 | # proxy for archive operations | ||||
| 289 | sub next | ||||
| 290 | # spent 84.3ms (3.22+81.1) within OpenBSD::PackageLocation::next which was called 120 times, avg 703µs/call:
# 80 times (1.57ms+62.2ms) by OpenBSD::PackageLocation::grab_info at line 165, avg 797µs/call
# 40 times (1.65ms+18.9ms) by OpenBSD::PackageLocation::find_contents at line 115, avg 514µs/call | ||||
| 291 | 120 | 117µs | my $self = shift; | ||
| 292 | |||||
| 293 | 120 | 659µs | 120 | 688µs | if (!$self->_opened) { # spent 688µs making 120 calls to OpenBSD::PackageLocation::_opened, avg 6µs/call |
| 294 | return; | ||||
| 295 | } | ||||
| 296 | 120 | 232µs | if (!$self->{_unput}) { | ||
| 297 | 120 | 729µs | 120 | 80.4ms | $self->{_current} = $self->getNext; # spent 80.4ms making 120 calls to OpenBSD::PackageLocation::getNext, avg 670µs/call |
| 298 | 120 | 244µs | if (defined $self->{_current}) { | ||
| 299 | $self->{_current_name} = $self->{_current}{name}; | ||||
| 300 | } else { | ||||
| 301 | 1 | 1µs | delete $self->{_current_name}; | ||
| 302 | } | ||||
| 303 | } else { | ||||
| 304 | $self->{_unput} = 0; | ||||
| 305 | } | ||||
| 306 | 120 | 465µs | return $self->{_current}; | ||
| 307 | } | ||||
| 308 | |||||
| 309 | sub unput | ||||
| 310 | # spent 170µs within OpenBSD::PackageLocation::unput which was called 39 times, avg 4µs/call:
# 39 times (170µs+0s) by OpenBSD::PackageLocation::grab_info at line 178, avg 4µs/call | ||||
| 311 | 39 | 39µs | my $self = shift; | ||
| 312 | 39 | 190µs | $self->{_unput} = 1; | ||
| 313 | } | ||||
| 314 | |||||
| 315 | sub getNext | ||||
| 316 | # spent 80.4ms (985µs+79.4) within OpenBSD::PackageLocation::getNext which was called 120 times, avg 670µs/call:
# 120 times (985µs+79.4ms) by OpenBSD::PackageLocation::next at line 297, avg 670µs/call | ||||
| 317 | 120 | 106µs | my $self = shift; | ||
| 318 | |||||
| 319 | 120 | 1.37ms | 120 | 79.4ms | return $self->{_archive}->next; # spent 79.4ms making 120 calls to OpenBSD::Ustar::next, avg 662µs/call |
| 320 | } | ||||
| 321 | |||||
| 322 | sub skip | ||||
| 323 | { | ||||
| 324 | my $self = shift; | ||||
| 325 | return $self->{_archive}->skip; | ||||
| 326 | } | ||||
| 327 | |||||
| 328 | sub set_callback | ||||
| 329 | { | ||||
| 330 | my ($self, $code) = @_; | ||||
| 331 | $self->{callback} = $code; | ||||
| 332 | $self->_set_callback; | ||||
| 333 | } | ||||
| 334 | |||||
| 335 | package OpenBSD::PackageLocation::Installed; | ||||
| 336 | 1 | 8µs | our @ISA = qw(OpenBSD::PackageLocation); | ||
| 337 | |||||
| 338 | |||||
| 339 | sub info | ||||
| 340 | { | ||||
| 341 | my $self = shift; | ||||
| 342 | require OpenBSD::PackageInfo; | ||||
| 343 | $self->{dir} = OpenBSD::PackageInfo::installed_info($self->name); | ||||
| 344 | } | ||||
| 345 | |||||
| 346 | sub plist | ||||
| 347 | { | ||||
| 348 | my ($self, $code) = @_; | ||||
| 349 | require OpenBSD::PackingList; | ||||
| 350 | return OpenBSD::PackingList->from_installation($self->name, $code); | ||||
| 351 | } | ||||
| 352 | |||||
| 353 | 1 | 6µs | 1; | ||
# spent 1.07ms within OpenBSD::PackageLocation::CORE:close which was called 40 times, avg 27µs/call:
# 40 times (1.07ms+0s) by OpenBSD::PackageLocation::grab_info at line 162, avg 27µs/call | |||||
# spent 1.11ms within OpenBSD::PackageLocation::CORE:ftfile which was called 40 times, avg 28µs/call:
# 40 times (1.11ms+0s) by OpenBSD::PackageLocation::grab_info at line 159, avg 28µs/call | |||||
# spent 1.73ms within OpenBSD::PackageLocation::CORE:open which was called 40 times, avg 43µs/call:
# 40 times (1.73ms+0s) by OpenBSD::PackageLocation::grab_info at line 160, avg 43µs/call | |||||
# spent 2.45ms within OpenBSD::PackageLocation::CORE:print which was called 40 times, avg 61µs/call:
# 40 times (2.45ms+0s) by OpenBSD::PackageLocation::grab_info at line 161, avg 61µs/call |