| 1 | package Linux::Event::Loop::Introspection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 181 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 181 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 181 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 181 | ▶ | use Scalar::Util qw(blessed refaddr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 181 | my @CENSUS_TYPES = qw(pipe tty stream listener dgram timer signal event inotify process); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 798 | ▶ | sub _type_of ($object) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_type_of: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 798 | ▶ | return 'unknown' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$object->isa("Linux::Event::_ByteStream::_Deadline") or $object->isa("Linux::Event::_Socket::Dgram::_ReadyTimer")
MC/DC50%1/2
$object->isa("Linux::Event::_ByteStream::_Deadline") or $object->isa("Linux::Event::_Socket::Dgram::_ReadyTimer")
$object->isa("Linux::Event::_ByteStream::_Deadline")
$object->isa("Linux::Event::_Socket::Dgram::_ReadyTimer")
Truth table66%2/3
A or B
A= $object->isa("Linux::Event::_ByteStream::_Deadline")B= $object->isa("Linux::Event::_Socket::Dgram::_ReadyTimer")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | if $object->isa('Linux::Event::_ByteStream::_Deadline') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | || $object->isa('Linux::Event::_Socket::Dgram::_ReadyTimer'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 770 | ▶ | return 'pipe' if $object->isa('Linux::Event::IO::Pipe'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 708 | ▶ | return 'tty' if $object->isa('Linux::Event::IO::TTY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 703 | ▶ | return 'stream' if $object->isa('Linux::Event::IO::Sock::Stream'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 600 | ▶ | return 'listener' if $object->isa('Linux::Event::IO::Sock::Listener'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 532 | ▶ | return 'dgram' if $object->isa('Linux::Event::IO::Sock::Dgram'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 474 | ▶ | return 'timer' if $object->isa('Linux::Event::Kernel::Timer'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 359 | ▶ | return 'signal' if $object->isa('Linux::Event::Kernel::Signal'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 301 | ▶ | return 'event' if $object->isa('Linux::Event::Kernel::Event'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 245 | ▶ | return 'inotify' if $object->isa('Linux::Event::Kernel::Inotify'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 128 | ▶ | return 'process' if $object->isa('Linux::Event::Kernel::Process'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 70 | return 'unknown'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 335 | ▶ | sub _is_current ($self, $object) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_current: called CC=7 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 335 | ▶ | return 0 if !blessed($object) || _type_of($object) eq 'unknown'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not builtin::blessed($object) or _type_of($object) eq "unknown"
MC/DC0%0/2
not builtin::blessed($object) or _type_of($object) eq "unknown"
not builtin::blessed($object)
_type_of($object) eq "unknown"
Truth table33%1/3
not(A) or B
A= not builtin::blessed($object)B= _type_of($object) eq "unknown"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 335 | my $loop = eval { $object->loop }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 335 | ▶ | return 0 if !$loop || refaddr($loop) != refaddr($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $loop or builtin::refaddr($loop) != builtin::refaddr($self)
MC/DC100%2/2
not $loop or builtin::refaddr($loop) != builtin::refaddr($self)
not $loop
builtin::refaddr($loop) != builtin::refaddr($self)
Truth table100%3/3
not(A) or B
A= not $loopB= builtin::refaddr($loop) != builtin::refaddr($self)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | return 0 if $object->can('is_terminal') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 330 | ▶ | && eval { $object->is_terminal }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$object->can("is_terminal") and eval {
do {
$object->is_terminal
}
}
MC/DC0%0/2
$object->can("is_terminal") and eval {
do {
$object->is_terminal
}
}
$object->can("is_terminal")
eval {
do {
$object->is_terminal
}
}
Truth table33%1/3
A and B
A= $object->can("is_terminal")B= eval {
do {
$object->is_terminal
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 330 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 83 | ▶ | sub _object_snapshot ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_object_snapshot: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 83 | my @candidate = @{ $self->_object_candidates_native }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 83 | ▶ | push @candidate, @{ Linux::Event::Kernel::Signal->_objects_for_loop($self) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | if Linux::Event::Kernel::Signal->can('_objects_for_loop'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 83 | ▶ | push @candidate, @{ Linux::Event::Kernel::Event->_objects_for_loop($self) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | if Linux::Event::Kernel::Event->can('_objects_for_loop'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 83 | ▶ | push @candidate, @{ Linux::Event::Kernel::Inotify->_objects_for_loop($self) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | if Linux::Event::Kernel::Inotify->can('_objects_for_loop'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 83 | ▶ | push @candidate, @{ Linux::Event::_Resolver->_objects_for_loop($self) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | if Linux::Event::_Resolver->can('_objects_for_loop'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 83 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | my @result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 83 | for my $candidate (@candidate) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 348 | ▶ | my $object = _owner_of($candidate) // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
_owner_of($candidate) // (next)
MC/DC100%1/1
_owner_of($candidate) // (next)
_owner_of($candidate)
Truth table100%2/2
A
A= _owner_of($candidate)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 320 | ▶ | next if $seen{ refaddr($object) }++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 285 | ▶ | next if !$self->_is_current($object); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 285 | push @result, $object; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 83 | return \@result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 6 | ▶ | sub count ($self) { scalar @{ $self->_object_snapshot } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 50 | ▶ | sub has ($self, $object) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 50 | ▶ | return 0 if !blessed($object); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 50 | ▶ | return 0 if !$self->_is_current($object); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 45 | my $id = refaddr($object); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 45 | return !!grep { refaddr($_) == $id } @{ $self->_object_snapshot }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 25 | ▶ | sub objects ($self) { [ @{ $self->_object_snapshot } ] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
objects: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | ▶ | sub census ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
census: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | my %count = map { $_ => 0 } @CENSUS_TYPES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | $count{ _type_of($_) }++ for @{ $self->_object_snapshot }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | return \%count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 221 | ▶ | sub _value ($object, $method) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_value: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 221 | ▶ | return undef if !$object->can($method); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 221 | return eval { $object->$method() }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 418 | ▶ | sub _owner_of ($candidate) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_owner_of: called CC=9 SCAR=28.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 418 | ▶ | return undef if !ref($candidate); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 418 | ▶ | if (blessed($candidate)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 418 | ▶ | return $candidate if _type_of($candidate) ne 'unknown'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 98 | ▶ | return _owner_of(scalar eval { $candidate->object }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | if $candidate->isa('Linux::Event::_ByteStream::State'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | return _owner_of(scalar eval { $candidate->_introspection_owner }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | if $candidate->can('_introspection_owner'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 28 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if (ref($candidate) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | for my $key (qw(stream recipient owner object request)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my $owner = _owner_of($candidate->{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return $owner if $owner; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 17 | ▶ | sub _fd ($object) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fd: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 17 | ▶ | return _value($object, 'fd') if $object->can('fd'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 5 | my $fh = _value($object, 'fh'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 5 | ▶ | return defined($fh) ? fileno($fh) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 25 | ▶ | sub inspect ($self, $object) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inspect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 25 | return $self->_inspect_object($object, $self->has($object)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 35 | ▶ | sub _inspect_object ($self, $object, $registered) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inspect_object: called CC=23 SCAR=32.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 35 | ▶ | my $type = blessed($object) ? _type_of($object) : 'unknown'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 35 | ▶ | my $result = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
builtin::blessed($object) || undef
MC/DC0%0/1
builtin::blessed($object) || undef
builtin::blessed($object)
Truth table50%1/2
A
A= builtin::blessed($object)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | type => $type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | class => blessed($object) || undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | registered => $registered ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 35 | ▶ | return $result if !$registered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 33 | $result->{state} = _value($object, 'state'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 33 | ▶ | if ($type eq 'pipe' || $type eq 'tty' || $type eq 'stream') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
Condition83%5/6
$type eq "pipe" or $type eq "tty" or $type eq "stream"
$type eq "pipe" or $type eq "tty"
MC/DC66%2/3
$type eq "pipe" or $type eq "tty" or $type eq "stream"
$type eq "pipe"
$type eq "tty"
$type eq "stream"
Truth table75%3/4
A or B or C
A= $type eq "pipe"B= $type eq "tty"C= $type eq "stream"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 11 | ▶ | @$result{qw(fd read_fd write_fd pending_bytes read_paused read_eof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | read_closed write_ended write_blocked)} = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | _fd($object), _value($object, 'read_fd'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | _value($object, 'write_fd'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | _value($object, 'pending_bytes'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | _value($object, 'is_read_paused') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | _value($object, 'is_read_eof') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | _value($object, 'is_read_closed') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | _value($object, 'is_write_ended') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | _value($object, 'is_write_blocked') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 11 | ▶ | if ($type eq 'stream') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 6 | @$result{qw(local peer transport)} = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | _value($object, 'local'), _value($object, 'peer'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | _value($object, 'transport_name'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | elsif ($type eq 'listener') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 3 | ▶ | @$result{qw(fd host port path family paused accepted)} = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | _fd($object), _value($object, 'host'), _value($object, 'port'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | _value($object, 'path'), _value($object, 'family'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | _value($object, 'is_paused') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | _value($object, 'accepted'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | elsif ($type eq 'dgram') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | ▶ | @$result{qw(fd local peer connected pending_bytes pending_datagrams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | read_paused)} = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | _fd($object), _value($object, 'local'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | _value($object, 'peer'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | _value($object, 'is_connected') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | _value($object, 'pending_bytes'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | _value($object, 'pending_datagrams'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | _value($object, 'is_read_paused') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | elsif ($type eq 'timer') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 4 | @$result{qw(deadline interval expirations)} = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | _value($object, 'deadline'), _value($object, 'interval'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | _value($object, 'expirations'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | elsif ($type eq 'signal') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | $result->{signals} = _value($object, 'signals'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | elsif ($type eq 'inotify') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | @$result{qw(fd watches)} = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | _value($object, 'fd'), _value($object, 'watch_count'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | elsif ($type eq 'process') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | @$result{qw(pid pending_stdin_bytes)} = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | _value($object, 'pid'), _value($object, 'pending_stdin_bytes'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 33 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 25 | ▶ | sub resources ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resources: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 25 | my $resource = $self->_resources_native; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 25 | $resource->{defer_fd} = $self->_deferred_fd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 25 | $resource->{pending_deferred} = $self->_deferred_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 25 | return $resource; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 5 | ▶ | sub why_alive ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
why_alive: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | my @reason = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 10 | my $snapshot = $self->_inspect_object($_, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 10 | $snapshot->{object} = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 10 | $snapshot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 5 | } @{ $self->_object_snapshot }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | my $resources = $self->resources; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | push @reason, map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | +{ type => 'registration', registered => 1, fd => $_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 5 | } @{ $resources->{public_registration_fds} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | push @reason, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | type => 'deferred', pending => $resources->{pending_deferred}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 5 | ▶ | } if $resources->{pending_deferred}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 5 | return \@reason; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | sub pressure ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pressure: called CC=6 SCAR=20.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | my $resource = $self->_resources_native; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | my $stats = $self->stats; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | my $registry_capacity = $resource->{registry_capacity}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | my $timer_capacity = $resource->{timer_heap_capacity}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | my $event_capacity = $resource->{event_capacity}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | registrations => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | active => $resource->{registered_fds}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | capacity => $registry_capacity, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | utilization => $registry_capacity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | ? $resource->{registered_fds} / $registry_capacity : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | timers => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | active => $resource->{active_timers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | capacity => $timer_capacity, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | utilization => $timer_capacity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ? $resource->{active_timers} / $timer_capacity : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | event_batch => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | capacity => $event_capacity, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | maximum => $stats->{epoll_wait_calls} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | ? $stats->{epoll_wait_max_batch} : undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | utilization => $stats->{epoll_wait_calls} && $event_capacity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | ▶ | ? $stats->{epoll_wait_max_batch} / $event_capacity : undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition33%1/3
$stats->{"epoll_wait_calls"} and $event_capacity
MC/DC0%0/2
$stats->{"epoll_wait_calls"} and $event_capacity
$stats->{"epoll_wait_calls"}
$event_capacity
Truth table33%1/3
A and B
A= $stats->{"epoll_wait_calls"}B= $event_capacity
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 181 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||