MCE/Subs.pm

filter: Statementstmt 56.0% 93 / 166 Branchbran 33.3% 6 / 18 Conditioncond 5.5% 1 / 18 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 17.6% 9 / 51 Podpod 100% 40 / 40 totaltotal 49.5% 149 / 301 CC 14 SCAR 20.0
CC
14
Cov
50%
import
37.7
_export_subs
7.1
mce_restart_worker
2.0
CRAP 7.4
« MCE/Channel/Mutex.pm ↑ Summary MCE/Channel.pm »
1 ###############################################################################
2 ## ----------------------------------------------------------------------------
3 ## Exports functions mapped directly to MCE methods.
4 ##
5 ###############################################################################
6  
7 package MCE::Subs;
8  
9 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶no warnings qw( threads recursion uninitialized );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 our $VERSION = '1.904';
15  
16 ## no critic (Subroutines::ProhibitSubroutinePrototypes)
17 ## no critic (TestingAndDebugging::ProhibitNoStrict)
18  
19 1 ▶use MCE;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use MCE::Relay;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 ###############################################################################
23 ## ----------------------------------------------------------------------------
24 ## Import routine.
25 ##
26 ###############################################################################
27  
28 1 ▶sub import {
Subroutine import: called CC=9 SCAR=36.3
29  
30 1 shift;
31  
32 1 my $_g_flg = 0; my $_m_flg = 0; my $_w_flg = 0;
33 0 ▶ my $_flag = sub { 1 }; my $_package = caller;
Subroutine __ANON__: not called CC=1 SCAR=0.4
34  
35 ## Process module arguments.
36 1 ▶ while (my $_argument = shift) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $_argument = shift()) 0 1 1
37 0 my $_arg = lc $_argument;
38  
39 0 ▶ $_g_flg = $_flag->() and next if ( $_arg eq ':getter' );
Branch: 1 branch
BranchTrueFalseTotal
if $_arg eq ":getter" 0 0 0
Condition0%0/5
$_arg eq ':getter' && (($_g_flg = &$_flag()) && (next))
!ll&&!rl&&r
000
$_g_flg = &$_flag() and next
!ll
00
MC/DC0%0/2
$_arg eq ':getter' && (($_g_flg = &$_flag()) && (next))
$_arg eq ':getter' $_g_flg = &$_flag()
Truth table0%0/3
A && B
A= $_arg eq ':getter'B= $_g_flg = &$_flag()
ABresult
0X0
100
111
40 0 ▶ $_m_flg = $_flag->() and next if ( $_arg eq ':manager' );
Branch: 1 branch
BranchTrueFalseTotal
if $_arg eq ":manager" 0 0 0
Condition0%0/5
$_arg eq ':manager' && (($_m_flg = &$_flag()) && (next))
!ll&&!rl&&r
000
$_m_flg = &$_flag() and next
!ll
00
MC/DC0%0/2
$_arg eq ':manager' && (($_m_flg = &$_flag()) && (next))
$_arg eq ':manager' $_m_flg = &$_flag()
Truth table0%0/3
A && B
A= $_arg eq ':manager'B= $_m_flg = &$_flag()
ABresult
0X0
100
111
41 0 ▶ $_w_flg = $_flag->() and next if ( $_arg eq ':worker' );
Branch: 1 branch
BranchTrueFalseTotal
if $_arg eq ":worker" 0 0 0
Condition0%0/5
$_arg eq ':worker' && (($_w_flg = &$_flag()) && (next))
!ll&&!rl&&r
000
$_w_flg = &$_flag() and next
!ll
00
MC/DC0%0/2
$_arg eq ':worker' && (($_w_flg = &$_flag()) && (next))
$_arg eq ':worker' $_w_flg = &$_flag()
Truth table0%0/3
A && B
A= $_arg eq ':worker'B= $_w_flg = &$_flag()
ABresult
0X0
100
111
42  
43 0 _croak("Error: ($_argument) invalid module option");
44 }
45  
46 1 ▶ $_m_flg = $_w_flg = 1 if ($_m_flg + $_w_flg == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $_m_flg + $_w_flg == 0 1 0 1
47  
48 1 _export_subs($_package, $_g_flg, $_m_flg, $_w_flg);
49  
50 1 return;
51 }
52  
53 ###############################################################################
54 ## ----------------------------------------------------------------------------
55 ## Define functions.
56 ##
57 ###############################################################################
58  
59 ## Callable by the manager process only.
60  
61 0 ▶sub mce_restart_worker (@) {
Subroutine mce_restart_worker: not called CC=1 SCAR=6.9
Pod documented
62 0 return $MCE::MCE->restart_worker(@_);
63 }
64  
65 0 ▶sub mce_forchunk (@) { return $MCE::MCE->forchunk(@_); }
Subroutine mce_forchunk: not called CC=1 SCAR=6.9
Pod documented
66 0 ▶sub mce_foreach (@) { return $MCE::MCE->foreach(@_); }
Subroutine mce_foreach: not called CC=1 SCAR=6.9
Pod documented
67 0 ▶sub mce_forseq (@) { return $MCE::MCE->forseq(@_); }
Subroutine mce_forseq: not called CC=1 SCAR=6.9
Pod documented
68 0 ▶sub mce_process (@) { return $MCE::MCE->process(@_); }
Subroutine mce_process: not called CC=1 SCAR=6.9
Pod documented
69 0 ▶sub mce_relay_final ( ) { return $MCE::MCE->relay_final(); }
Subroutine mce_relay_final: not called CC=1 SCAR=6.9
Pod documented
70 0 ▶sub mce_run (@) { return $MCE::MCE->run(@_); }
Subroutine mce_run: not called CC=1 SCAR=6.9
Pod documented
71 0 ▶sub mce_send (@) { return $MCE::MCE->send(@_); }
Subroutine mce_send: not called CC=1 SCAR=6.9
Pod documented
72 0 ▶sub mce_shutdown ( ) { return $MCE::MCE->shutdown(); }
Subroutine mce_shutdown: not called CC=1 SCAR=6.9
Pod documented
73 0 ▶sub mce_spawn ( ) { return $MCE::MCE->spawn(); }
Subroutine mce_spawn: not called CC=1 SCAR=6.9
Pod documented
74 0 ▶sub mce_status ( ) { return $MCE::MCE->status(); }
Subroutine mce_status: not called CC=1 SCAR=6.9
Pod documented
75  
76 ## Callable by the worker process only.
77  
78 0 ▶sub mce_exit (@) { return $MCE::MCE->exit(@_); }
Subroutine mce_exit: not called CC=1 SCAR=6.9
Pod documented
79 0 ▶sub mce_gather (@) { return $MCE::MCE->gather(@_); }
Subroutine mce_gather: not called CC=1 SCAR=6.9
Pod documented
80 0 ▶sub mce_last ( ) { return $MCE::MCE->last(); }
Subroutine mce_last: not called CC=1 SCAR=6.9
Pod documented
81 0 ▶sub mce_next ( ) { return $MCE::MCE->next(); }
Subroutine mce_next: not called CC=1 SCAR=6.9
Pod documented
82 0 ▶sub mce_relay (;&) { return $MCE::MCE->relay(@_); }
Subroutine mce_relay: not called CC=1 SCAR=6.9
Pod documented
83 0 ▶sub mce_relay_recv ( ) { return $MCE::MCE->relay_recv(); }
Subroutine mce_relay_recv: not called CC=1 SCAR=6.9
Pod documented
84 0 ▶sub mce_sendto (;*@) { return $MCE::MCE->sendto(@_); }
Subroutine mce_sendto: not called CC=1 SCAR=6.9
Pod documented
85 0 ▶sub mce_sync ( ) { return $MCE::MCE->sync(); }
Subroutine mce_sync: not called CC=1 SCAR=6.9
Pod documented
86 0 ▶sub mce_yield ( ) { return $MCE::MCE->yield(); }
Subroutine mce_yield: not called CC=1 SCAR=6.9
Pod documented
87  
88 ## Callable by both the manager and worker processes.
89  
90 0 ▶sub mce_abort ( ) { return $MCE::MCE->abort(); }
Subroutine mce_abort: not called CC=1 SCAR=6.9
Pod documented
91 0 ▶sub mce_do (@) { return $MCE::MCE->do(@_); }
Subroutine mce_do: not called CC=1 SCAR=6.9
Pod documented
92 0 ▶sub mce_freeze (@) { return $MCE::MCE->{freeze}(@_); }
Subroutine mce_freeze: not called CC=1 SCAR=6.9
Pod documented
93 0 ▶sub mce_print (;*@) { return $MCE::MCE->print(@_); }
Subroutine mce_print: not called CC=1 SCAR=6.9
Pod documented
94 0 ▶sub mce_printf (;*@) { return $MCE::MCE->printf(@_); }
Subroutine mce_printf: not called CC=1 SCAR=6.9
Pod documented
95 0 ▶sub mce_say (;*@) { return $MCE::MCE->say(@_); }
Subroutine mce_say: not called CC=1 SCAR=6.9
Pod documented
96 0 ▶sub mce_thaw (@) { return $MCE::MCE->{thaw}(@_); }
Subroutine mce_thaw: not called CC=1 SCAR=6.9
Pod documented
97  
98 ## Callable by both the manager and worker processes.
99  
100 0 ▶sub mce_chunk_id ( ) { return $MCE::MCE->chunk_id(); }
Subroutine mce_chunk_id: not called CC=1 SCAR=6.9
Pod documented
101 0 ▶sub mce_chunk_size ( ) { return $MCE::MCE->chunk_size(); }
Subroutine mce_chunk_size: not called CC=1 SCAR=6.9
Pod documented
102 0 ▶sub mce_max_retries ( ) { return $MCE::MCE->max_retries(); }
Subroutine mce_max_retries: not called CC=1 SCAR=6.9
Pod documented
103 0 ▶sub mce_max_workers ( ) { return $MCE::MCE->max_workers(); }
Subroutine mce_max_workers: not called CC=1 SCAR=6.9
Pod documented
104 0 ▶sub mce_pid ( ) { return $MCE::MCE->pid(); }
Subroutine mce_pid: not called CC=1 SCAR=6.9
Pod documented
105 0 ▶sub mce_seed ( ) { return $MCE::MCE->seed(); }
Subroutine mce_seed: not called CC=1 SCAR=6.9
Pod documented
106 0 ▶sub mce_sess_dir ( ) { return $MCE::MCE->sess_dir(); }
Subroutine mce_sess_dir: not called CC=1 SCAR=6.9
Pod documented
107 0 ▶sub mce_task_id ( ) { return $MCE::MCE->task_id(); }
Subroutine mce_task_id: not called CC=1 SCAR=6.9
Pod documented
108 0 ▶sub mce_task_name ( ) { return $MCE::MCE->task_name(); }
Subroutine mce_task_name: not called CC=1 SCAR=6.9
Pod documented
109 0 ▶sub mce_task_wid ( ) { return $MCE::MCE->task_wid(); }
Subroutine mce_task_wid: not called CC=1 SCAR=6.9
Pod documented
110 0 ▶sub mce_tmp_dir ( ) { return $MCE::MCE->tmp_dir(); }
Subroutine mce_tmp_dir: not called CC=1 SCAR=6.9
Pod documented
111 0 ▶sub mce_user_args ( ) { return $MCE::MCE->user_args(); }
Subroutine mce_user_args: not called CC=1 SCAR=6.9
Pod documented
112 0 ▶sub mce_wid ( ) { return $MCE::MCE->wid(); }
Subroutine mce_wid: not called CC=1 SCAR=6.9
Pod documented
113  
114 ###############################################################################
115 ## ----------------------------------------------------------------------------
116 ## Private methods.
117 ##
118 ###############################################################################
119  
120 0 ▶sub _croak {
Subroutine _croak: not called CC=1 SCAR=6.9
121  
122 0 goto &MCE::_croak;
123 }
124  
125 1 ▶sub _export_subs {
Subroutine _export_subs: called CC=6 SCAR=19.6
126  
127 1 my ($_package, $_g_flg, $_m_flg, $_w_flg) = @_;
128  
129 1 ▶ no strict 'refs'; no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
130  
131 ## Callable by the manager process only.
132  
133 1 ▶ if ($_m_flg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_m_flg) 1 0 1
134 1 *{ $_package . '::mce_restart_worker' } = \&mce_restart_worker;
135  
136 1 *{ $_package . '::mce_forchunk' } = \&mce_forchunk;
137 1 *{ $_package . '::mce_foreach' } = \&mce_foreach;
138 1 *{ $_package . '::mce_forseq' } = \&mce_forseq;
139 1 *{ $_package . '::mce_process' } = \&mce_process;
140 1 *{ $_package . '::mce_relay_final' } = \&mce_relay_final;
141 1 *{ $_package . '::mce_run' } = \&mce_run;
142 1 *{ $_package . '::mce_send' } = \&mce_send;
143 1 *{ $_package . '::mce_shutdown' } = \&mce_shutdown;
144 1 *{ $_package . '::mce_spawn' } = \&mce_spawn;
145 1 *{ $_package . '::mce_status' } = \&mce_status;
146 }
147  
148 ## Callable by the worker process only.
149  
150 1 ▶ if ($_w_flg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_w_flg) 1 0 1
151 1 *{ $_package . '::mce_exit' } = \&mce_exit;
152 1 *{ $_package . '::mce_gather' } = \&mce_gather;
153 1 *{ $_package . '::mce_last' } = \&mce_last;
154 1 *{ $_package . '::mce_next' } = \&mce_next;
155 1 *{ $_package . '::mce_relay' } = \&mce_relay;
156 1 *{ $_package . '::mce_relay_recv' } = \&mce_relay_recv;
157 1 *{ $_package . '::mce_sendto' } = \&mce_sendto;
158 1 *{ $_package . '::mce_sync' } = \&mce_sync;
159 1 *{ $_package . '::mce_yield' } = \&mce_yield;
160 }
161  
162 ## Callable by both the manager and worker processes.
163  
164 1 ▶ if ($_m_flg || $_w_flg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_m_flg or $_w_flg) 1 0 1
Condition33%1/3
$_m_flg or $_w_flg
l!l&&r!l&&!r
100
MC/DC0%0/2
$_m_flg or $_w_flg
$_m_flg $_w_flg
Truth table33%1/3
A or B
A= $_m_flgB= $_w_flg
ABresult
1X1
011
000
165 1 *{ $_package . '::mce_abort' } = \&mce_abort;
166 1 *{ $_package . '::mce_do' } = \&mce_do;
167 1 *{ $_package . '::mce_freeze' } = \&mce_freeze;
168 1 *{ $_package . '::mce_print' } = \&mce_print;
169 1 *{ $_package . '::mce_printf' } = \&mce_printf;
170 1 *{ $_package . '::mce_say' } = \&mce_say;
171 1 *{ $_package . '::mce_thaw' } = \&mce_thaw;
172 }
173  
174 1 ▶ if ($_g_flg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_g_flg) 0 1 1
175 0 *{ $_package . '::mce_chunk_id' } = \&mce_chunk_id;
176 0 *{ $_package . '::mce_chunk_size' } = \&mce_chunk_size;
177 0 *{ $_package . '::mce_max_retries' } = \&mce_max_retries;
178 0 *{ $_package . '::mce_max_workers' } = \&mce_max_workers;
179 0 *{ $_package . '::mce_pid' } = \&mce_pid;
180 0 *{ $_package . '::mce_seed' } = \&mce_seed;
181 0 *{ $_package . '::mce_sess_dir' } = \&mce_sess_dir;
182 0 *{ $_package . '::mce_task_id' } = \&mce_task_id;
183 0 *{ $_package . '::mce_task_name' } = \&mce_task_name;
184 0 *{ $_package . '::mce_task_wid' } = \&mce_task_wid;
185 0 *{ $_package . '::mce_tmp_dir' } = \&mce_tmp_dir;
186 0 *{ $_package . '::mce_user_args' } = \&mce_user_args;
187 0 *{ $_package . '::mce_wid' } = \&mce_wid;
188 }
189  
190 1 return;
191 }
192  
193 1 1;
194  
195 __END__
« MCE/Channel/Mutex.pm ↑ Summary MCE/Channel.pm »