| 1 | package Linux::Event::Loop::Introspection; | ||||||||||||||||||||||||||||||||||||||||
| 2 | 135 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 3 | 135 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 4 | 135 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||
| 6 | 135 | ▶ | use Scalar::Util qw(blessed refaddr); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 7 | 135 | my @CENSUS_TYPES = qw(stream listener datagram timer signal wakeup process); | |||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||
| 9 | 325 | ▶ | sub _type_of ($object) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_type_of: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||
| 10 | 325 | ▶ | return 'unknown' | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$object->isa("Linux::Event::Stream::_Deadline") or $object->isa("Linux::Event::Datagram::_ReadyTimer")
MC/DC50%1/2
$object->isa("Linux::Event::Stream::_Deadline") or $object->isa("Linux::Event::Datagram::_ReadyTimer")
$object->isa("Linux::Event::Stream::_Deadline")
$object->isa("Linux::Event::Datagram::_ReadyTimer")
Truth table66%2/3
A or B
A= $object->isa("Linux::Event::Stream::_Deadline")B= $object->isa("Linux::Event::Datagram::_ReadyTimer")
| |||||||||||||||||||||||||||||||||||||||||
| 11 | if $object->isa('Linux::Event::Stream::_Deadline') | ||||||||||||||||||||||||||||||||||||||||
| 12 | || $object->isa('Linux::Event::Datagram::_ReadyTimer'); | ||||||||||||||||||||||||||||||||||||||||
| 13 | 307 | ▶ | return 'stream' if $object->isa('Linux::Event::Stream'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 14 | 269 | ▶ | return 'listener' if $object->isa('Linux::Event::Listener'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 15 | 231 | ▶ | return 'datagram' if $object->isa('Linux::Event::Datagram'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 16 | 193 | ▶ | return 'timer' if $object->isa('Linux::Event::Timer'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 17 | 128 | ▶ | return 'signal' if $object->isa('Linux::Event::Signal'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 18 | 90 | ▶ | return 'wakeup' if $object->isa('Linux::Event::Wakeup'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 19 | 54 | ▶ | return 'process' if $object->isa('Linux::Event::Process'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 20 | 16 | return 'unknown'; | |||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||
| 23 | 140 | ▶ | sub _is_current ($self, $object) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_current: called CC=7 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||
| 24 | 140 | ▶ | 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"
| |||||||||||||||||||||||||||||||||||||||||
| 25 | 140 | my $loop = eval { $object->loop }; | |||||||||||||||||||||||||||||||||||||||
| 26 | 140 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||
| 27 | return 0 if $object->can('is_terminal') | ||||||||||||||||||||||||||||||||||||||||
| 28 | 135 | ▶ | && 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
}
}
| |||||||||||||||||||||||||||||||||||||||||
| 29 | 135 | return 1; | |||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||
| 32 | 28 | ▶ | sub _object_snapshot ($self) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_object_snapshot: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||
| 33 | 28 | my @candidate = @{ $self->_object_candidates_native }; | |||||||||||||||||||||||||||||||||||||||
| 34 | 28 | ▶ | push @candidate, @{ Linux::Event::Signal->_objects_for_loop($self) } | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 35 | if Linux::Event::Signal->can('_objects_for_loop'); | ||||||||||||||||||||||||||||||||||||||||
| 36 | 28 | ▶ | push @candidate, @{ Linux::Event::Wakeup->_objects_for_loop($self) } | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 37 | if Linux::Event::Wakeup->can('_objects_for_loop'); | ||||||||||||||||||||||||||||||||||||||||
| 38 | 28 | ▶ | push @candidate, @{ Linux::Event::_Resolver->_objects_for_loop($self) } | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 39 | if Linux::Event::_Resolver->can('_objects_for_loop'); | ||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||
| 41 | 28 | my %seen; | |||||||||||||||||||||||||||||||||||||||
| 42 | my @result; | ||||||||||||||||||||||||||||||||||||||||
| 43 | 28 | for my $candidate (@candidate) { | |||||||||||||||||||||||||||||||||||||||
| 44 | 138 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||
| 45 | 120 | ▶ | next if $seen{ refaddr($object) }++; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 46 | 120 | ▶ | next if !$self->_is_current($object); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 47 | 120 | push @result, $object; | |||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||
| 49 | 28 | return \@result; | |||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | ▶ | sub count ($self) { scalar @{ $self->_object_snapshot } } | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
count: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||
| 54 | 20 | ▶ | sub has ($self, $object) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
has: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 55 | 20 | ▶ | return 0 if !blessed($object); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 56 | 20 | ▶ | return 0 if !$self->_is_current($object); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 57 | 15 | my $id = refaddr($object); | |||||||||||||||||||||||||||||||||||||||
| 58 | 15 | return !!grep { refaddr($_) == $id } @{ $self->_object_snapshot }; | |||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||
| 61 | 2 | ▶ | sub objects ($self) { [ @{ $self->_object_snapshot } ] } | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
objects: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | ▶ | sub census ($self) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
census: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | my %count = map { $_ => 0 } @CENSUS_TYPES; | |||||||||||||||||||||||||||||||||||||||
| 65 | 2 | $count{ _type_of($_) }++ for @{ $self->_object_snapshot }; | |||||||||||||||||||||||||||||||||||||||
| 66 | 2 | return \%count; | |||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||
| 69 | 111 | ▶ | sub _value ($object, $method) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_value: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||
| 70 | 111 | ▶ | return undef if !$object->can($method); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 71 | 111 | return eval { $object->$method() }; | |||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||
| 74 | 154 | ▶ | sub _owner_of ($candidate) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_owner_of: called CC=9 SCAR=28.9
| |||||||||||||||||||||||||||||||||||||||||
| 75 | 154 | ▶ | return undef if !ref($candidate); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 76 | 154 | ▶ | if (blessed($candidate)) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 77 | 154 | ▶ | return $candidate if _type_of($candidate) ne 'unknown'; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 78 | 34 | ▶ | return _owner_of(eval { $candidate->stream }) | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 79 | if $candidate->isa('Linux::Event::Stream::XSState'); | ||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | return _owner_of(eval { $candidate->_introspection_owner }) | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 81 | if $candidate->can('_introspection_owner'); | ||||||||||||||||||||||||||||||||||||||||
| 82 | 18 | return undef; | |||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if (ref($candidate) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | for my $key (qw(stream recipient owner object request)) { | |||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $owner = _owner_of($candidate->{$key}); | |||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | return $owner if $owner; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||
| 93 | 9 | ▶ | sub _fd ($object) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fd: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||
| 94 | 9 | ▶ | return _value($object, 'fd') if $object->can('fd'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 95 | 3 | my $fh = _value($object, 'fh'); | |||||||||||||||||||||||||||||||||||||||
| 96 | 3 | ▶ | return defined($fh) ? fileno($fh) : undef; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||
| 99 | 15 | ▶ | sub inspect ($self, $object) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
inspect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 100 | 15 | return $self->_inspect_object($object, $self->has($object)); | |||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||
| 103 | 23 | ▶ | sub _inspect_object ($self, $object, $registered) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inspect_object: called CC=18 SCAR=30.2
| |||||||||||||||||||||||||||||||||||||||||
| 104 | 23 | ▶ | my $type = blessed($object) ? _type_of($object) : 'unknown'; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 105 | 23 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||
| 106 | type => $type, | ||||||||||||||||||||||||||||||||||||||||
| 107 | class => blessed($object) || undef, | ||||||||||||||||||||||||||||||||||||||||
| 108 | registered => $registered ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 109 | }; | ||||||||||||||||||||||||||||||||||||||||
| 110 | 23 | ▶ | return $result if !$registered; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||
| 112 | 21 | $result->{state} = _value($object, 'state'); | |||||||||||||||||||||||||||||||||||||||
| 113 | 21 | ▶ | if ($type eq 'stream') { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||
| 114 | 3 | ▶ | @$result{qw(fd local peer transport pending_bytes read_paused | ||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||
| 115 | read_eof write_ended write_blocked)} = ( | ||||||||||||||||||||||||||||||||||||||||
| 116 | _fd($object), _value($object, 'local'), | ||||||||||||||||||||||||||||||||||||||||
| 117 | _value($object, 'peer'), _value($object, 'transport_name'), | ||||||||||||||||||||||||||||||||||||||||
| 118 | _value($object, 'pending_bytes'), | ||||||||||||||||||||||||||||||||||||||||
| 119 | _value($object, 'is_read_paused') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 120 | _value($object, 'is_read_eof') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 121 | _value($object, 'is_write_ended') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 122 | _value($object, 'is_write_blocked') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||
| 125 | elsif ($type eq 'listener') { | ||||||||||||||||||||||||||||||||||||||||
| 126 | 3 | ▶ | @$result{qw(fd host port path family paused accepted)} = ( | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 127 | _fd($object), _value($object, 'host'), _value($object, 'port'), | ||||||||||||||||||||||||||||||||||||||||
| 128 | _value($object, 'path'), _value($object, 'family'), | ||||||||||||||||||||||||||||||||||||||||
| 129 | _value($object, 'is_paused') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 130 | _value($object, 'accepted'), | ||||||||||||||||||||||||||||||||||||||||
| 131 | ); | ||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||
| 133 | elsif ($type eq 'datagram') { | ||||||||||||||||||||||||||||||||||||||||
| 134 | 3 | ▶ | @$result{qw(fd local peer connected pending_bytes pending_datagrams | ||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||
| 135 | read_paused)} = ( | ||||||||||||||||||||||||||||||||||||||||
| 136 | _fd($object), _value($object, 'local'), | ||||||||||||||||||||||||||||||||||||||||
| 137 | _value($object, 'peer'), | ||||||||||||||||||||||||||||||||||||||||
| 138 | _value($object, 'is_connected') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 139 | _value($object, 'pending_bytes'), | ||||||||||||||||||||||||||||||||||||||||
| 140 | _value($object, 'pending_datagrams'), | ||||||||||||||||||||||||||||||||||||||||
| 141 | _value($object, 'is_read_paused') ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||
| 144 | elsif ($type eq 'timer') { | ||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | @$result{qw(deadline interval expirations)} = ( | |||||||||||||||||||||||||||||||||||||||
| 146 | _value($object, 'deadline'), _value($object, 'interval'), | ||||||||||||||||||||||||||||||||||||||||
| 147 | _value($object, 'expirations'), | ||||||||||||||||||||||||||||||||||||||||
| 148 | ); | ||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||
| 150 | elsif ($type eq 'signal') { | ||||||||||||||||||||||||||||||||||||||||
| 151 | 3 | $result->{signals} = _value($object, 'signals'); | |||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||
| 153 | elsif ($type eq 'process') { | ||||||||||||||||||||||||||||||||||||||||
| 154 | 3 | @$result{qw(pid pending_stdin_bytes)} = ( | |||||||||||||||||||||||||||||||||||||||
| 155 | _value($object, 'pid'), _value($object, 'pending_stdin_bytes'), | ||||||||||||||||||||||||||||||||||||||||
| 156 | ); | ||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||
| 158 | 21 | return $result; | |||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | ▶ | sub resources ($self) { $self->_resources_native } | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
resources: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | ▶ | sub why_alive ($self) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
why_alive: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 164 | my @reason = map { | ||||||||||||||||||||||||||||||||||||||||
| 165 | 8 | my $snapshot = $self->_inspect_object($_, 1); | |||||||||||||||||||||||||||||||||||||||
| 166 | 8 | $snapshot->{object} = $_; | |||||||||||||||||||||||||||||||||||||||
| 167 | 8 | $snapshot; | |||||||||||||||||||||||||||||||||||||||
| 168 | 3 | } @{ $self->_object_snapshot }; | |||||||||||||||||||||||||||||||||||||||
| 169 | 3 | my $resources = $self->_resources_native; | |||||||||||||||||||||||||||||||||||||||
| 170 | push @reason, map { | ||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | +{ type => 'registration', registered => 1, fd => $_ } | |||||||||||||||||||||||||||||||||||||||
| 172 | 3 | } @{ $resources->{public_registration_fds} }; | |||||||||||||||||||||||||||||||||||||||
| 173 | 3 | return \@reason; | |||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | ▶ | sub pressure ($self) { | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
pressure: called CC=6 SCAR=20.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | my $resource = $self->_resources_native; | |||||||||||||||||||||||||||||||||||||||
| 178 | 1 | my $stats = $self->stats; | |||||||||||||||||||||||||||||||||||||||
| 179 | 1 | my $registry_capacity = $resource->{registry_capacity}; | |||||||||||||||||||||||||||||||||||||||
| 180 | 1 | my $timer_capacity = $resource->{timer_heap_capacity}; | |||||||||||||||||||||||||||||||||||||||
| 181 | 1 | my $event_capacity = $resource->{event_capacity}; | |||||||||||||||||||||||||||||||||||||||
| 182 | return { | ||||||||||||||||||||||||||||||||||||||||
| 183 | registrations => { | ||||||||||||||||||||||||||||||||||||||||
| 184 | active => $resource->{registered_fds}, | ||||||||||||||||||||||||||||||||||||||||
| 185 | capacity => $registry_capacity, | ||||||||||||||||||||||||||||||||||||||||
| 186 | utilization => $registry_capacity | ||||||||||||||||||||||||||||||||||||||||
| 187 | ? $resource->{registered_fds} / $registry_capacity : 0, | ||||||||||||||||||||||||||||||||||||||||
| 188 | }, | ||||||||||||||||||||||||||||||||||||||||
| 189 | timers => { | ||||||||||||||||||||||||||||||||||||||||
| 190 | active => $resource->{active_timers}, | ||||||||||||||||||||||||||||||||||||||||
| 191 | capacity => $timer_capacity, | ||||||||||||||||||||||||||||||||||||||||
| 192 | utilization => $timer_capacity | ||||||||||||||||||||||||||||||||||||||||
| 193 | ? $resource->{active_timers} / $timer_capacity : 0, | ||||||||||||||||||||||||||||||||||||||||
| 194 | }, | ||||||||||||||||||||||||||||||||||||||||
| 195 | event_batch => { | ||||||||||||||||||||||||||||||||||||||||
| 196 | capacity => $event_capacity, | ||||||||||||||||||||||||||||||||||||||||
| 197 | maximum => $stats->{epoll_wait_calls} | ||||||||||||||||||||||||||||||||||||||||
| 198 | ? $stats->{epoll_wait_max_batch} : undef, | ||||||||||||||||||||||||||||||||||||||||
| 199 | utilization => $stats->{epoll_wait_calls} && $event_capacity | ||||||||||||||||||||||||||||||||||||||||
| 200 | 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
| |||||||||||||||||||||||||||||||||||||||||
| 201 | }, | ||||||||||||||||||||||||||||||||||||||||
| 202 | }; | ||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||
| 205 | 135 | 1; | |||||||||||||||||||||||||||||||||||||||