Benchmarker.pm

filter: Statementstmt 23.3% 93 / 399 Branchbran 0.0% 0 / 202 Conditioncond 0.0% 0 / 51 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 60.0% 30 / 50 Podpod 0.0% 0 / 17 totaltotal 16.5% 123 / 743 CC 125 SCAR 65.2
CC
125
Cov
14%
analyze_output
1980.0
benchmark
870.0
_start
182.0
CRAP 679.3
↑ Summary Benchmarker/Imager.pm »
1 # Declare our package
2 package POE::Devel::Benchmarker;
3 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # Initialize our version
6 1 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 $VERSION = '0.05';
8  
9 # auto-export the only sub we have
10 1 ▶use base qw( Exporter );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 our @EXPORT = qw( benchmark );
12  
13 # we need hires times
14 1 ▶use Time::HiRes qw( time );
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # Import what we need from the POE namespace
17 1 ▶use POE qw( Session Filter::Line Wheel::Run );
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use base 'POE::Session::AttributeBased';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 # load comparison stuff
21 1 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 # use the power of YAML
24 1 ▶use YAML::Tiny qw( Dump );
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 # Load our stuff
27 1 ▶use POE::Devel::Benchmarker::GetInstalledLoops;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use POE::Devel::Benchmarker::Utils qw( poeloop2load knownloops generateTestfile beautify_times currentTestVersion );
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 # Actually run the tests!
31 0 ▶sub benchmark {
Subroutine benchmark: not called CC=29 SCAR=67.7
Pod undocumented
32 0 my $options = shift;
33  
34 # set default options
35 0 my $lite_tests = 1;
36 0 my $quiet_mode = 0;
37 0 my $forceloops = undef; # default to autoprobe all
38 0 my $forcepoe = undef; # default to all found POE versions in poedists/
39 0 my $forcenoxsqueue = 0; # default to try and load it
40 0 my $forcenoasserts = 0; # default is to run it
41 0 my $freshstart = 0; # always resume where we left off
42  
43 # process our options
44 0 ▶ if ( defined $options and ref $options and ref( $options ) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $options and ref $options and ref $options eq "HASH") 0 0 0
Condition0%0/6
defined $options and ref $options and ref $options eq "HASH"
!ll&&!rl&&r
000
defined $options and ref $options
!ll&&!rl&&r
000
MC/DC0%0/3
defined $options and ref $options and ref $options eq "HASH"
defined $options ref $options ref $options eq "HASH"
Truth table0%0/4
A and B and C
A= defined $optionsB= ref $optionsC= ref $options eq "HASH"
ABCresult
0XX0
10X0
1100
1111
45 # process YES for freshstart
46 0 ▶ if ( exists $options->{'freshstart'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"freshstart"}) 0 0 0
47 0 ▶ if ( $options->{'freshstart'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"freshstart"}) 0 0 0
48 0 $freshstart = 1;
49 }
50 0 delete $options->{'freshstart'};
51 }
52  
53 # process NO for XS::Queue::Array
54 0 ▶ if ( exists $options->{'noxsqueue'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"noxsqueue"}) 0 0 0
55 0 ▶ if ( $options->{'noxsqueue'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"noxsqueue"}) 0 0 0
56 0 $forcenoxsqueue = 1;
57 }
58 0 delete $options->{'noxsqueue'};
59 }
60  
61 # process NO for ASSERT
62 0 ▶ if ( exists $options->{'noasserts'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"noasserts"}) 0 0 0
63 0 ▶ if ( $options->{'noasserts'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"noasserts"}) 0 0 0
64 0 $forcenoasserts = 1;
65 }
66 0 delete $options->{'noasserts'};
67 }
68  
69 # process LITE tests
70 0 ▶ if ( exists $options->{'litetests'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"litetests"}) 0 0 0
71 0 ▶ if ( $options->{'litetests'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{'litetests'}) { } 0 0 0
72 0 $lite_tests = 1;
73 } else {
74 0 $lite_tests = 0;
75 }
76 0 delete $options->{'litetests'};
77 }
78  
79 # process quiet mode
80 0 ▶ if ( exists $options->{'quiet'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"quiet"}) 0 0 0
81 0 ▶ if ( $options->{'quiet'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{'quiet'}) { } 0 0 0
82 0 $quiet_mode = 1;
83 } else {
84 0 $quiet_mode = 0;
85 }
86 0 delete $options->{'quiet'};
87 }
88  
89 # process forceloops
90 0 ▶ if ( exists $options->{'loop'} and defined $options->{'loop'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"loop"} and defined $options->{"loop"}) 0 0 0
Condition0%0/3
exists $options->{"loop"} and defined $options->{"loop"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $options->{"loop"} and defined $options->{"loop"}
exists $options->{"loop"} defined $options->{"loop"}
Truth table0%0/3
A and B
A= exists $options->{"loop"}B= defined $options->{"loop"}
ABresult
0X0
100
111
91 0 ▶ if ( ! ref $options->{'loop'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $options->{'loop'}) { } 0 0 0
92 # split it via CSV
93 0 $forceloops = [ split( /,/, $options->{'loop'} ) ];
94 0 foreach ( @$forceloops ) {
95 0 $_ =~ s/^\s+//; $_ =~ s/\s+$//;
96 }
97 } else {
98 # treat it as array
99 0 $forceloops = $options->{'loop'};
100 }
101  
102 # check for !loop modules
103 0 my @noloops;
104 0 foreach my $l ( @$forceloops ) {
105 0 ▶ if ( $l =~ /^\!/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($l =~ /^\!/) 0 0 0
106 0 push( @noloops, substr( $l, 1 ) );
107 }
108 }
109 0 ▶ if ( scalar @noloops ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @noloops) 0 0 0
110 # replace the forceloops with ALL known, then subtract noloops from it
111 0 my %bad;
112 0 @bad{@noloops} = () x @noloops;
113 0 @$forceloops = grep { !exists $bad{$_} } @{ knownloops() };
114 }
115  
116 0 delete $options->{'loop'};
117 }
118  
119 # process the poe versions
120 0 ▶ if ( exists $options->{'poe'} and defined $options->{'poe'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options->{"poe"} and defined $options->{"poe"}) 0 0 0
Condition0%0/3
exists $options->{"poe"} and defined $options->{"poe"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $options->{"poe"} and defined $options->{"poe"}
exists $options->{"poe"} defined $options->{"poe"}
Truth table0%0/3
A and B
A= exists $options->{"poe"}B= defined $options->{"poe"}
ABresult
0X0
100
111
121 0 ▶ if ( ! ref $options->{'poe'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $options->{'poe'}) { } 0 0 0
122 # split it via CSV
123 0 $forcepoe = [ split( /,/, $options->{'poe'} ) ];
124 0 foreach ( @$forcepoe ) {
125 0 $_ =~ s/^\s+//; $_ =~ s/\s+$//;
126 }
127 } else {
128 # treat it as array
129 0 $forcepoe = $options->{'poe'};
130 }
131  
132 0 delete $options->{'poe'};
133 }
134  
135 # unknown options!
136 0 ▶ if ( scalar keys %$options ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %$options) 0 0 0
137 0 warn "[BENCHMARKER] Unknown options present in arguments: " . keys %$options;
138 }
139 }
140  
141 # do some sanity checks
142 0 ▶ if ( ! -d 'poedists' ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d "poedists") 0 0 0
143 0 die "The 'poedists' directory is not found in the working directory!";
144 }
145 0 ▶ if ( ! -d 'results' ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d "results") 0 0 0
146 0 die "The 'results' directory is not found in the working directory!";
147 }
148  
149 0 ▶ if ( ! $quiet_mode ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($quiet_mode) 0 0 0
150 0 print "[BENCHMARKER] Starting up...\n";
151 }
152  
153 # Create our session
154 POE::Session->create(
155 0 __PACKAGE__->inline_states(),
156 'heap' => {
157 # misc stuff
158 'quiet_mode' => $quiet_mode,
159  
160 # override our testing behavior
161 'lite_tests' => $lite_tests,
162 'forceloops' => $forceloops,
163 'forcepoe' => $forcepoe,
164 'forcenoxsqueue' => $forcenoxsqueue,
165 'forcenoasserts' => $forcenoasserts,
166 'freshstart' => $freshstart,
167 },
168 );
169  
170 # Fire 'er up!
171 0 POE::Kernel->run();
172 0 return;
173 }
174  
175 # Starts up our session
176 0 ▶sub _start : State {
Subroutine _start: not called CC=13 SCAR=52.0
177 # okay, get all the dists we can!
178 0 my @versions;
179 0 ▶ if ( opendir( DISTS, 'poedists' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (opendir DISTS, 'poedists') { } 0 0 0
180 0 foreach my $d ( readdir( DISTS ) ) {
181 0 ▶ if ( $d =~ /^POE\-(.+)$/ and $d !~ /\.tar\.gz$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($d =~ /^POE\-(.+)$/ and not $d =~ /\.tar\.gz$/) 0 0 0
Condition0%0/3
$d =~ /^POE\-(.+)$/ and not $d =~ /\.tar\.gz$/
!ll&&!rl&&r
000
MC/DC0%0/2
$d =~ /^POE\-(.+)$/ and not $d =~ /\.tar\.gz$/
$d =~ /^POE\-(.+)$/ not $d =~ /\.tar\.gz$/
Truth table0%0/3
A and not(B)
A= $d =~ /^POE\-(.+)$/B= not $d =~ /\.tar\.gz$/
ABresult
0X0
100
111
182 # FIXME skip POE < 0.13 because I can't get it to work
183 0 my $ver = version->new( $1 );
184 0 ▶ if ( $ver > version->new( '0.12' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ver > "version"->new("0.12")) 0 0 0
185 0 push( @versions, $ver );
186 }
187 }
188 }
189 0 ▶ closedir( DISTS ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
closedir DISTS or die $! 0 0 0
190 } else {
191 0 print "[BENCHMARKER] Unable to open 'poedists' for reading: $!\n";
192 0 return;
193 }
194  
195 # should we munge the versions list?
196 0 ▶ if ( defined $_[HEAP]->{'forcepoe'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[3]{"forcepoe"}) 0 0 0
197 # check for !poe versions
198 0 my @nopoe;
199 0 foreach my $p ( @{ $_[HEAP]->{'forcepoe'} } ) {
200 0 ▶ if ( $p =~ /^\!/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p =~ /^\!/) 0 0 0
201 0 push( @nopoe, substr( $p, 1 ) );
202 }
203 }
204 0 ▶ if ( scalar @nopoe ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @nopoe) { } 0 0 0
205 # remove the nopoe versions from the found
206 0 my %bad;
207 0 @bad{@nopoe} = () x @nopoe;
208 0 @versions = grep { !exists $bad{$_->stringify} } @versions;
209 } else {
210 # make sure the @versions contains only what we specified
211 0 my %good;
212 0 @good{ @{ $_[HEAP]->{'forcepoe'} } } = () x @{ $_[HEAP]->{'forcepoe'} };
213 0 @versions = grep { exists $good{$_->stringify} } @versions;
214 }
215 }
216  
217 # sanity
218 0 ▶ if ( ! scalar @versions ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @versions) 0 0 0
219 0 print "[BENCHMARKER] Unable to find any POE version in the 'poedists' directory!\n";
220 0 return;
221 }
222  
223 # set our alias
224 0 $_[KERNEL]->alias_set( 'Benchmarker' );
225  
226 # sanely handle some signals
227 0 $_[KERNEL]->sig( 'INT', 'handle_kill' );
228 0 $_[KERNEL]->sig( 'TERM', 'handle_kill' );
229  
230 # okay, go through all the dists in version order ( from newest to oldest )
231 0 @versions = sort { $b <=> $a } @versions;
232  
233 # Store the versions in our heap
234 0 $_[HEAP]->{'VERSIONS'} = \@versions;
235  
236 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
237 0 print "[BENCHMARKER] Detected available POE versions -> " . join( " ", @versions ) . "\n";
238 }
239  
240 # First of all, we need to find out what loop libraries are installed
241 0 getPOEloops( $_[HEAP]->{'quiet_mode'}, $_[HEAP]->{'forceloops'} );
242  
243 0 return;
244 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
245  
246 0 ▶sub _stop : State {
Subroutine _stop: not called CC=3 SCAR=24.8
247 # tell the wheel to kill itself
248 0 ▶ if ( defined $_[HEAP]->{'WHEEL'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[3]{"WHEEL"}) 0 0 0
249 0 $_[HEAP]->{'WHEEL'}->kill( 9 );
250 0 undef $_[HEAP]->{'WHEEL'};
251 }
252  
253 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
254 0 print "\n[BENCHMARKER] Shutting down...\n";
255 }
256  
257 0 return;
258 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
259  
260 # misc POE handlers
261 0 ▶sub _child : State {
Subroutine _child: not called CC=1 SCAR=6.9
262 0 return;
263 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
264 0 ▶sub handle_kill : State {
Subroutine handle_kill: not called CC=1 SCAR=6.9
Pod undocumented
265 0 return;
266 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
267  
268 # we received list of loops from GetInstalledLoops
269 0 ▶sub found_loops : State {
Subroutine found_loops: not called CC=8 SCAR=42.8
Pod undocumented
270 0 $_[HEAP]->{'installed_loops'} = [ sort { $a cmp $b } @{ $_[ARG0] } ];
271  
272 # sanity check
273 0 ▶ if ( scalar @{ $_[HEAP]->{'installed_loops'} } == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$_[3]{"installed_loops"};} == 0) 0 0 0
274 0 print "[BENCHMARKER] Detected no available POE::Loop, check your configuration?!?\n";
275 0 return;
276 }
277  
278 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
279 0 print "[BENCHMARKER] Detected available POE::Loops -> " . join( " ", @{ $_[HEAP]->{'installed_loops'} } ) . "\n";
280 }
281  
282 # Okay, do we have XS::Queue installed?
283 0 ▶ if ( ! $_[HEAP]->{'forcenoxsqueue'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"forcenoxsqueue"}) 0 0 0
284 0 eval { require POE::XS::Queue::Array };
285 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
286 0 $_[HEAP]->{'forcenoxsqueue'} = 1;
287 }
288 }
289  
290 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
291 print "[BENCHMARKER] Starting the benchmarks!" .
292 ( $_[HEAP]->{'forcenoxsqueue'} ? ' Skipping XS::Queue Tests!' : '' ) .
293 0 ▶ ( $_[HEAP]->{'forcenoasserts'} ? ' Skipping ASSERT Tests!' : '' ) .
Branch: 2 branches
BranchTrueFalseTotal
$_[3]{'forcenoxsqueue'} ? : 0 0 0
$_[3]{'forcenoasserts'} ? : 0 0 0
294 "\n";
295 }
296  
297 # start the benchmark!
298 0 $_[KERNEL]->yield( 'run_benchmark' );
299 0 return;
300 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
301  
302 # Runs one benchmark
303 0 ▶sub run_benchmark : State {
Subroutine run_benchmark: not called CC=2 SCAR=17.9
Pod undocumented
304 # Grab the version from the top of the array
305 0 $_[HEAP]->{'current_version'} = shift @{ $_[HEAP]->{'VERSIONS'} };
306  
307 # did we run out of versions?
308 0 ▶ if ( ! defined $_[HEAP]->{'current_version'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $_[3]{'current_version'}) { } 0 0 0
309 # We're done, let POE die...
310 0 $_[KERNEL]->alias_remove( 'Benchmarker' );
311 } else {
312 0 $_[HEAP]->{'loops'} = [ @{ $_[HEAP]->{'installed_loops'} } ];
313  
314 # okay, fire off the first loop
315 0 $_[KERNEL]->yield( 'bench_loop' );
316 }
317  
318 0 return;
319 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
320  
321 # runs one loop
322 0 ▶sub bench_loop : State {
Subroutine bench_loop: not called CC=3 SCAR=24.8
Pod undocumented
323 # select our current loop
324 0 $_[HEAP]->{'current_loop'} = shift @{ $_[HEAP]->{'loops'} };
325  
326 # are we done with all loops?
327 0 ▶ if ( ! defined $_[HEAP]->{'current_loop'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $_[3]{'current_loop'}) { } 0 0 0
328 # yay, go back to the main handler
329 0 $_[KERNEL]->yield( 'run_benchmark' );
330 } else {
331 # Start the assert test
332 0 ▶ if ( $_[HEAP]->{'forcenoasserts'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[3]{'forcenoasserts'}) { } 0 0 0
333 0 $_[HEAP]->{'assertions'} = [ qw( 0 ) ];
334 } else {
335 0 $_[HEAP]->{'assertions'} = [ qw( 0 1 ) ];
336 }
337 0 $_[KERNEL]->yield( 'bench_asserts' );
338 }
339  
340 0 return;
341 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
342  
343 # runs an assertion
344 0 ▶sub bench_asserts : State {
Subroutine bench_asserts: not called CC=3 SCAR=24.8
Pod undocumented
345 # select our current assert state
346 0 $_[HEAP]->{'current_assertions'} = shift @{ $_[HEAP]->{'assertions'} };
347  
348 # are we done?
349 0 ▶ if ( ! defined $_[HEAP]->{'current_assertions'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $_[3]{'current_assertions'}) { } 0 0 0
350 # yay, go back to the loop handler
351 0 $_[KERNEL]->yield( 'bench_loop' );
352 } else {
353 # Start the xsqueue test
354 0 ▶ if ( $_[HEAP]->{'forcenoxsqueue'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[3]{'forcenoxsqueue'}) { } 0 0 0
355 0 $_[HEAP]->{'noxsqueue'} = [ qw( 1 ) ];
356 } else {
357 0 $_[HEAP]->{'noxsqueue'} = [ qw( 0 1 ) ];
358 }
359 0 $_[KERNEL]->yield( 'bench_xsqueue' );
360 }
361  
362 0 return;
363 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
364  
365 # runs test with or without xsqueue
366 0 ▶sub bench_xsqueue : State {
Subroutine bench_xsqueue: not called CC=2 SCAR=17.9
Pod undocumented
367 # select our current noxsqueue state
368 0 $_[HEAP]->{'current_noxsqueue'} = shift @{ $_[HEAP]->{'noxsqueue'} };
369  
370 # are we done?
371 0 ▶ if ( ! defined $_[HEAP]->{'current_noxsqueue'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $_[3]{'current_noxsqueue'}) { } 0 0 0
372 # yay, go back to the assert handler
373 0 $_[KERNEL]->yield( 'bench_asserts' );
374 } else {
375 # do some careful analysis
376 0 $_[KERNEL]->yield( 'bench_checkprevioustest' );
377 }
378  
379 0 return;
380 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
381  
382 # Checks to see if this test was run in the past
383 0 ▶sub bench_checkprevioustest : State {
Subroutine bench_checkprevioustest: not called CC=12 SCAR=50.5
Pod undocumented
384 # okay, do we need to check and see if we already did this test?
385 0 ▶ if ( ! $_[HEAP]->{'freshstart'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"freshstart"}) 0 0 0
386 # determine the file used
387 0 my $file = generateTestfile( $_[HEAP] );
388  
389 # does it exist?
390 0 ▶ if ( -e "results/$file.yml" and -f _ and -s _ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "results/$file.yml" and -f _ and -s _) 0 0 0
Condition0%0/6
-e "results/$file.yml" and -f _ and -s _
!ll&&!rl&&r
000
-e "results/$file.yml" and -f _
!ll&&!rl&&r
000
MC/DC0%0/3
-e "results/$file.yml" and -f _ and -s _
-e "results/$file.yml" -f _ -s _
Truth table0%0/4
A and B and C
A= -e "results/$file.yml"B= -f _C= -s _
ABCresult
0XX0
10X0
1100
1111
391 # okay, sanity check it
392 0 my $yaml = YAML::Tiny->read( "results/$file.yml" );
393 0 ▶ if ( defined $yaml ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $yaml) { } 0 0 0
394 # inrospect it!
395 0 my $isvalid = 0;
396 0 eval {
397 # simple sanity check: the "x_bench" param is at the end of the YML, so if it loads fine we know it's there
398 0 ▶ if ( exists $yaml->[0]->{'x_bench'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $yaml->[0]{'x_bench'}) { } 0 0 0
399 # version must at least match us
400 0 ▶ $isvalid = ( $yaml->[0]->{'x_bench'} eq $POE::Devel::Benchmarker::VERSION ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$yaml->[0]{'x_bench'} eq $POE::Devel::Benchmarker::VERSION ? : 0 0 0
401 } else {
402 0 $isvalid = undef;
403 }
404 };
405 0 ▶ if ( $isvalid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($isvalid) { } 0 0 0
406 # yay, this test is A-OK!
407 0 $_[KERNEL]->yield( 'bench_xsqueue' );
408 0 return;
409 } else {
410 # was it truncated?
411 0 ▶ if ( ! defined $isvalid ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $isvalid) 0 0 0
412 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
413 0 print "\n[BENCHMARKER] YAML file($file) from previous test was corrupt!\n";
414 }
415 }
416 }
417 } else {
418 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
419 0 print "\n[BENCHMARKER] Unable to load YAML file($file) from previous test run: " . YAML::Tiny->errstr . "\n";
420 }
421 }
422 }
423 }
424  
425 # could not find previous file or FRESHSTART, proceed normally
426 0 $_[KERNEL]->yield( 'create_subprocess' );
427  
428 0 return;
429 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
430  
431 # actually runs the subprocess
432 0 ▶sub create_subprocess : State {
Subroutine create_subprocess: not called CC=6 SCAR=37.4
Pod undocumented
433 # Okay, start testing this specific combo!
434 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
435 0 print "\n Testing " . generateTestfile( $_[HEAP] ) . "...";
436 }
437  
438 # save the starttime
439 0 $_[HEAP]->{'current_starttime'} = time();
440 0 $_[HEAP]->{'current_starttimes'} = [ times() ];
441  
442 # Okay, create the wheel::run to handle this
443 0 my $looploader = poeloop2load( $_[HEAP]->{'current_loop'} );
444 $_[HEAP]->{'WHEEL'} = POE::Wheel::Run->new(
445 'Program' => $^X,
446 'ProgramArgs' => [ '-Ipoedists/POE-' . $_[HEAP]->{'current_version'},
447 '-Ipoedists/POE-' . $_[HEAP]->{'current_version'} . '/lib',
448 ( defined $looploader ? "-M$looploader" : () ),
449 '-MPOE::Devel::Benchmarker::SubProcess',
450 '-e',
451 'POE::Devel::Benchmarker::SubProcess::benchmark',
452 $_[HEAP]->{'current_loop'},
453 $_[HEAP]->{'current_assertions'},
454 $_[HEAP]->{'lite_tests'},
455 0 ▶ $_[HEAP]->{'current_noxsqueue'},
Branch: 1 branch
BranchTrueFalseTotal
defined $looploader ? : 0 0 0
456 ],
457  
458 # Kill off existing FD's
459 'CloseOnCall' => 1,
460  
461 # setup our data handlers
462 'StdoutEvent' => 'Got_STDOUT',
463 'StderrEvent' => 'Got_STDERR',
464  
465 # the error handler
466 'ErrorEvent' => 'Got_ERROR',
467 'CloseEvent' => 'Got_CLOSED',
468  
469 # set our filters
470 'StderrFilter' => POE::Filter::Line->new(),
471 'StdoutFilter' => POE::Filter::Line->new(),
472 );
473 0 ▶ if ( ! defined $_[HEAP]->{'WHEEL'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $_[3]{'WHEEL'}) { } 0 0 0
474 0 die 'Unable to create a new wheel!';
475 } else {
476 # smart CHLD handling
477 0 ▶ if ( $_[KERNEL]->can( "sig_child" ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[2]->can('sig_child')) { } 0 0 0
478 0 $_[KERNEL]->sig_child( $_[HEAP]->{'WHEEL'}->PID => 'Got_CHLD' );
479 } else {
480 0 $_[KERNEL]->sig( 'CHLD', 'Got_CHLD' );
481 }
482 }
483  
484 # setup our data we received from the subprocess
485 0 $_[HEAP]->{'current_data'} = '';
486  
487 # Okay, we timeout this test after some time for sanity
488 0 $_[HEAP]->{'test_timedout'} = 0;
489 0 ▶ if ( $_[HEAP]->{'lite_tests'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[3]{'lite_tests'}) { } 0 0 0
490 # 5min timeout is 5x my average runs on a 1.2ghz core2duo so it should be good enough
491 0 $_[HEAP]->{'TIMER'} = $_[KERNEL]->delay_set( 'test_timedout' => 60 * 5 );
492 } else {
493 # 30min timeout is 2x my average runs on a 1.2ghz core2duo so it should be good enough
494 0 $_[HEAP]->{'TIMER'} = $_[KERNEL]->delay_set( 'test_timedout' => 60 * 30 );
495 }
496  
497 0 return;
498 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
499  
500 # Got a CHLD event!
501 0 ▶sub Got_CHLD : State {
Subroutine Got_CHLD: not called CC=1 SCAR=6.9
Pod undocumented
502 0 $_[KERNEL]->sig_handled();
503 0 return;
504 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
505  
506 # Handles child STDERR output
507 0 ▶sub Got_STDERR : State {
Subroutine Got_STDERR: not called CC=2 SCAR=17.9
Pod undocumented
508 0 my $input = $_[ARG0];
509  
510 # skip empty lines
511 0 ▶ if ( $input ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($input ne "") 0 0 0
512 # save it!
513 0 $_[HEAP]->{'current_data'} .= '!STDERR: ' . $input . "\n";
514 }
515 0 return;
516 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
517  
518 # Handles child STDOUT output
519 0 ▶sub Got_STDOUT : State {
Subroutine Got_STDOUT: not called CC=1 SCAR=6.9
Pod undocumented
520 0 my $input = $_[ARG0];
521  
522 # save it!
523 0 $_[HEAP]->{'current_data'} .= $input . "\n";
524 0 return;
525 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
526  
527 # Handles child error
528 0 ▶sub Got_ERROR : State {
Subroutine Got_ERROR: not called CC=2 SCAR=17.9
Pod undocumented
529 # Copied from POE::Wheel::Run manpage
530 0 my ( $operation, $errnum, $errstr ) = @_[ ARG0 .. ARG2 ];
531  
532 # ignore exit 0 errors
533 0 ▶ if ( $errnum != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($errnum != 0) 0 0 0
534 0 print "\n[BENCHMARKER] Wheel::Run got an $operation error $errnum: $errstr\n";
535 }
536  
537 0 return;
538 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
539  
540 # Handles child DIE'ing
541 0 ▶sub Got_CLOSED : State {
Subroutine Got_CLOSED: not called CC=1 SCAR=6.9
Pod undocumented
542 # Get rid of the wheel
543 0 undef $_[HEAP]->{'WHEEL'};
544  
545 # get rid of the delay
546 0 $_[KERNEL]->alarm_remove( $_[HEAP]->{'TIMER'} );
547 0 undef $_[HEAP]->{'TIMER'};
548  
549 # wrap up this test
550 0 $_[KERNEL]->yield( 'wrapup_test' );
551 0 return;
552 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
553  
554 # a test timed out, unfortunately!
555 0 ▶sub test_timedout : State {
Subroutine test_timedout: not called CC=2 SCAR=17.9
Pod undocumented
556 # tell the wheel to kill itself
557 0 $_[HEAP]->{'WHEEL'}->kill( 9 );
558 0 undef $_[HEAP]->{'WHEEL'};
559  
560 0 ▶ if ( ! $_[HEAP]->{'quiet_mode'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[3]{"quiet_mode"}) 0 0 0
561 0 print " Test Timed Out!";
562 }
563  
564 0 $_[HEAP]->{'test_timedout'} = 1;
565  
566 # wrap up this test
567 0 $_[KERNEL]->yield( 'wrapup_test' );
568 0 return;
569 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
570  
571 # finalizes a test
572 0 ▶sub wrapup_test : State {
Subroutine wrapup_test: not called CC=8 SCAR=42.8
Pod undocumented
573 # we're done with this benchmark!
574 0 $_[HEAP]->{'current_endtime'} = time();
575 0 $_[HEAP]->{'current_endtimes'} = [ times() ];
576  
577 # store the data
578 0 my $file = generateTestfile( $_[HEAP] );
579 0 ▶ if ( open( my $fh, '>', "results/$file" ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, '>', "results/$file") { } 0 0 0
580 0 print $fh "STARTTIME: " . $_[HEAP]->{'current_starttime'} . " -> TIMES " . join( " ", @{ $_[HEAP]->{'current_starttimes'} } ) . "\n";
581 0 print $fh "$file\n";
582 0 print $fh $_[HEAP]->{'current_data'} . "\n";
583 0 ▶ if ( $_[HEAP]->{'test_timedout'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[3]{"test_timedout"}) 0 0 0
584 0 print $fh "\nTEST TERMINATED DUE TO TIMEOUT\n";
585 }
586 0 print $fh "ENDTIME: " . $_[HEAP]->{'current_endtime'} . " -> TIMES " . join( " ", @{ $_[HEAP]->{'current_endtimes'} } ) . "\n";
587 0 ▶ close( $fh ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die $! 0 0 0
588 } else {
589 0 print "\n[BENCHMARKER] Unable to open results/$file for writing -> $!\n";
590 }
591  
592 # Send the data to the Analyzer to process
593 $_[KERNEL]->yield( 'analyze_output', {
594 'poe' => {
595 'v' => $_[HEAP]->{'current_version'}->stringify, # YAML::Tiny doesn't like version objects :(
596 'loop' => 'POE::Loop::' . $_[HEAP]->{'current_loop'},
597 },
598 't' => {
599 's_ts' => $_[HEAP]->{'current_starttime'},
600 'e_ts' => $_[HEAP]->{'current_endtime'},
601 'd' => $_[HEAP]->{'current_endtime'} - $_[HEAP]->{'current_starttime'},
602 0 's_t' => [ @{ $_[HEAP]->{'current_starttimes'} } ],
603 0 ▶ 'e_t' => [ @{ $_[HEAP]->{'current_endtimes'} } ],
Branch: 4 branches
BranchTrueFalseTotal
$_[3]{'test_timedout'} ? : 0 0 0
$_[3]{'lite_tests'} ? : 0 0 0
$_[3]{'current_assertions'} ? : 0 0 0
$_[3]{'current_noxsqueue'} ? : 0 0 0
604 },
605 'raw' => $_[HEAP]->{'current_data'},
606 'test' => $file,
607 'x_bench' => currentTestVersion(),
608 ( $_[HEAP]->{'test_timedout'} ? ( 'timedout' => 1 ) : () ),
609 ( $_[HEAP]->{'lite_tests'} ? ( 'litetests' => 1 ) : () ),
610 ( $_[HEAP]->{'current_assertions'} ? ( 'asserts' => 1 ) : () ),
611 0 ( $_[HEAP]->{'current_noxsqueue'} ? ( 'noxsqueue' => 1 ) : () ),
612 } );
613  
614 # process the next test
615 0 $_[KERNEL]->yield( 'bench_xsqueue' );
616  
617 0 return;
618 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
619  
620 0 ▶sub analyze_output : State {
Subroutine analyze_output: not called CC=44 SCAR=75.9
Pod undocumented
621 # get the data
622 0 my $test = $_[ARG0];
623  
624 # clean up the times() stuff
625 $test->{'t'}->{'t'} = beautify_times(
626 0 join( " ", @{ delete $test->{'t'}->{'s_t'} } ) .
627 " " .
628 0 join( " ", @{ delete $test->{'t'}->{'e_t'} } )
629 );
630  
631 # Okay, break it down into our data struct
632 0 $test->{'metrics'} = {};
633 0 my $d = $test->{'metrics'};
634 0 my @unknown;
635 0 foreach my $l ( split( /(?:\n|\r)/, $test->{'raw'} ) ) {
636 # skip empty lines
637 0 ▶ if ( $l eq '' ) { next }
Branch: 1 branch
BranchTrueFalseTotal
if ($l eq "") 0 0 0
638  
639 # usual test benchmark output
640 # 10 startups in 0.885 seconds ( 11.302 per second)
641 # 10000 posts in 0.497 seconds ( 20101.112 per second)
642 0 ▶ if ( $l =~ /^\s+\d+\s+(\w+)\s+in\s+([\d\.]+)\s+seconds\s+\(\s+([\d\.]+)\s+per\s+second\)$/ ) {
Branch: 14 branches
BranchTrueFalseTotal
if ($l =~ /^\s+\d+\s+(\w+)\s+in\s+([\d\.]+)\s+seconds\s+\(\s+([\d\.]+)\s+per\s+second\)$/) { } 0 0 0
elsif ($l =~ /^(\w+)\s+times:\s+(.+)$/) { } 0 0 0
elsif ($l =~ /^SKIPPING\s+br0ken\s+(\w+)\s+because/) { } 0 0 0
elsif ($l =~ /^pidinfo:\s+(.+)$/) { } 0 0 0
elsif ($l =~ /^perlconfig:\s+(.+)$/) { } 0 0 0
elsif ($l =~ /^cpuinfo:\s+(.+)$/) { } 0 0 0
elsif ($l =~ /^\!STDERR:\s+Devel\:\:Hide\s+hides/) { } 0 0 0
elsif ($l eq 'Using NO Assertions!' or $l eq 'Using FULL Assertions!' or $l eq 'Using the LITE tests' or $l eq 'Using the HEAVY tests' or $l eq 'DISABLING POE::XS::Queue::Array' or $l eq 'LETTING POE find POE::XS::Queue::Array' or $l eq 'UNABLE TO GET /proc/self/status' or $l eq 'UNABLE TO GET /proc/cpuinfo' or $l eq q[!STDERR: POE::Kernel's run() method was never called.] or $l eq 'TEST TERMINATED DUE TO TIMEOUT') { } 0 0 0
elsif ($l =~ /^Running\s+under\s+perl\s+binary:\s+\'([^\']+)\'\s+v([\d\.]+)$/) { } 0 0 0
elsif ($l =~ /^Using\s+master\s+loop:\s+(.+)$/) { } 0 0 0
elsif ($l =~ /^Using\s+POE-(.+)$/) { } 0 0 0
elsif ($l =~ /^POE\s+is\s+using:\s+([^\s]+)\s+v(.+)$/) { } 0 0 0
elsif ($l =~ /^Running\s+under\s+machine:\s+(.+)$/) { } 0 0 0
elsif ($l =~ /^\!STDERR:\s+(.+)$/) { } 0 0 0
643 0 $d->{ $1 }->{'d'} = $2; # duration in seconds
644 0 $d->{ $1 }->{'i'} = $3; # iterations per second
645  
646 # usual test benchmark times output
647 # startup times: 0.1 0 0 0 0.1 0 0.76 0.09
648 } elsif ( $l =~ /^(\w+)\s+times:\s+(.+)$/ ) {
649 0 $d->{ $1 }->{'t'} = beautify_times( $2 ); # the times hash
650  
651 # usual test SKIP output
652 # SKIPPING br0ken $metric because ...
653 } elsif ( $l =~ /^SKIPPING\s+br0ken\s+(\w+)\s+because/ ) {
654 # don't build their data struct
655  
656 # parse the memory footprint stuff
657 } elsif ( $l =~ /^pidinfo:\s+(.+)$/ ) {
658 # what should we analyze?
659 0 my $pidinfo = $1;
660  
661 # VmPeak: 16172 kB
662 0 ▶ if ( $pidinfo =~ /^VmPeak:\s+(.+)$/ ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($pidinfo =~ /^VmPeak:\s+(.+)$/) { } 0 0 0
elsif ($pidinfo =~ /^voluntary_ctxt_switches:\s+(.+)$/) { } 0 0 0
elsif ($pidinfo =~ /^nonvoluntary_ctxt_switches:\s+(.+)$/) { } 0 0 0
663 0 $test->{'pid'}->{'vmpeak'} = $1;
664  
665 # voluntary_ctxt_switches: 10
666 } elsif ( $pidinfo =~ /^voluntary_ctxt_switches:\s+(.+)$/ ) {
667 0 $test->{'pid'}->{'vol_ctxt'} = $1;
668  
669 # nonvoluntary_ctxt_switches: 1221
670 } elsif ( $pidinfo =~ /^nonvoluntary_ctxt_switches:\s+(.+)$/ ) {
671 0 $test->{'pid'}->{'nonvol_ctxt'} = $1;
672  
673 } else {
674 # ignore the rest of the fluff
675 }
676 # parse the perl binary stuff
677 } elsif ( $l =~ /^perlconfig:\s+(.+)$/ ) {
678 # what should we analyze?
679 0 my $perlconfig = $1;
680  
681 # ignore the fluff ( not needed now... )
682  
683 # parse the CPU info
684 } elsif ( $l =~ /^cpuinfo:\s+(.+)$/ ) {
685 # what should we analyze?
686 0 my $cpuinfo = $1;
687  
688 # FIXME if this is on a multiproc system, we will overwrite the data per processor ( harmless? )
689  
690 # cpu MHz : 1201.000
691 0 ▶ if ( $cpuinfo =~ /^cpu\s+MHz\s+:\s+(.+)$/ ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($cpuinfo =~ /^cpu\s+MHz\s+:\s+(.+)$/) { } 0 0 0
elsif ($cpuinfo =~ /^model\s+name\s+:\s+(.+)$/) { } 0 0 0
elsif ($cpuinfo =~ /^bogomips\s+:\s+(.+)$/) { } 0 0 0
692 0 $test->{'cpu'}->{'mhz'} = $1;
693  
694 # model name : Intel(R) Core(TM)2 Duo CPU L7100 @ 1.20GHz
695 } elsif ( $cpuinfo =~ /^model\s+name\s+:\s+(.+)$/ ) {
696 0 $test->{'cpu'}->{'name'} = $1;
697  
698 # bogomips : 2397.58
699 } elsif ( $cpuinfo =~ /^bogomips\s+:\s+(.+)$/ ) {
700 0 $test->{'cpu'}->{'bogo'} = $1;
701  
702 } else {
703 # ignore the rest of the fluff
704 }
705  
706 # ignore any Devel::Hide stuff
707 # $l eq '!STDERR: Devel::Hide hides POE/XS/Queue/Array.pm'
708 } elsif ( $l =~ /^\!STDERR:\s+Devel\:\:Hide\s+hides/ ) {
709 # ignore them
710  
711 # data that we can safely throw away
712 ▶ } elsif ( $l eq 'Using NO Assertions!' or
Condition0%0/27
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests" or $l eq "DISABLING POE::XS::Queue::Array" or $l eq "LETTING POE find POE::XS::Queue::Array" or $l eq "UNABLE TO GET /proc/self/status" or $l eq "UNABLE TO GET /proc/cpuinfo" or $l eq "!STDERR: POE::Kernel's run() method was never called." or $l eq "TEST TERMINATED DUE TO TIMEOUT"
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests" or $l eq "DISABLING POE::XS::Queue::Array" or $l eq "LETTING POE find POE::XS::Queue::Array" or $l eq "UNABLE TO GET /proc/self/status" or $l eq "UNABLE TO GET /proc/cpuinfo" or $l eq "!STDERR: POE::Kernel's run() method was never called."
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests" or $l eq "DISABLING POE::XS::Queue::Array" or $l eq "LETTING POE find POE::XS::Queue::Array" or $l eq "UNABLE TO GET /proc/self/status" or $l eq "UNABLE TO GET /proc/cpuinfo"
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests" or $l eq "DISABLING POE::XS::Queue::Array" or $l eq "LETTING POE find POE::XS::Queue::Array" or $l eq "UNABLE TO GET /proc/self/status"
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests" or $l eq "DISABLING POE::XS::Queue::Array" or $l eq "LETTING POE find POE::XS::Queue::Array"
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests" or $l eq "DISABLING POE::XS::Queue::Array"
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests"
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests"
l!l&&r!l&&!r
000
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!"
l!l&&r!l&&!r
000
MC/DC0%0/10
$l eq "Using NO Assertions!" or $l eq "Using FULL Assertions!" or $l eq "Using the LITE tests" or $l eq "Using the HEAVY tests" or $l eq "DISABLING POE::XS::Queue::Array" or $l eq "LETTING POE find POE::XS::Queue::Array" or $l eq "UNABLE TO GET /proc/self/status" or $l eq "UNABLE TO GET /proc/cpuinfo" or $l eq "!STDERR: POE::Kernel's run() method was never called." or $l eq "TEST TERMINATED DUE TO TIMEOUT"
$l eq "Using NO Assertions!" $l eq "Using FULL Assertions!" $l eq "Using the LITE tests" $l eq "Using the HEAVY tests" $l eq "DISABLING POE::XS::Queue::Array" $l eq "LETTING POE find POE::XS::Queue::Array" $l eq "UNABLE TO GET /proc/self/status" $l eq "UNABLE TO GET /proc/cpuinfo" $l eq "!STDERR: POE::Kernel's run() method was never called." $l eq "TEST TERMINATED DUE TO TIMEOUT"
Truth table0%0/11
A or B or C or D or E or F or G or H or I or J
A= $l eq "Using NO Assertions!"B= $l eq "Using FULL Assertions!"C= $l eq "Using the LITE tests"D= $l eq "Using the HEAVY tests"E= $l eq "DISABLING POE::XS::Queue::Array"F= $l eq "LETTING POE find POE::XS::Queue::Array"G= $l eq "UNABLE TO GET /proc/self/status"H= $l eq "UNABLE TO GET /proc/cpuinfo"I= $l eq "!STDERR: POE::Kernel's run() method was never called."J= $l eq "TEST TERMINATED DUE TO TIMEOUT"
ABCDEFGHIJresult
1XXXXXXXXX1
01XXXXXXXX1
001XXXXXXX1
0001XXXXXX1
00001XXXXX1
000001XXXX1
0000001XXX1
00000001XX1
000000001X1
00000000011
00000000000
713 $l eq 'Using FULL Assertions!' or
714 $l eq 'Using the LITE tests' or
715 $l eq 'Using the HEAVY tests' or
716 $l eq 'DISABLING POE::XS::Queue::Array' or
717 $l eq 'LETTING POE find POE::XS::Queue::Array' or
718 $l eq 'UNABLE TO GET /proc/self/status' or
719 $l eq 'UNABLE TO GET /proc/cpuinfo' or
720 $l eq '!STDERR: POE::Kernel\'s run() method was never called.' or # to ignore old POEs that threw this warning
721 $l eq 'TEST TERMINATED DUE TO TIMEOUT' ) {
722 # ignore them
723  
724 # parse the perl binary stuff
725 } elsif ( $l =~ /^Running\s+under\s+perl\s+binary:\s+\'([^\']+)\'\s+v([\d\.]+)$/ ) {
726 0 $test->{'perl'}->{'binary'} = $1;
727  
728 # setup the perl version
729 0 $test->{'perl'}->{'v'} = $2;
730  
731 # the master loop version ( what the POE::Loop::XYZ actually uses )
732 # Using loop: EV-3.49
733 } elsif ( $l =~ /^Using\s+master\s+loop:\s+(.+)$/ ) {
734 0 $test->{'poe'}->{'loop_m'} = $1;
735  
736 # the real POE version that was loaded
737 # Using POE-1.001
738 } elsif ( $l =~ /^Using\s+POE-(.+)$/ ) {
739 0 $test->{'poe'}->{'v_real'} = $1;
740  
741 # the various queue/loop modules we loaded
742 # POE is using: POE::XS::Queue::Array v0.005
743 # POE is using: POE::Queue v1.2328
744 # POE is using: POE::Loop::EV v0.06
745 } elsif ( $l =~ /^POE\s+is\s+using:\s+([^\s]+)\s+v(.+)$/ ) {
746 0 $test->{'poe'}->{'modules'}->{ $1 } = $2;
747  
748 # get the uname info
749 # Running under machine: Linux apoc-x300 2.6.24-21-generic #1 SMP Tue Oct 21 23:43:45 UTC 2008 i686 GNU/Linux
750 } elsif ( $l =~ /^Running\s+under\s+machine:\s+(.+)$/ ) {
751 0 $test->{'uname'} = $1;
752  
753 # parse any STDERR output
754 # !STDERR: unable to foo
755 } elsif ( $l =~ /^\!STDERR:\s+(.+)$/ ) {
756 0 push( @{ $test->{'stderr'} }, $1 );
757  
758 } else {
759 # unknown line :(
760 0 push( @unknown, $l );
761 }
762 }
763  
764 # Get rid of the rawdata
765 0 delete $test->{'raw'};
766  
767 # Dump the unknowns
768 0 ▶ if ( @unknown ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@unknown) 0 0 0
769 0 print "\n[ANALYZER] Unknown output from benchmark -> " . Dump( \@unknown );
770 }
771  
772 # Dump the data struct we have to the file.yml
773 0 my $yaml_file = 'results/' . delete $test->{'test'};
774 0 $yaml_file .= '.yml';
775 0 my $ret = open( my $fh, '>', $yaml_file );
776 0 ▶ if ( defined $ret ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ret) { } 0 0 0
777 0 print $fh Dump( $test );
778 0 ▶ if ( ! close( $fh ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (close $fh) 0 0 0
779 0 print "\n[ANALYZER] Unable to close $yaml_file -> " . $! . "\n";
780 }
781 } else {
782 0 print "\n[ANALYZER] Unable to open $yaml_file for writing -> " . $! . "\n";
783 }
784  
785 # now that we've dumped the stuff, we can do some sanity checks
786  
787 # the POE we "think" we loaded should match reality!
788 0 ▶ if ( exists $test->{'poe'}->{'v_real'} ) { # if this exists, then we successfully loaded POE
Branch: 1 branch
BranchTrueFalseTotal
if (exists $test->{"poe"}{"v_real"}) 0 0 0
789 0 ▶ if ( $test->{'poe'}->{'v'} ne $test->{'poe'}->{'v_real'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test->{"poe"}{"v"} ne $test->{"poe"}{"v_real"}) 0 0 0
790 0 print "\n[ANALYZER] The subprocess loaded a different version of POE than we thought -> $yaml_file\n";
791 }
792  
793 # The loop we loaded should match what we wanted!
794 0 ▶ if ( exists $test->{'poe'}->{'modules'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $test->{"poe"}{"modules"}) 0 0 0
795 0 ▶ if ( ! exists $test->{'poe'}->{'modules'}->{ $test->{'poe'}->{'loop'} } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $test->{"poe"}{"modules"}{$test->{"poe"}{"loop"}}) 0 0 0
796 # gaah special-case for IO_Poll
797 0 ▶ if ( $test->{'poe'}->{'loop'} eq 'POE::Loop::IO_Poll' and exists $test->{'poe'}->{'modules'}->{'POE::Loop::Poll'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test->{'poe'}{'loop'} eq 'POE::Loop::IO_Poll' and exists $test->{'poe'}{'modules'}{'POE::Loop::Poll'}) { } 0 0 0
Condition0%0/3
$test->{"poe"}{"loop"} eq "POE::Loop::IO_Poll" and exists $test->{"poe"}{"modules"}{"POE::Loop::Poll"}
!ll&&!rl&&r
000
MC/DC0%0/2
$test->{"poe"}{"loop"} eq "POE::Loop::IO_Poll" and exists $test->{"poe"}{"modules"}{"POE::Loop::Poll"}
$test->{"poe"}{"loop"} eq "POE::Loop::IO_Poll" exists $test->{"poe"}{"modules"}{"POE::Loop::Poll"}
Truth table0%0/3
A and B
A= $test->{"poe"}{"loop"} eq "POE::Loop::IO_Poll"B= exists $test->{"poe"}{"modules"}{"POE::Loop::Poll"}
ABresult
0X0
100
111
798 # ah, ignore this
799 } else {
800 0 print "\n[ANALYZER] The subprocess loaded a different Loop than we thought -> $yaml_file\n";
801 }
802 }
803 }
804 }
805  
806 # the perl binary should be the same!
807 0 ▶ if ( exists $test->{'perl'} ) { # if this exists, we successfully fired up the app ( no compile error )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $test->{"perl"}) 0 0 0
808 0 ▶ if ( $test->{'perl'}->{'binary'} ne $^X ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test->{"perl"}{"binary"} ne $^X) 0 0 0
809 0 print "\n[ANALYZER] The subprocess booted up on a different perl binary -> $yaml_file\n";
810 }
811 0 ▶ if ( $test->{'perl'}->{'v'} ne sprintf( "%vd", $^V ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test->{"perl"}{"v"} ne sprintf("%vd", $^V)) 0 0 0
812 0 print "\n[ANALYZER] The subprocess booted up on a different perl version -> $yaml_file\n";
813 }
814 }
815  
816 # all done!
817 0 return;
818 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
819  
820 1 1;
821 __END__
↑ Summary Benchmarker/Imager.pm »