| 1 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Core methods for the manager process. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## This package provides the loop and relevant methods used internally by the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## manager process. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ## There is no public API. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | package MCE::Core::Manager; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 85 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 85 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 85 | our $VERSION = '1.889'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | ## no critic (BuiltinFunctions::ProhibitStringyEval) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ## no critic (TestingAndDebugging::ProhibitNoStrict) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ## Items below are folded into MCE. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | package # hide from rpm | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | MCE; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 85 | ▶ | no warnings qw( threads recursion uninitialized ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ## The POSIX module has many symbols. Try not loading it simply | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ## to have WNOHANG. The following covers most platforms. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 85 | ▶ | _WNOHANG => ( $INC{'POSIX.pm'} ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ? &POSIX::WNOHANG : ( $^O eq 'solaris' ) ? 64 : 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 85 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ## Call on task_end after task completion. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | sub _task_end { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 214 | ▶ | my ($self, $_task_id) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_task_end: called CC=6 SCAR=18.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 214 | @_ = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 214 | ▶ | if (defined $self->{user_tasks}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | my $_task_end = (exists $self->{user_tasks}->[$_task_id]->{task_end}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ? $self->{user_tasks}->[$_task_id]->{task_end} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 180 | ▶ | : $self->{task_end}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 180 | ▶ | if (defined $_task_end) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | my $_task_name = (exists $self->{user_tasks}->[$_task_id]->{task_name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ? $self->{user_tasks}->[$_task_id]->{task_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 144 | ▶ | : $self->{task_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 144 | $_task_end->($self, $_task_id, $_task_name); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | elsif (defined $self->{task_end}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | $self->{task_end}->($self, 0, $self->{task_name}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 214 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ## Process output. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ## Awaits and processes events from workers. The sendto/do methods tag the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ## output accordingly. The hash structure below is key-driven. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 85 | my %_sendto_fhs; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | sub _sendto_fhs_close { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 502 | ▶ | for my $_p (keys %_sendto_fhs) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sendto_fhs_close: called CC=2 SCAR=11.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | close $_sendto_fhs{$_p}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | delete $_sendto_fhs{$_p}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | sub _sendto_fhs_get { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | my ($self, $_fd) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sendto_fhs_get: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $_sendto_fhs{$_fd} || do { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $_sendto_fhs{$_fd} = IO::Handle->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | $_sendto_fhs{$_fd}->fdopen($_fd, 'w') | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | or _croak "Cannot open file descriptor ($_fd): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | binmode $_sendto_fhs{$_fd}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if (!exists $self->{flush_file} || $self->{flush_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not exists $self->{"flush_file"} or $self->{"flush_file"}
MC/DC0%0/2
not exists $self->{"flush_file"} or $self->{"flush_file"}
not exists $self->{"flush_file"}
$self->{"flush_file"}
Truth table0%0/3
not(A) or B
A= not exists $self->{"flush_file"}B= $self->{"flush_file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | local $!; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $_sendto_fhs{$_fd}->autoflush(1) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $_sendto_fhs{$_fd}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | sub _output_loop { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 142 | ▶ | my ( $self, $_input_data, $_input_glob, $_plugin_function, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_output_loop: called CC=61 SCAR=69.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | $_plugin_loop_begin, $_plugin_loop_end ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 142 | @_ = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 142 | $_aborted, $_eof_flag, $_max_retries, $_syn_flag, $_win32_ipc, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | $_cb, $_chunk_id, $_chunk_size, $_file, $_size_completed, $_wa, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | @_is_c_ref, @_is_h_ref, @_is_q_ref, $_on_post_exit, $_on_post_run, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $_has_user_tasks, $_sess_dir, $_task_id, $_user_error, $_user_output, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | $_input_size, $_offset_pos, $_single_dim, @_gather, $_cs_one_flag, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | $_exit_id, $_exit_pid, $_exit_status, $_exit_wid, $_len, $_sync_cnt, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | $_BSB_W_SOCK, $_BSB_R_SOCK, $_DAT_R_SOCK, $_DAU_R_SOCK, $_MCE_STDERR, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | $_I_FLG, $_O_FLG, $_I_SEP, $_O_SEP, $_RS, $_RS_FLG, $_MCE_STDOUT, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | @_delay_wid | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ## Callback return. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | my $_cb_reply = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 285 | ▶ | local $\ = $_O_SEP if ($_O_FLG); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 285 | ▶ | local $/ = $_I_SEP if ($_I_FLG); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 85 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 285 | ▶ | if ( $_wa == WANTS_UNDEF ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 274 | $_cb->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 274 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | elsif ( $_wa == WANTS_ARRAY ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | my @_ret = $_cb->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | my $_buf = $self->{freeze}(\@_ret); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | return print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 9 | my $_ret = $_cb->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 9 | my $_buf = $self->{freeze}([ $_ret ]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 9 | return print {$_DAU_R_SOCK} length($_buf).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 142 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ## Create hash structure containing various output functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | my %_core_output_function = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | OUTPUT_W_ABT.$LF => sub { # Worker has aborted | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $_aborted = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | OUTPUT_W_DNE.$LF => sub { # Worker has completed | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 428 | ▶ | chomp($_task_id = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=26.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 856 | $self->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 856 | ▶ | if ($_has_user_tasks && $_task_id >= 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_has_user_tasks and $_task_id >= 0
MC/DC50%1/2
$_has_user_tasks and $_task_id >= 0
$_has_user_tasks
$_task_id >= 0
Truth table66%2/3
A and B
A= $_has_user_tasksB= $_task_id >= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 347 | $self->{_task}->[$_task_id]->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ? $self->{_task}->[$_task_id]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 856 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 856 | ▶ | if ($_task_id == 0 && defined $_syn_flag && $_sync_cnt) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$_task_id == 0 and defined $_syn_flag and $_sync_cnt
$_task_id == 0 and defined $_syn_flag
MC/DC0%0/3
$_task_id == 0 and defined $_syn_flag and $_sync_cnt
$_task_id == 0
defined $_syn_flag
$_sync_cnt
Truth table50%2/4
A and B and C
A= $_task_id == 0B= defined $_syn_flagC= $_sync_cnt
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ($_sync_cnt == $_total_running) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | syswrite($_BSB_W_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | undef $_syn_flag; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 856 | ▶ | _task_end($self, $_task_id) unless $_total_running; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 856 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | OUTPUT_W_EXT.$LF => sub { # Worker has exited | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | chomp($_task_id = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=25 SCAR=64.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->{_total_exited} += 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $self->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $self->{_total_workers} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if ($_has_user_tasks && $_task_id >= 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_has_user_tasks and $_task_id >= 0
MC/DC0%0/2
$_has_user_tasks and $_task_id >= 0
$_has_user_tasks
$_task_id >= 0
Truth table0%0/3
A and B
A= $_has_user_tasksB= $_task_id >= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $self->{_task}->[$_task_id]->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $self->{_task}->[$_task_id]->{_total_workers} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | ? $self->{_task}->[$_task_id]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if ($_task_id == 0 && defined $_syn_flag && $_sync_cnt) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$_task_id == 0 and defined $_syn_flag and $_sync_cnt
$_task_id == 0 and defined $_syn_flag
MC/DC0%0/3
$_task_id == 0 and defined $_syn_flag and $_sync_cnt
$_task_id == 0
defined $_syn_flag
$_sync_cnt
Truth table0%0/4
A and B and C
A= $_task_id == 0B= defined $_syn_flagC= $_sync_cnt
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if ($_sync_cnt == $_total_running) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | syswrite($_BSB_W_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | undef $_syn_flag; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my ($_exit_msg, $_retry_buf) = ('', ''); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | chomp($_exit_wid = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | chomp($_exit_pid = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | chomp($_exit_status = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | chomp($_exit_id = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | read($_DAU_R_SOCK, $_exit_msg, $_len) if ($_len); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | read($_DAU_R_SOCK, $_retry_buf, $_len) if ($_len); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | if (abs($_exit_status) > abs($self->{_wrk_status})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $self->{_wrk_status} = $_exit_status; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | ## Reap child/thread. Note: Win32 uses negative PIDs. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | local ($!, $?); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if ($_exit_pid =~ /^PID_(-?\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $_pid = $1; my $_list = $self->{_pids}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | for my $i (0 .. @{ $_list }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($_list->[$i] && $_list->[$i] == $_pid) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_list->[$i] and $_list->[$i] == $_pid
MC/DC0%0/2
$_list->[$i] and $_list->[$i] == $_pid
$_list->[$i]
$_list->[$i] == $_pid
Truth table0%0/3
A and B
A= $_list->[$i]B= $_list->[$i] == $_pid
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | waitpid $_pid, 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->{_pids}->[$i] = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | elsif ($_exit_pid =~ /^TID_(\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $_tid = $1; my $_list = $self->{_tids}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | for my $i (0 .. @{ $_list }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if ($_list->[$i] && $_list->[$i] == $_tid) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_list->[$i] and $_list->[$i] == $_tid
MC/DC0%0/2
$_list->[$i] and $_list->[$i] == $_tid
$_list->[$i]
$_list->[$i] == $_tid
Truth table0%0/3
A and B
A= $_list->[$i]B= $_list->[$i] == $_tid
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | eval { $self->{_thrs}->[$i]->join() }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $self->{_thrs}->[$i] = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $self->{_tids}->[$i] = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ## Call on_post_exit callback if defined. Otherwise, append status | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | ## information if on_post_run is defined for later retrieval. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if (defined $_on_post_exit) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $self->{_exited_wid} = $_exit_wid; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if (length($_retry_buf)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $self->{_retry} = $self->{thaw}($_retry_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $self->{_retry_cnt} = $_max_retries - $self->{_retry}[2] - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | $_on_post_exit->($self, { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | wid => $_exit_wid, pid => $_exit_pid, status => $_exit_status, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | msg => $_exit_msg, id => $_exit_id | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | }, $self->{_retry_cnt}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | delete $self->{_retry}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | $_on_post_exit->($self, { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$_max_retries || 0
MC/DC0%0/1
$_max_retries || 0
$_max_retries
Truth table0%0/2
A
A= $_max_retries
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | wid => $_exit_wid, pid => $_exit_pid, status => $_exit_status, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | msg => $_exit_msg, id => $_exit_id | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | }, $_max_retries || 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | delete $self->{_exited_wid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | elsif (defined $_on_post_run) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | push @{ $self->{_status} }, { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | wid => $_exit_wid, pid => $_exit_pid, status => $_exit_status, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | msg => $_exit_msg, id => $_exit_id | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | _task_end($self, $_task_id) unless $_total_running; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | OUTPUT_A_REF.$LF => sub { # Input << Array ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 376 | ▶ | my $_buf; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 376 | ▶ | if ($_offset_pos >= $_input_size || $_aborted) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_offset_pos >= $_input_size or $_aborted
MC/DC50%1/2
$_offset_pos >= $_input_size or $_aborted
$_offset_pos >= $_input_size
$_aborted
Truth table66%2/3
A or B
A= $_offset_pos >= $_input_sizeB= $_aborted
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 80 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 80 | print {$_DAU_R_SOCK} '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 80 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 296 | ▶ | if ($_single_dim && $_cs_one_flag) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_single_dim and $_cs_one_flag
MC/DC50%1/2
$_single_dim and $_cs_one_flag
$_single_dim
$_cs_one_flag
Truth table66%2/3
A and B
A= $_single_dimB= $_cs_one_flag
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 229 | $_buf = $self->{freeze}( [ $_input_data->[$_offset_pos] ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 67 | ▶ | if ($_offset_pos + $_chunk_size - 1 < $_input_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 54 | $_buf = $self->{freeze}( [ @{ $_input_data }[ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | $_offset_pos .. $_offset_pos + $_chunk_size - 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | ] ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 13 | $_buf = $self->{freeze}( [ @{ $_input_data }[ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | $_offset_pos .. $_input_size - 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | ] ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 296 | ▶ | $_len = length $_buf; local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 296 | print {$_DAU_R_SOCK} $_len.$LF . (++$_chunk_id).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 296 | $_offset_pos += $_chunk_size; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 296 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | OUTPUT_G_REF.$LF => sub { # Input << Glob ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 54 | ▶ | my $_buf = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=20 SCAR=46.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | ## The logic below honors ('Ctrl/Z' in Windows, 'Ctrl/D' in Unix) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | ## when reading from standard input. No output will be lost as | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | ## far as what was previously read into the buffer. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 54 | ▶ | if ($_eof_flag || $_aborted) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_eof_flag or $_aborted
MC/DC50%1/2
$_eof_flag or $_aborted
$_eof_flag
$_aborted
Truth table66%2/3
A or B
A= $_eof_flagB= $_aborted
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 36 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 36 | print {$_DAU_R_SOCK} '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 36 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 18 | ▶ | local $/ = $_RS if ($_RS_FLG); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 18 | ▶ | if ($_chunk_size <= MAX_RECS_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | if ($_chunk_size == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | $_buf .= $_input_glob->can('getline') | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | ? $_input_glob->getline : <$_input_glob>; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | $_eof_flag = 1 unless (length $_buf); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $_last_len = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | for (1 .. $_chunk_size) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | $_buf .= $_input_glob->can('getline') | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | ? $_input_glob->getline : <$_input_glob>; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $_len = length $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | if ($_len == $_last_len) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $_eof_flag = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $_last_len = $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 18 | ▶ | if ($_input_glob->can('getline') && $_input_glob->can('read')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_input_glob->can("getline") and $_input_glob->can("read")
MC/DC0%0/2
$_input_glob->can("getline") and $_input_glob->can("read")
$_input_glob->can("getline")
$_input_glob->can("read")
Truth table33%1/3
A and B
A= $_input_glob->can("getline")B= $_input_glob->can("read")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 18 | ▶ | if ($_input_glob->read($_buf, $_chunk_size) == $_chunk_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $_buf .= $_input_glob->getline; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | $_eof_flag = 1 if (length $_buf == $_chunk_size); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 18 | $_eof_flag = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | if (read($_input_glob, $_buf, $_chunk_size) == $_chunk_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $_buf .= <$_input_glob>; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | $_eof_flag = 1 if (length $_buf == $_chunk_size); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $_eof_flag = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 18 | ▶ | $_len = length $_buf; local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 18 | ▶ | if ($_len) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 18 | my $_tmp = $self->{freeze}(\$_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 18 | print {$_DAU_R_SOCK} length($_tmp).$LF . (++$_chunk_id).$LF, $_tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | print {$_DAU_R_SOCK} '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 18 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | OUTPUT_H_REF.$LF => sub { # Input << Hash ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 18 | ▶ | my @_pairs; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 18 | ▶ | if ($_offset_pos >= $_input_size || $_aborted) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_offset_pos >= $_input_size or $_aborted
MC/DC50%1/2
$_offset_pos >= $_input_size or $_aborted
$_offset_pos >= $_input_size
$_aborted
Truth table66%2/3
A or B
A= $_offset_pos >= $_input_sizeB= $_aborted
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 3 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 3 | print {$_DAU_R_SOCK} '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 15 | ▶ | if ($_offset_pos + $_chunk_size - 1 < $_input_size) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 12 | for my $_i ($_offset_pos .. $_offset_pos + $_chunk_size - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 24 | push @_pairs, each %{ $_input_data }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 3 | for my $_i ($_offset_pos .. $_input_size - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 3 | push @_pairs, each %{ $_input_data }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 15 | my $_buf = $self->{freeze}(\@_pairs); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 15 | ▶ | $_len = length $_buf; local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 15 | print {$_DAU_R_SOCK} $_len.$LF . (++$_chunk_id).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 15 | $_offset_pos += $_chunk_size; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 15 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | OUTPUT_I_REF.$LF => sub { # Input << Iter ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | my $_buf; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | if ($_aborted) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my @_ret_a = $_input_data->($_chunk_size); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | if (@_ret_a > 1 || defined $_ret_a[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ret_a > 1 or defined $_ret_a[0]
MC/DC0%0/2
@_ret_a > 1 or defined $_ret_a[0]
@_ret_a > 1
defined $_ret_a[0]
Truth table0%0/3
A or B
A= @_ret_a > 1B= defined $_ret_a[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $_buf = $self->{freeze}([ @_ret_a ]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | $_len = length $_buf; local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | print {$_DAU_R_SOCK} $_len.$LF . (++$_chunk_id).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $_aborted = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | OUTPUT_A_CBK.$LF => sub { # Callback w/ args | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 283 | ▶ | chomp($_wa = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | chomp($_cb = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 283 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 283 | my $_aref = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 283 | undef $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 283 | return $_cb_reply->(@{ $_aref }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | OUTPUT_N_CBK.$LF => sub { # Callback w/ no args | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 2 | ▶ | chomp($_wa = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | chomp($_cb = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 2 | return $_cb_reply->(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | OUTPUT_A_GTR.$LF => sub { # Gather data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 1108 | ▶ | chomp($_task_id = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=19.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 1108 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 1108 | ▶ | if ($_is_c_ref[$_task_id]) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 579 | local $_ = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 579 | $_gather[$_task_id]->(@{ $_ }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | elsif ($_is_h_ref[$_task_id]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | local $_ = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | my $_key = shift @{ $_ }; my $_val = shift @{ $_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $_gather[$_task_id]->{$_key} = $_val; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | last unless (@{ $_ }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | elsif ($_is_q_ref[$_task_id]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 379 | $_gather[$_task_id]->enqueue(@{ $self->{thaw}($_buf) }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 150 | push @{ $_gather[$_task_id] }, @{ $self->{thaw}($_buf) }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 1108 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | OUTPUT_O_SND.$LF => sub { # Send >> STDOUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | $_buf = ${ $self->{thaw}($_buf) }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | if (defined $_user_output) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $_user_output->($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 85 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | print {$_MCE_STDOUT} $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | OUTPUT_E_SND.$LF => sub { # Send >> STDERR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | $_buf = ${ $self->{thaw}($_buf) }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if (defined $_user_error) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | $_user_error->($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 85 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | print {$_MCE_STDERR} $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | OUTPUT_F_SND.$LF => sub { # Send >> File | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | my ($_buf, $_OUT_FILE); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=31.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | read $_DAU_R_SOCK, $_buf, $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $_buf = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $_file = $_buf->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | unless (exists $_sendto_fhs{$_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | open $_sendto_fhs{$_file}, ">>", "$_file" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | or _croak "Cannot open file for writing ($_file): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | binmode $_sendto_fhs{$_file}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | if (!exists $self->{flush_file} || $self->{flush_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not exists $self->{"flush_file"} or $self->{"flush_file"}
MC/DC0%0/2
not exists $self->{"flush_file"} or $self->{"flush_file"}
not exists $self->{"flush_file"}
$self->{"flush_file"}
Truth table0%0/3
not(A) or B
A= not exists $self->{"flush_file"}B= $self->{"flush_file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | local $!; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $_sendto_fhs{$_file}->autoflush(1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 85 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | $_OUT_FILE = $_sendto_fhs{$_file}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | print {$_OUT_FILE} $_buf->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | OUTPUT_D_SND.$LF => sub { # Send >> File descriptor | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | my ($_buf, $_OUT_FILE); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=3.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | read $_DAU_R_SOCK, $_buf, $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $_buf = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 85 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | $_OUT_FILE = _sendto_fhs_get($self, $_buf->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | print {$_OUT_FILE} $_buf->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | OUTPUT_B_SYN.$LF => sub { # Barrier sync - begin | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | if (!defined $_sync_cnt || $_sync_cnt == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
Branch: 1 branch
Condition0%0/3
not defined $_sync_cnt or $_sync_cnt == 0
MC/DC0%0/2
not defined $_sync_cnt or $_sync_cnt == 0
not defined $_sync_cnt
$_sync_cnt == 0
Truth table0%0/3
not(A) or B
A= not defined $_sync_cntB= $_sync_cnt == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $_syn_flag = 1, $_sync_cnt = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | ? $self->{_task}->[0]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | if (++$_sync_cnt == $_total_running) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | syswrite($_BSB_W_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | undef $_syn_flag; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | OUTPUT_E_SYN.$LF => sub { # Barrier sync - end | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | if (--$_sync_cnt == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | ? $self->{_task}->[0]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | syswrite($_BSB_R_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | OUTPUT_S_IPC.$LF => sub { # Change to win32 IPC | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | ▶ | syswrite($_DAT_R_SOCK, $LF); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | $_win32_ipc = 1, goto _LOOP unless $_win32_ipc; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | OUTPUT_C_NFY.$LF => sub { # Chunk ID notification | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | my ($_pid, $_chunk_id) = split /:/, $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | $self->{_pids_c}{$_pid} = $_chunk_id; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | OUTPUT_P_NFY.$LF => sub { # Progress notification | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | $self->{progress}->( $_size_completed += $_len ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | OUTPUT_S_DIR.$LF => sub { # Make/get sess_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | ▶ | print {$_DAU_R_SOCK} $self->sess_dir().$LF; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | OUTPUT_T_DIR.$LF => sub { # Make/get tmp_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | print {$_DAU_R_SOCK} $self->tmp_dir().$LF; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | OUTPUT_I_DLY.$LF => sub { # Interval delay | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | my $_tasks = $_has_user_tasks ? $self->{user_tasks} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=15 SCAR=54.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | chomp($_task_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | my $_interval = ($_tasks && exists $_tasks->[$_task_id]{interval}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | ? $_tasks->[$_task_id]{interval} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | : $self->{interval}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_tasks and exists $_tasks->[$_task_id]{"interval"}
MC/DC0%0/2
$_tasks and exists $_tasks->[$_task_id]{"interval"}
$_tasks
exists $_tasks->[$_task_id]{"interval"}
Truth table0%0/3
A and B
A= $_tasksB= exists $_tasks->[$_task_id]{"interval"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | if (!$_interval) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | print {$_DAU_R_SOCK} '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | elsif ($_interval->{max_nodes} == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | my $_delay = $_interval->{delay}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | my $_lapse = $_interval->{_lapse}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | my $_time = MCE::Util::_time(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | if (!$_delay || !defined $_lapse) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$_delay && defined $_lapse
MC/DC0%0/2
$_delay && defined $_lapse
$_delay
defined $_lapse
Truth table0%0/3
A && B
A= $_delayB= defined $_lapse
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $_lapse = $_time; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | elsif ($_lapse + $_delay - $_time < 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | $_lapse += int( abs($_time - $_lapse) / $_delay + 0.5 ) * $_delay; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | $_interval->{_lapse} = ($_lapse += $_delay); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | print {$_DAU_R_SOCK} ($_lapse - $_time).$LF | |||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | my $_max_workers = ($_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | ? $_tasks->[$_task_id]{max_workers} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | : $self->{max_workers}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | if (++$_delay_wid[$_task_id] > $_max_workers) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | $_delay_wid[$_task_id] = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | my $_nodes = $_interval->{max_nodes}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | my $_id = $_interval->{node_id}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | my $_delay = $_interval->{delay} * $_nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | my $_app_tb = $_delay * $_max_workers; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | my $_app_st = $_interval->{_time} + ($_delay / $_nodes * $_id); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | my $_wrk_st = ($_delay_wid[$_task_id] - 1) * $_delay + $_app_st; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $_delay = $_wrk_st - MCE::Util::_time(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | ▶ | if ($_delay < 0.0 && $_app_tb) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_delay < 0 and $_app_tb
MC/DC0%0/2
$_delay < 0 and $_app_tb
$_delay < 0
$_app_tb
Truth table0%0/3
A and B
A= $_delay < 0B= $_app_tb
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | my $_count = int($_delay * -1 / $_app_tb + 0.5) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $_delay += $_app_tb * $_count; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | $_interval->{_time} = MCE::Util::_time() if ($_count > 2e9); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | ($_delay > 0.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | ? print {$_DAU_R_SOCK} $_delay.$LF | |||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | ▶ | : print {$_DAU_R_SOCK} '0'.$LF; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 142 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 142 | local ($!, $?, $_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 142 | $_aborted = $_chunk_id = $_eof_flag = $_size_completed = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 142 | ▶ | $_has_user_tasks = (defined $self->{user_tasks}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 142 | ▶ | $_cs_one_flag = ($self->{chunk_size} == 1) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 142 | $_max_retries = $self->{max_retries}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 142 | $_on_post_exit = $self->{on_post_exit}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 142 | $_on_post_run = $self->{on_post_run}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 142 | $_chunk_size = $self->{chunk_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 142 | $_user_output = $self->{user_output}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 142 | $_user_error = $self->{user_error}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 142 | $_single_dim = $self->{_single_dim}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 142 | $_sess_dir = $self->{_sess_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 142 | ▶ | if (defined $_max_retries && !$_on_post_exit) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $_max_retries and not $_on_post_exit
MC/DC0%0/2
defined $_max_retries and not $_on_post_exit
defined $_max_retries
not $_on_post_exit
Truth table33%1/3
A and not(B)
A= defined $_max_retriesB= not $_on_post_exit
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | $_on_post_exit = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | my ($self, $_e, $_retry_cnt) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | ▶ | if ($_e->{id}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | my $_cnt = $_retry_cnt + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | my $_msg = "Error: chunk $_e->{id} failed"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | if (defined $self->{init_relay}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | ▶ | print {*STDERR} "$_msg, retrying chunk attempt # $_cnt\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | if ($_retry_cnt < $_max_retries); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | ($_retry_cnt < $_max_retries) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | ? print {*STDERR} "$_msg, retrying chunk attempt # $_cnt\n" | |||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | : print {*STDERR} "$_msg\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $self->restart_worker; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 142 | ▶ | if ($_has_user_tasks && $self->{user_tasks}->[0]->{chunk_size}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_has_user_tasks and $self->{"user_tasks"}[0]{"chunk_size"}
MC/DC0%0/2
$_has_user_tasks and $self->{"user_tasks"}[0]{"chunk_size"}
$_has_user_tasks
$self->{"user_tasks"}[0]{"chunk_size"}
Truth table66%2/3
A and B
A= $_has_user_tasksB= $self->{"user_tasks"}[0]{"chunk_size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | $_chunk_size = $self->{user_tasks}->[0]->{chunk_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 142 | ▶ | if ($_has_user_tasks) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 108 | for my $_i (0 .. @{ $self->{user_tasks} } - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | $_gather[$_i] = (defined $self->{user_tasks}->[$_i]->{gather}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 180 | ▶ | ? $self->{user_tasks}->[$_i]->{gather} : $self->{gather}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 180 | ▶ | $_is_c_ref[$_i] = ( ref $_gather[$_i] eq 'CODE' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 180 | ▶ | $_is_h_ref[$_i] = ( ref $_gather[$_i] eq 'HASH' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 180 | ▶ | $_is_q_ref[$_i] = ( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $_gather[$_i] eq "MCE::Queue" or ref $_gather[$_i] eq "Thread::Queue"
MC/DC50%1/2
ref $_gather[$_i] eq "MCE::Queue" or ref $_gather[$_i] eq "Thread::Queue"
ref $_gather[$_i] eq "MCE::Queue"
ref $_gather[$_i] eq "Thread::Queue"
Truth table66%2/3
A or B
A= ref $_gather[$_i] eq "MCE::Queue"B= ref $_gather[$_i] eq "Thread::Queue"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | ref $_gather[$_i] eq 'MCE::Queue' || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | ref $_gather[$_i] eq 'Thread::Queue' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 142 | ▶ | if (defined $self->{gather}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 62 | $_gather[0] = $self->{gather}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 62 | ▶ | $_is_c_ref[0] = ( ref $_gather[0] eq 'CODE' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 62 | ▶ | $_is_h_ref[0] = ( ref $_gather[0] eq 'HASH' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 62 | ▶ | $_is_q_ref[0] = ( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $_gather[0] eq "MCE::Queue" or ref $_gather[0] eq "Thread::Queue"
MC/DC0%0/2
ref $_gather[0] eq "MCE::Queue" or ref $_gather[0] eq "Thread::Queue"
ref $_gather[0] eq "MCE::Queue"
ref $_gather[0] eq "Thread::Queue"
Truth table33%1/3
A or B
A= ref $_gather[0] eq "MCE::Queue"B= ref $_gather[0] eq "Thread::Queue"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | ref $_gather[0] eq 'MCE::Queue' || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | ref $_gather[0] eq 'Thread::Queue' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 142 | ▶ | if (defined $_input_data && ref $_input_data eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
defined $_input_data and ref $_input_data eq "ARRAY"
MC/DC100%2/2
defined $_input_data and ref $_input_data eq "ARRAY"
defined $_input_data
ref $_input_data eq "ARRAY"
Truth table100%3/3
A and B
A= defined $_input_dataB= ref $_input_data eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 40 | $_input_size = @{ $_input_data }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 40 | $_offset_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | ▶ | elsif (defined $_input_data && ref $_input_data eq 'HASH') { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $_input_data and ref $_input_data eq "HASH"
MC/DC50%1/2
defined $_input_data and ref $_input_data eq "HASH"
defined $_input_data
ref $_input_data eq "HASH"
Truth table66%2/3
A and B
A= defined $_input_dataB= ref $_input_data eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 3 | $_input_size = scalar( keys %{ $_input_data } ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 3 | $_offset_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 99 | $_input_size = $_offset_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | ## Set STDOUT/STDERR to user parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 142 | ▶ | if (defined $self->{stdout_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | open $_MCE_STDOUT, '>>', $self->{stdout_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | or die $self->{stdout_file} . ": $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | binmode $_MCE_STDOUT; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 142 | $_MCE_STDOUT = \*STDOUT; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 142 | ▶ | if (defined $self->{stderr_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | open $_MCE_STDERR, '>>', $self->{stderr_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | or die $self->{stderr_file} . ": $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | binmode $_MCE_STDERR; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 142 | $_MCE_STDERR = \*STDERR; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | ## Autoflush STDERR-STDOUT handles if not specified or requested. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 142 | local $!; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | $_MCE_STDERR->autoflush(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 142 | ▶ | if ( !exists $self->{flush_stderr} || $self->{flush_stderr} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not exists $self->{"flush_stderr"} or $self->{"flush_stderr"}
MC/DC0%0/2
not exists $self->{"flush_stderr"} or $self->{"flush_stderr"}
not exists $self->{"flush_stderr"}
$self->{"flush_stderr"}
Truth table33%1/3
not(A) or B
A= not exists $self->{"flush_stderr"}B= $self->{"flush_stderr"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | $_MCE_STDOUT->autoflush(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 142 | ▶ | if ( !exists $self->{flush_stdout} || $self->{flush_stdout} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not exists $self->{"flush_stdout"} or $self->{"flush_stdout"}
MC/DC0%0/2
not exists $self->{"flush_stdout"} or $self->{"flush_stdout"}
not exists $self->{"flush_stdout"}
$self->{"flush_stdout"}
Truth table33%1/3
not(A) or B
A= not exists $self->{"flush_stdout"}B= $self->{"flush_stdout"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | ## Output event loop. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 142 | my $_channels = $self->{_dat_r_sock}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 142 | my $_func; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | $_win32_ipc = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | $ENV{'PERL_MCE_IPC'} eq 'win32' || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | defined($self->{max_retries}) || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | $INC{'MCE/Child.pm'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 142 | ▶ | $INC{'MCE/Hobo.pm'} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$ENV{'PERL_MCE_IPC'} eq 'win32' || defined $self->{'max_retries'} || $INC{'MCE/Child.pm'} || $INC{'MCE/Hobo.pm'}
$ENV{"PERL_MCE_IPC"} eq "win32" or defined $self->{"max_retries"} or $INC{"MCE/Child.pm"}
$ENV{"PERL_MCE_IPC"} eq "win32" or defined $self->{"max_retries"}
MC/DC0%0/4
$ENV{'PERL_MCE_IPC'} eq 'win32' || defined $self->{'max_retries'} || $INC{'MCE/Child.pm'} || $INC{'MCE/Hobo.pm'}
$ENV{"PERL_MCE_IPC"} eq "win32"
defined $self->{"max_retries"}
$INC{"MCE/Child.pm"}
$INC{'MCE/Hobo.pm'}
Truth table20%1/5
A or B or C || D
A= $ENV{"PERL_MCE_IPC"} eq "win32"B= defined $self->{"max_retries"}C= $INC{"MCE/Child.pm"}D= $INC{'MCE/Hobo.pm'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 142 | $_BSB_W_SOCK = $self->{_bsb_w_sock}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 142 | $_BSB_R_SOCK = $self->{_bsb_r_sock}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 142 | $_DAT_R_SOCK = $self->{_dat_r_sock}->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 142 | ▶ | $_RS = $self->{RS} || $/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'RS'} || $/
MC/DC0%0/2
$self->{'RS'} || $/
$self->{'RS'}
$/
Truth table33%1/3
A || B
A= $self->{'RS'}B= $/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 142 | $_O_SEP = $\; local $\ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 142 | $_I_SEP = $/; local $/ = $LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 142 | ▶ | $_RS_FLG = (!$_RS || $_RS ne $LF) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $_RS or $_RS ne $MCE::LF
MC/DC0%0/2
not $_RS or $_RS ne $MCE::LF
not $_RS
$_RS ne $MCE::LF
Truth table33%1/3
not(A) or B
A= not $_RSB= $_RS ne $MCE::LF
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 142 | ▶ | $_O_FLG = (defined $_O_SEP) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 142 | ▶ | $_I_FLG = (!$_I_SEP || $_I_SEP ne $LF) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $_I_SEP or $_I_SEP ne $MCE::LF
MC/DC0%0/2
not $_I_SEP or $_I_SEP ne $MCE::LF
not $_I_SEP
$_I_SEP ne $MCE::LF
Truth table33%1/3
not(A) or B
A= not $_I_SEPB= $_I_SEP ne $MCE::LF
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | ## Call module's loop_begin routine for modules plugged into MCE. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 142 | for my $_p (@{ $_plugin_loop_begin }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 103 | $_p->($self, \$_DAU_R_SOCK); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | ## Wait on requests *with* timeout capability. Exit loop when all workers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | ## have completed processing or exited prematurely. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | _LOOP: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 142 | ▶ | if ($self->{loop_timeout} && @{ $self->{_tids} } == 0 && $^O ne 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$self->{"loop_timeout"} and @{$self->{"_tids"};} == 0 and $^O ne "MSWin32"
$self->{"loop_timeout"} and @{$self->{"_tids"};} == 0
MC/DC0%0/3
$self->{"loop_timeout"} and @{$self->{"_tids"};} == 0 and $^O ne "MSWin32"
$self->{"loop_timeout"}
@{$self->{"_tids"};} == 0
$^O ne "MSWin32"
Truth table25%1/4
A and B and C
A= $self->{"loop_timeout"}B= @{$self->{"_tids"};} == 0C= $^O ne "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | my ($_list, $_timeout) = ($self->{_pids}, $self->{loop_timeout}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | my ($_DAT_W_SOCK, $_pid) = ($self->{_dat_w_sock}->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | $self->{_pids_c} = {}; # Chunk ID notification | |||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | $_timeout = 5 if $_timeout < 5; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | local $SIG{ALRM} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | alarm 0; local ($!, $?); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=18 SCAR=58.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | for my $i (0 .. @{ $_list }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | ▶ | if ($_pid = $_list->[$i]) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | ▶ | if (waitpid($_pid, _WNOHANG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | $_list->[$i] = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | ▶ | if ($? > abs($self->{_wrk_status})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | $self->{_wrk_status} = $?; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | my $_task_id = $self->{_pids_t}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | my $_wid = $self->{_pids_w}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | $self->{_total_exited} += 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | $self->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | $self->{_total_workers} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | ▶ | if ($_has_user_tasks && $_task_id >= 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_has_user_tasks and $_task_id >= 0
MC/DC0%0/2
$_has_user_tasks and $_task_id >= 0
$_has_user_tasks
$_task_id >= 0
Truth table0%0/3
A and B
A= $_has_user_tasksB= $_task_id >= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | $self->{_task}->[$_task_id]->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | $self->{_task}->[$_task_id]->{_total_workers} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | ? $self->{_task}->[$_task_id]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | if ($_task_id == 0 && defined $_syn_flag && $_sync_cnt) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$_task_id == 0 and defined $_syn_flag and $_sync_cnt
$_task_id == 0 and defined $_syn_flag
MC/DC0%0/3
$_task_id == 0 and defined $_syn_flag and $_sync_cnt
$_task_id == 0
defined $_syn_flag
$_sync_cnt
Truth table0%0/4
A and B and C
A= $_task_id == 0B= defined $_syn_flagC= $_sync_cnt
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | ▶ | if ($_sync_cnt == $_total_running) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | syswrite($_BSB_W_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | undef $_syn_flag; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | ▶ | _task_end($self, $_task_id) unless $_total_running; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | if (my $_cid = $self->{_pids_c}{$_pid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | warn "Error: process $_pid has ended prematurely\n", | |||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | "Error: chunk $_cid failed\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | if ($_cid > $self->{_relayed}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | local $SIG{CHLD} = 'IGNORE'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | my $_pid = fork; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | ▶ | if (defined $_pid && $_pid == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_pid and $_pid == 0
MC/DC0%0/2
defined $_pid and $_pid == 0
defined $_pid
$_pid == 0
Truth table0%0/3
A and B
A= defined $_pidB= $_pid == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | delete $self->{max_retries}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | $self->{_chunk_id} = $_cid; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | $self->{_task_id} = $_task_id; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | $self->{_wid} = $_wid; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | eval 'MCE::relay'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | CORE::kill('KILL', $$); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | CORE::exit(0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | delete $self->{_pids_c}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | delete $self->{_pids_t}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | delete $self->{_pids_w}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | print {$_DAT_W_SOCK} 'NOOP'.$LF . '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | while ( $self->{_total_running} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | alarm($_timeout); $_func = <$_DAT_R_SOCK>, alarm(0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | $_DAU_R_SOCK = $_channels->[ <$_DAT_R_SOCK> ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | ▶ | if (exists $_core_output_function{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | $_core_output_function{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } elsif (exists $_plugin_function->{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | $_plugin_function->{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | delete $self->{_pids_c}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | ## Wait on requests *without* timeout capability. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | elsif ($^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | ▶ | MCE::Util::_nonblocking($_DAT_R_SOCK, 1) if $_win32_ipc; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | ▶ | while ($self->{_total_running}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | MCE::Util::_sysread2($_DAT_R_SOCK, $_func, 8); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | ▶ | last() unless length($_func) == 8; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | $_DAU_R_SOCK = $_channels->[ substr($_func, -2, 2, '') ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | ▶ | if (exists $_core_output_function{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | $_core_output_function{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | } elsif (exists $_plugin_function->{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | $_plugin_function->{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | ▶ | MCE::Util::_nonblocking($_DAT_R_SOCK, 0) if $_win32_ipc; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 142 | ▶ | while ($self->{_total_running}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 3751 | $_func = <$_DAT_R_SOCK>; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 3751 | ▶ | last() unless length($_func) == 6; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 3751 | $_DAU_R_SOCK = $_channels->[ <$_DAT_R_SOCK> ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 3751 | ▶ | if (exists $_core_output_function{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 2269 | $_core_output_function{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | } elsif (exists $_plugin_function->{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 1482 | $_plugin_function->{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | ## Call module's loop_end routine for modules plugged into MCE. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 142 | for my $_p (@{ $_plugin_loop_end }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 103 | $_p->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | ## Call on_post_run callback. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 142 | ▶ | $_on_post_run->($self, $self->{_status}) if (defined $_on_post_run); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | ## Close opened sendto file handles. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 142 | _sendto_fhs_close(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | ## Close MCE STDOUT/STDERR handles. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 142 | eval q{ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | close $_MCE_STDOUT if (fileno $_MCE_STDOUT > 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | close $_MCE_STDERR if (fileno $_MCE_STDERR > 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 142 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 85 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||