| 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 | 94 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 94 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 94 | our $VERSION = '1.904'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 94 | ▶ | 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 | 94 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 94 | ▶ | _WNOHANG => ( $INC{'POSIX.pm'} ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ? &POSIX::WNOHANG : ( $^O eq 'solaris' ) ? 64 : 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 94 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ## ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ## Call on task_end after task completion. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 220 | ▶ | sub _task_end { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_task_end: called CC=6 SCAR=18.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 220 | my ($self, $_task_id) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 220 | @_ = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 220 | ▶ | 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 | 181 | ▶ | : $self->{task_end}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 181 | ▶ | 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 | 220 | 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 | 94 | my %_sendto_fhs; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 536 | ▶ | sub _sendto_fhs_close { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sendto_fhs_close: called CC=2 SCAR=11.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 536 | for my $_p (keys %_sendto_fhs) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | close $_sendto_fhs{$_p}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | delete $_sendto_fhs{$_p}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub _sendto_fhs_get { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sendto_fhs_get: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my ($self, $_fd) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 148 | ▶ | sub _output_loop { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_output_loop: called CC=61 SCAR=69.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 148 | my ( $self, $_input_data, $_input_glob, $_plugin_function, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | $_plugin_loop_begin, $_plugin_loop_end ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 148 | @_ = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 148 | $_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 | 285 | ▶ | my $_cb_reply = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 285 | ▶ | local $\ = $_O_SEP if ($_O_FLG); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 285 | ▶ | local $/ = $_I_SEP if ($_I_FLG); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 94 | ▶ | 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 | 148 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ## Create hash structure containing various output functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | my %_core_output_function = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | OUTPUT_W_ABT.$LF => sub { # Worker has aborted | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $_aborted = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 452 | ▶ | OUTPUT_W_DNE.$LF => sub { # Worker has completed | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=26.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 452 | chomp($_task_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 452 | $self->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 452 | ▶ | 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 | 351 | $self->{_task}->[$_task_id]->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ? $self->{_task}->[$_task_id]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 452 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 452 | ▶ | 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 | 452 | ▶ | _task_end($self, $_task_id) unless $_total_running; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 452 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | OUTPUT_W_EXT.$LF => sub { # Worker has exited | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=25 SCAR=64.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | chomp($_task_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 416 | ▶ | OUTPUT_A_REF.$LF => sub { # Input << Array ref | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 416 | my $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 416 | ▶ | 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 | 100 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 100 | print {$_DAU_R_SOCK} '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 100 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 316 | ▶ | 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 | 249 | $_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 | 316 | ▶ | $_len = length $_buf; local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 316 | print {$_DAU_R_SOCK} $_len.$LF . (++$_chunk_id).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 316 | $_offset_pos += $_chunk_size; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 316 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 54 | ▶ | OUTPUT_G_REF.$LF => sub { # Input << Glob ref | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=20 SCAR=46.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 54 | my $_buf = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 18 | ▶ | OUTPUT_H_REF.$LF => sub { # Input << Hash ref | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 18 | my @_pairs; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 0 | ▶ | OUTPUT_I_REF.$LF => sub { # Input << Iter ref | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 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 = (ref $_input_data eq 'CODE') | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | ? $_input_data->($_chunk_size) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | : $_input_data->(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 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]
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $_buf = $self->{freeze}([ @_ret_a ]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | $_len = length $_buf; local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | print {$_DAU_R_SOCK} $_len.$LF . (++$_chunk_id).$LF, $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | local $\ = undef if (defined $\); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | print {$_DAU_R_SOCK} '-1'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $_aborted = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 283 | ▶ | OUTPUT_A_CBK.$LF => sub { # Callback w/ args | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 283 | chomp($_wa = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | chomp($_cb = <$_DAU_R_SOCK>), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 283 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 283 | my $_aref = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 283 | undef $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 283 | return $_cb_reply->(@{ $_aref }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 2 | ▶ | OUTPUT_N_CBK.$LF => sub { # Callback w/ no args | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 2 | chomp($_wa = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | chomp($_cb = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | return $_cb_reply->(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 1132 | ▶ | OUTPUT_A_GTR.$LF => sub { # Gather data | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=19.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 1132 | chomp($_task_id = <$_DAU_R_SOCK>), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | chomp($_len = <$_DAU_R_SOCK>); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 1132 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 1132 | ▶ | if ($_is_c_ref[$_task_id]) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 603 | local $_ = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 603 | $_gather[$_task_id]->(@{ $_ }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | elsif ($_is_h_ref[$_task_id]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | local $_ = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my $_key = shift @{ $_ }; my $_val = shift @{ $_ }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | $_gather[$_task_id]->{$_key} = $_val; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | last unless (@{ $_ }); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | elsif ($_is_q_ref[$_task_id]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 379 | $_gather[$_task_id]->enqueue(@{ $self->{thaw}($_buf) }); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 150 | push @{ $_gather[$_task_id] }, @{ $self->{thaw}($_buf) }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 1132 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | OUTPUT_O_SND.$LF => sub { # Send >> STDOUT | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | $_buf = ${ $self->{thaw}($_buf) }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | if (defined $_user_output) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | $_user_output->($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 94 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | print {$_MCE_STDOUT} $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | OUTPUT_E_SND.$LF => sub { # Send >> STDERR | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | read $_DAU_R_SOCK, my($_buf), $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | $_buf = ${ $self->{thaw}($_buf) }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | if (defined $_user_error) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $_user_error->($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 94 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | print {$_MCE_STDERR} $_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | OUTPUT_F_SND.$LF => sub { # Send >> File | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=31.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | my ($_buf, $_OUT_FILE); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | read $_DAU_R_SOCK, $_buf, $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $_buf = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $_file = $_buf->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | unless (exists $_sendto_fhs{$_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | open $_sendto_fhs{$_file}, ">>", "$_file" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | or _croak "Cannot open file for writing ($_file): $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | binmode $_sendto_fhs{$_file}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | local $!; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | $_sendto_fhs{$_file}->autoflush(1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | $_OUT_FILE = $_sendto_fhs{$_file}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | print {$_OUT_FILE} $_buf->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | OUTPUT_D_SND.$LF => sub { # Send >> File descriptor | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=3.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my ($_buf, $_OUT_FILE); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | read $_DAU_R_SOCK, $_buf, $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | $_buf = $self->{thaw}($_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | $_OUT_FILE = _sendto_fhs_get($self, $_buf->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | print {$_OUT_FILE} $_buf->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | ## ---------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | OUTPUT_B_SYN.$LF => sub { # Barrier sync - begin | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | if (!defined $_sync_cnt || $_sync_cnt == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | $_syn_flag = 1, $_sync_cnt = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | ? $self->{_task}->[0]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | if (++$_sync_cnt == $_total_running) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | syswrite($_BSB_W_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | undef $_syn_flag; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | OUTPUT_E_SYN.$LF => sub { # Barrier sync - end | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | if (--$_sync_cnt == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | ? $self->{_task}->[0]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | syswrite($_BSB_R_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | OUTPUT_S_IPC.$LF => sub { # Change to win32 IPC | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | syswrite($_DAT_R_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ▶ | $_win32_ipc = 1, goto _LOOP unless $_win32_ipc; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | OUTPUT_C_NFY.$LF => sub { # Chunk ID notification | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | my ($_pid, $_chunk_id) = split /:/, $_len; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | $self->{_pids_c}{$_pid} = $_chunk_id; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | ▶ | OUTPUT_P_NFY.$LF => sub { # Progress notification | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | chomp($_len = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | $self->{progress}->( $_size_completed += $_len ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | OUTPUT_S_DIR.$LF => sub { # Make/get sess_dir | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | print {$_DAU_R_SOCK} $self->sess_dir().$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | OUTPUT_T_DIR.$LF => sub { # Make/get tmp_dir | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | print {$_DAU_R_SOCK} $self->tmp_dir().$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | ▶ | OUTPUT_I_DLY.$LF => sub { # Interval delay | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=15 SCAR=54.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | my $_tasks = $_has_user_tasks ? $self->{user_tasks} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | chomp($_task_id = <$_DAU_R_SOCK>); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | my $_interval = ($_tasks && exists $_tasks->[$_task_id]{interval}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | ? $_tasks->[$_task_id]{interval} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | if (!$_interval) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | print {$_DAU_R_SOCK} '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | elsif ($_interval->{max_nodes} == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | my $_delay = $_interval->{delay}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | my $_lapse = $_interval->{_lapse}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | my $_time = MCE::Util::_time(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | $_lapse = $_time; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | elsif ($_lapse + $_delay - $_time < 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | $_lapse += int( abs($_time - $_lapse) / $_delay + 0.5 ) * $_delay; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | $_interval->{_lapse} = ($_lapse += $_delay); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | print {$_DAU_R_SOCK} ($_lapse - $_time).$LF | |||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | my $_max_workers = ($_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | ? $_tasks->[$_task_id]{max_workers} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | : $self->{max_workers}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | if (++$_delay_wid[$_task_id] > $_max_workers) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | $_delay_wid[$_task_id] = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | my $_nodes = $_interval->{max_nodes}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | my $_id = $_interval->{node_id}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | my $_delay = $_interval->{delay} * $_nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | my $_app_tb = $_delay * $_max_workers; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | my $_app_st = $_interval->{_time} + ($_delay / $_nodes * $_id); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | my $_wrk_st = ($_delay_wid[$_task_id] - 1) * $_delay + $_app_st; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | $_delay = $_wrk_st - MCE::Util::_time(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | my $_count = int($_delay * -1 / $_app_tb + 0.5) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | $_delay += $_app_tb * $_count; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | $_interval->{_time} = MCE::Util::_time() if ($_count > 2e9); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | ($_delay > 0.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ? print {$_DAU_R_SOCK} $_delay.$LF | |||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | : print {$_DAU_R_SOCK} '0'.$LF; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 148 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 148 | local ($!, $?, $_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 148 | $_aborted = $_chunk_id = $_eof_flag = $_size_completed = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 148 | ▶ | $_has_user_tasks = (defined $self->{user_tasks}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 148 | ▶ | $_cs_one_flag = ($self->{chunk_size} == 1) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 148 | $_max_retries = $self->{max_retries}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 148 | $_on_post_exit = $self->{on_post_exit}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 148 | $_on_post_run = $self->{on_post_run}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 148 | $_chunk_size = $self->{chunk_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 148 | $_user_output = $self->{user_output}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 148 | $_user_error = $self->{user_error}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 148 | $_single_dim = $self->{_single_dim}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 148 | $_sess_dir = $self->{_sess_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 148 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | ▶ | $_on_post_exit = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my ($self, $_e, $_retry_cnt) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | ▶ | if ($_e->{id}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | my $_cnt = $_retry_cnt + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | my $_msg = "Error: chunk $_e->{id} failed"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | if (defined $self->{init_relay}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | print {*STDERR} "$_msg, retrying chunk attempt # $_cnt\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | if ($_retry_cnt < $_max_retries); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | ($_retry_cnt < $_max_retries) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | ? print {*STDERR} "$_msg, retrying chunk attempt # $_cnt\n" | |||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | ▶ | : print {*STDERR} "$_msg\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | $self->restart_worker; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 148 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | $_chunk_size = $self->{user_tasks}->[0]->{chunk_size}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 148 | ▶ | if ($_has_user_tasks) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 109 | for my $_i (0 .. @{ $self->{user_tasks} } - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | $_gather[$_i] = (defined $self->{user_tasks}->[$_i]->{gather}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 181 | ▶ | ? $self->{user_tasks}->[$_i]->{gather} : $self->{gather}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 181 | ▶ | $_is_c_ref[$_i] = ( ref $_gather[$_i] eq 'CODE' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 181 | ▶ | $_is_h_ref[$_i] = ( ref $_gather[$_i] eq 'HASH' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 181 | ▶ | $_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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | ref $_gather[$_i] eq 'MCE::Queue' || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | ref $_gather[$_i] eq 'Thread::Queue' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 148 | ▶ | if (defined $self->{gather}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 68 | $_gather[0] = $self->{gather}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 68 | ▶ | $_is_c_ref[0] = ( ref $_gather[0] eq 'CODE' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 68 | ▶ | $_is_h_ref[0] = ( ref $_gather[0] eq 'HASH' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 68 | ▶ | $_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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | ref $_gather[0] eq 'MCE::Queue' || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | ref $_gather[0] eq 'Thread::Queue' ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 148 | ▶ | 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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 45 | $_input_size = @{ $_input_data }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 45 | $_offset_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | ▶ | 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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 3 | $_input_size = scalar( keys %{ $_input_data } ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 3 | $_offset_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 100 | $_input_size = $_offset_pos = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | ## Set STDOUT/STDERR to user parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 148 | ▶ | if (defined $self->{stdout_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | open $_MCE_STDOUT, '>>', $self->{stdout_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | or die $self->{stdout_file} . ": $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | binmode $_MCE_STDOUT; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 148 | $_MCE_STDOUT = \*STDOUT; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 148 | ▶ | if (defined $self->{stderr_file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | open $_MCE_STDERR, '>>', $self->{stderr_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | or die $self->{stderr_file} . ": $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | binmode $_MCE_STDERR; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 148 | $_MCE_STDERR = \*STDERR; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | ## Autoflush STDERR-STDOUT handles if not specified or requested. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 148 | local $!; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | $_MCE_STDERR->autoflush(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 148 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | $_MCE_STDOUT->autoflush(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 148 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | ## ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | ## Output event loop. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 148 | my $_channels = $self->{_dat_r_sock}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 148 | my $_func; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | $_win32_ipc = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | $ENV{'PERL_MCE_IPC'} eq 'win32' || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | defined($self->{max_retries}) || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | $INC{'MCE/Child.pm'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 148 | ▶ | $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'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 148 | $_BSB_W_SOCK = $self->{_bsb_w_sock}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 148 | $_BSB_R_SOCK = $self->{_bsb_r_sock}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 148 | $_DAT_R_SOCK = $self->{_dat_r_sock}->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 148 | ▶ | $_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= $/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 148 | $_O_SEP = $\; local $\ = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 148 | $_I_SEP = $/; local $/ = $LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 148 | ▶ | $_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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 148 | ▶ | $_O_FLG = (defined $_O_SEP) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 148 | ▶ | $_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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | ## Call module's loop_begin routine for modules plugged into MCE. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 148 | for my $_p (@{ $_plugin_loop_begin }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 103 | $_p->($self, \$_DAU_R_SOCK); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | ## Wait on requests *with* timeout capability. Exit loop when all workers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | ## have completed processing or exited prematurely. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | _LOOP: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | ▶ | 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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | my ($_list, $_timeout) = ($self->{_pids}, $self->{loop_timeout}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | my ($_DAT_W_SOCK, $_pid) = ($self->{_dat_w_sock}->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | $self->{_pids_c} = {}; # Chunk ID notification | |||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | ▶ | $_timeout = 5 if $_timeout < 5; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | local $SIG{ALRM} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=18 SCAR=58.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | alarm 0; local ($!, $?); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | for my $i (0 .. @{ $_list }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | if ($_pid = $_list->[$i]) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | ▶ | if (waitpid($_pid, _WNOHANG)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | $_list->[$i] = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | if ($? > abs($self->{_wrk_status})) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | $self->{_wrk_status} = $?; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | my $_task_id = $self->{_pids_t}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | my $_wid = $self->{_pids_w}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | $self->{_total_exited} += 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | $self->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | $self->{_total_workers} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $self->{_task}->[$_task_id]->{_total_running} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | $self->{_task}->[$_task_id]->{_total_workers} -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | my $_total_running = ($_has_user_tasks) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | ? $self->{_task}->[$_task_id]->{_total_running} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | : $self->{_total_running}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | ▶ | if ($_sync_cnt == $_total_running) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | for my $_i (1 .. $_total_running) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | syswrite($_BSB_W_SOCK, $LF); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | undef $_syn_flag; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | _task_end($self, $_task_id) unless $_total_running; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | if (my $_cid = $self->{_pids_c}{$_pid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | warn "Error: process $_pid has ended prematurely\n", | |||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | "Error: chunk $_cid failed\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | if ($_cid > $self->{_relayed}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | local $SIG{CHLD} = 'IGNORE'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | my $_pid = fork; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | delete $self->{max_retries}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | $self->{_chunk_id} = $_cid; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | $self->{_task_id} = $_task_id; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | $self->{_wid} = $_wid; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | eval 'MCE::relay'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | CORE::kill('KILL', $$); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | CORE::exit(0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | delete $self->{_pids_c}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | delete $self->{_pids_t}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | delete $self->{_pids_w}{$_pid}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | print {$_DAT_W_SOCK} 'NOOP'.$LF . '0'.$LF; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | ▶ | while ( $self->{_total_running} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | alarm($_timeout); $_func = <$_DAT_R_SOCK>, alarm(0); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | $_DAU_R_SOCK = $_channels->[ <$_DAT_R_SOCK> ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | if (exists $_core_output_function{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | $_core_output_function{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | } elsif (exists $_plugin_function->{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | $_plugin_function->{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | delete $self->{_pids_c}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | ## Wait on requests *without* timeout capability. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | elsif ($^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | ▶ | MCE::Util::_nonblocking($_DAT_R_SOCK, 1) if $_win32_ipc; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | ▶ | while ($self->{_total_running}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | MCE::Util::_sysread2($_DAT_R_SOCK, $_func, 8); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | ▶ | last() unless length($_func) == 8; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | $_DAU_R_SOCK = $_channels->[ substr($_func, -2, 2, '') ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | if (exists $_core_output_function{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | $_core_output_function{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | } elsif (exists $_plugin_function->{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | $_plugin_function->{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | ▶ | MCE::Util::_nonblocking($_DAT_R_SOCK, 0) if $_win32_ipc; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 148 | ▶ | while ($self->{_total_running}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 3878 | $_func = <$_DAT_R_SOCK>; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 3878 | ▶ | last() unless length($_func) == 6; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 3878 | $_DAU_R_SOCK = $_channels->[ <$_DAT_R_SOCK> ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 3878 | ▶ | if (exists $_core_output_function{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 2357 | $_core_output_function{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | } elsif (exists $_plugin_function->{$_func}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 1521 | $_plugin_function->{$_func}(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | ## Call module's loop_end routine for modules plugged into MCE. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 148 | for my $_p (@{ $_plugin_loop_end }) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 103 | $_p->($self); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | ## Call on_post_run callback. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 148 | ▶ | $_on_post_run->($self, $self->{_status}) if (defined $_on_post_run); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | ## Close opened sendto file handles. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 148 | _sendto_fhs_close(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | ## Close MCE STDOUT/STDERR handles. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 148 | eval q{ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | close $_MCE_STDOUT if (fileno $_MCE_STDOUT > 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | close $_MCE_STDERR if (fileno $_MCE_STDERR > 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 148 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 94 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||