blib/lib/Parallel/Map/Segmented.pm

filter: Statementstmt 87.5% 28 / 32 Branchbran 50.0% 5 / 10 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 76.7% 43 / 56 CC 7 SCAR 13.9
CC
7
Cov
78%
run
7.5
__ANON__
2.1
__ANON__
2.0
CRAP 4.0
« Build ↑ Summary
1 package Parallel::Map::Segmented;
2 6 $Parallel::Map::Segmented::VERSION = '0.2.2';
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use parent 'Parallel::ForkManager::Segmented::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶use Parallel::Map qw/ pmap_void /;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub run
12 {
13 5 ▶ my ( $self, $args ) = @_;
Subroutine run: called CC=6 SCAR=20.1
Pod documented
14  
15 5 my $processed = $self->process_args($args);
16 5 ▶ return if not $processed;
Branch: 1 branch
BranchTrueFalseTotal
unless $processed 1 4 5
17 my ( $WITH_PM, $batch_cb, $batch_size, $nproc, $stream_cb, ) =
18 4 @{$processed}{qw/ WITH_PM batch_cb batch_size nproc stream_cb /};
19  
20 4 my $batch = $stream_cb->( { size => 1 } )->{items};
21 4 ▶ return if not defined $batch;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $batch 0 4 4
22 4 $batch_cb->($batch);
23 4 ▶ if ($WITH_PM)
Branch: 1 branch
BranchTrueFalseTotal
if ($WITH_PM) { } 4 0 4
24 {
25 0 ▶ pmap_void sub { $batch_cb->(shift); Future->done; }, generate => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 28 ▶ return $stream_cb->( { size => $batch_size } )->{items} // ();
Subroutine __ANON__: called CC=2 SCAR=7.2
Condition66%2/3
&$stream_cb({"size", $batch_size})->{"items"} // ()
l!l&&r!l&&!r
16120
MC/DC0%0/2
&$stream_cb({"size", $batch_size})->{"items"} // ()
&$stream_cb({"size", $batch_size})->{"items"} ()
Truth table66%2/3
A // B
A= &$stream_cb({"size", $batch_size})->{"items"}B= ()
ABresult
1X1
011
000
27 },
28 4 ▶ ( $nproc ? ( forks => $nproc ) : () ),
Branch: 1 branch
BranchTrueFalseTotal
$nproc ? : 4 0 4
29 ;
30 }
31 else
32 {
33 0 ▶ while (
Branch: 1 branch
BranchTrueFalseTotal
if (defined($batch = &$stream_cb({"size", $batch_size})->{"items"})) 0 0 0
34 defined(
35 $batch = $stream_cb->( { size => $batch_size } )->{items}
36 )
37 )
38 {
39 0 $batch_cb->($batch);
40 }
41 }
42 4 return;
43 }
44  
45 6 1;
46  
47 __END__
« Build ↑ Summary