Benchmarker/SubProcess.pm

filter: Statementstmt 13.6% 58 / 425 Branchbran 2.3% 3 / 130 Conditioncond 8.3% 2 / 24 MC/DCmcdc 0.0% 0 / 15 Subroutinesub 27.4% 17 / 62 Podpod 0.0% 0 / 42 totaltotal 11.4% 80 / 698 CC 82 SCAR 31.5
CC
82
Cov
11%
process_testmode
90.0
poe_myfh_read
90.0
poe_myfh_write
42.0
CRAP 23.2
« Benchmarker/Utils.pm ↑ Summary Benchmarker/GetInstalledLoops.pm »
1 # Declare our package
2 package POE::Devel::Benchmarker::SubProcess;
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 # set our compile-time stuff
10 1 ▶BEGIN {
Subroutine BEGIN: called CC=8 SCAR=29.6
11 # should we enable assertions?
12 1 ▶ if ( defined $ARGV[1] and $ARGV[1] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ARGV[1] and $ARGV[1]) 0 1 1
Condition33%1/3
defined $ARGV[1] and $ARGV[1]
!ll&&!rl&&r
100
MC/DC0%0/2
defined $ARGV[1] and $ARGV[1]
defined $ARGV[1] $ARGV[1]
Truth table33%1/3
A and B
A= defined $ARGV[1]B= $ARGV[1]
ABresult
0X0
100
111
13 ## no critic
14 0 eval "sub POE::Kernel::ASSERT_DEFAULT () { 1 }";
15 0 eval "sub POE::Session::ASSERT_STATES () { 1 }";
16 ## use critic
17 }
18  
19 # Compile a list of modules to hide
20 1 my $hide = '';
21 1 ▶ if ( defined $ARGV[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ARGV[0]) 0 1 1
22 0 ▶ if ( $ARGV[0] ne 'XSPoll' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ARGV[0] ne "XSPoll") 0 0 0
23 0 $hide .= ' POE/XS/Loop/Poll.pm';
24 }
25 0 ▶ if ( $ARGV[0] ne 'XSEPoll' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ARGV[0] ne "XSEPoll") 0 0 0
26 0 $hide .= ' POE/XS/Loop/EPoll.pm';
27 }
28 }
29  
30 # should we "hide" XS::Queue::Array?
31 1 ▶ if ( defined $ARGV[3] and $ARGV[3] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ARGV[3] and $ARGV[3]) 0 1 1
Condition33%1/3
defined $ARGV[3] and $ARGV[3]
!ll&&!rl&&r
100
MC/DC0%0/2
defined $ARGV[3] and $ARGV[3]
defined $ARGV[3] $ARGV[3]
Truth table33%1/3
A and B
A= defined $ARGV[3]B= $ARGV[3]
ABresult
0X0
100
111
32 0 $hide .= ' POE/XS/Queue/Array.pm';
33 }
34  
35 # actually hide the modules!
36 {
37 ## no critic
38 1 ▶ eval "use Devel::Hide qw( $hide )";
Subroutine BEGIN: called CC=1 SCAR=0.0
39 ## use critic
40 }
41 }
42  
43 # process the eventloop
44 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
45 # FIXME figure out a better way to load loop with precision based on POE version
46 # if ( defined $ARGV[0] ) {
47 # eval "use POE::Kernel; use POE::Loop::$ARGV[0]";
48 # if ( $@ ) { die $@ }
49 # }
50 }
51  
52 # Import Time::HiRes's time()
53 1 ▶use Time::HiRes qw( time );
Subroutine BEGIN: called CC=1 SCAR=0.0
54  
55 # load POE
56 1 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 1 ▶use POE::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 1 ▶use POE::Wheel::SocketFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 1 ▶use POE::Wheel::ReadWrite;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 1 ▶use POE::Filter::Line;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 1 ▶use POE::Driver::SysRW;
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 # autoflush, please!
64 1 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 1 STDOUT->autoflush( 1 );
66  
67 # import some stuff
68 1 ▶use Socket qw( INADDR_ANY sockaddr_in );
Subroutine BEGIN: called CC=1 SCAR=0.0
69  
70 # we need to compare versions
71 1 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 # load our utility stuff
74 1 ▶use POE::Devel::Benchmarker::Utils qw( loop2realversion poeloop2load currentMetrics );
Subroutine BEGIN: called CC=1 SCAR=0.0
75  
76 # init our global variables ( bad, haha )
77 1 my( $eventloop, $asserts, $lite_tests, $pocosession );
78  
79 # setup our metrics and their data
80 1 my %metrics = map { $_ => undef } @{ currentMetrics() };
81  
82 # the main routine which will load everything + start
83 0 ▶sub benchmark {
Subroutine benchmark: not called CC=1 SCAR=6.9
Pod undocumented
84 # process the eventloop
85 0 process_eventloop();
86  
87 # process the assertions
88 0 process_assertions();
89  
90 # process the test mode
91 0 process_testmode();
92  
93 # process the XS::Queue hiding
94 0 process_xsqueue();
95  
96 # actually import POE!
97 0 process_POE();
98  
99 # actually run the benchmarks!
100 0 run_benchmarks();
101  
102 # all done!
103 0 return;
104 }
105  
106 0 ▶sub process_eventloop {
Subroutine process_eventloop: not called CC=4 SCAR=30.0
Pod undocumented
107 # Get the desired mode
108 0 $eventloop = $ARGV[0];
109  
110 # print out the loop info
111 0 ▶ if ( ! defined $eventloop ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $eventloop) { } 0 0 0
112 0 die "Please supply an event loop!";
113 } else {
114 0 my $loop = poeloop2load( $eventloop );
115 0 ▶ if ( ! defined $loop ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $loop) 0 0 0
116 0 $loop = $eventloop;
117 }
118 0 my $v = loop2realversion( $eventloop );
119 0 ▶ if ( ! defined $v ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $v) 0 0 0
120 0 $v = 'UNKNOWN';
121 }
122 0 print "Using master loop: $loop-$v\n";
123 }
124  
125 0 return;
126 }
127  
128 0 ▶sub process_assertions {
Subroutine process_assertions: not called CC=3 SCAR=24.8
Pod undocumented
129 # Get the desired assert mode
130 0 $asserts = $ARGV[1];
131  
132 0 ▶ if ( defined $asserts and $asserts ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $asserts and $asserts) { } 0 0 0
Condition0%0/3
defined $asserts and $asserts
!ll&&!rl&&r
000
MC/DC0%0/2
defined $asserts and $asserts
defined $asserts $asserts
Truth table0%0/3
A and B
A= defined $assertsB= $asserts
ABresult
0X0
100
111
133 0 print "Using FULL Assertions!\n";
134 } else {
135 0 print "Using NO Assertions!\n";
136 }
137  
138 0 return;
139 }
140  
141 0 ▶sub process_testmode {
Subroutine process_testmode: not called CC=9 SCAR=45.0
Pod undocumented
142 # get the desired test mode
143 0 $lite_tests = $ARGV[2];
144  
145 # setup most of the metrics
146 0 $metrics{'startups'} = 10;
147  
148 # event tests
149 0 foreach my $s ( qw( posts dispatches calls single_posts ) ) {
150 0 $metrics{ $s } = 10_000;
151 }
152  
153 # session tests
154 0 foreach my $s ( qw( session_creates session_destroys ) ) {
155 0 $metrics{ $s } = 500;
156 }
157  
158 # alarm tests
159 0 foreach my $s ( qw( alarms alarm_adds alarm_clears ) ) {
160 0 $metrics{ $s } = 10_000;
161 }
162  
163 # select tests
164 0 foreach my $s ( qw( select_read_STDIN select_write_STDIN select_read_MYFH select_write_MYFH ) ) {
165 0 $metrics{ $s } = 10_000;
166 }
167  
168 # socket tests
169 0 foreach my $s ( qw( socket_connects socket_stream ) ) {
170 0 $metrics{ $s } = 1_000;
171 }
172  
173 0 ▶ if ( defined $lite_tests and $lite_tests ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $lite_tests and $lite_tests) { } 0 0 0
Condition0%0/3
defined $lite_tests and $lite_tests
!ll&&!rl&&r
000
MC/DC0%0/2
defined $lite_tests and $lite_tests
defined $lite_tests $lite_tests
Truth table0%0/3
A and B
A= defined $lite_testsB= $lite_tests
ABresult
0X0
100
111
174 0 print "Using the LITE tests\n";
175 } else {
176 0 print "Using the HEAVY tests\n";
177  
178 # we simply multiply each metric by 10x
179 0 foreach my $s ( @{ currentMetrics() } ) {
180 0 $metrics{ $s } = $metrics{ $s } * 10;
181 }
182 }
183  
184 0 return;
185 }
186  
187 0 ▶sub process_xsqueue {
Subroutine process_xsqueue: not called CC=3 SCAR=24.8
Pod undocumented
188 # should we "hide" XS::Queue::Array?
189 0 ▶ if ( defined $ARGV[3] and $ARGV[3] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ARGV[3] and $ARGV[3]) { } 0 0 0
Condition0%0/3
defined $ARGV[3] and $ARGV[3]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ARGV[3] and $ARGV[3]
defined $ARGV[3] $ARGV[3]
Truth table0%0/3
A and B
A= defined $ARGV[3]B= $ARGV[3]
ABresult
0X0
100
111
190 0 print "DISABLING POE::XS::Queue::Array\n";
191 } else {
192 0 print "LETTING POE find POE::XS::Queue::Array\n";
193 }
194  
195 0 return;
196 }
197  
198 0 ▶sub process_POE {
Subroutine process_POE: not called CC=4 SCAR=30.0
Pod undocumented
199 # Print the POE info
200 0 print "Using POE-" . $POE::VERSION . "\n";
201  
202 # Actually print what loop POE is using
203 0 foreach my $m ( keys %INC ) {
204 0 ▶ if ( $m =~ /^POE\/(?:Loop|XS|Queue)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m =~ m[^POE/(?:Loop|XS|Queue)]) 0 0 0
205 # try to be smart and get version?
206 0 my $module = $m;
207 0 $module =~ s|/|::|g;
208 0 $module =~ s/\.pm$//g;
209 0 print "POE is using: $module ";
210 0 ▶ if ( defined $module->VERSION ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $module->VERSION) { } 0 0 0
211 0 print "v" . $module->VERSION . "\n";
212 } else {
213 0 print "vUNKNOWN\n";
214 }
215 }
216 }
217  
218 0 return;
219 }
220  
221 0 ▶sub run_benchmarks {
Subroutine run_benchmarks: not called CC=1 SCAR=6.9
Pod undocumented
222 # dump some misc info
223 0 dump_perlinfo();
224 0 dump_sysinfo();
225  
226 # run the startup test before we actually run POE
227 0 bench_startup();
228  
229 # load the POE session + do the tests there
230 0 bench_poe();
231  
232 # okay, dump our memory usage
233 0 dump_pidinfo();
234  
235 # all done!
236 0 return;
237 }
238  
239 0 ▶sub bench_startup {
Subroutine bench_startup: not called CC=3 SCAR=24.8
Pod undocumented
240 # Add the eventloop?
241 0 my $looploader = poeloop2load( $eventloop );
242  
243 0 my @start_times = times();
244 0 my $start = time();
245 0 ▶ for (my $i = 0; $i < $metrics{'startups'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"startups"}) 0 0 0
246 # FIXME should we add assertions?
247  
248 # finally, fire it up!
249 0 ▶ CORE::system(
Branch: 1 branch
BranchTrueFalseTotal
defined $looploader ? : 0 0 0
250 $^X,
251 '-Ipoedists/POE-' . $POE::VERSION,
252 '-Ipoedists/POE-' . $POE::VERSION . '/lib',
253 ( defined $looploader ? "-M$looploader" : () ),
254 '-MPOE',
255 '-e',
256 1,
257 );
258 }
259 0 my @end_times = times();
260 0 my $elapsed = time() - $start;
261 0 printf( "\n\n% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'startups'}, 'startups', $elapsed, $metrics{'startups'}/$elapsed );
262 0 print "startups times: @start_times @end_times\n";
263  
264 0 return;
265 }
266  
267 0 ▶sub bench_poe {
Subroutine bench_poe: not called CC=3 SCAR=24.8
Pod undocumented
268 # figure out POE::Session->create or POE::Session->new or what?
269 0 $pocosession = POE::Session->can( 'create' );
270 0 ▶ if ( defined $pocosession ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pocosession) { } 0 0 0
271 0 $pocosession = 'create';
272 } else {
273 0 $pocosession = POE::Session->can( 'spawn' );
274 0 ▶ if ( defined $pocosession ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pocosession) { } 0 0 0
275 0 $pocosession = 'spawn';
276 } else {
277 0 $pocosession = 'new';
278 }
279 }
280  
281 # create the master sesssion + run POE!
282 0 POE::Session->$pocosession(
283 'inline_states' => {
284 # basic POE states
285 '_start' => \&poe__start,
286 '_default' => \&poe__default,
287 '_stop' => \&poe__stop,
288 'null' => \&poe_null,
289  
290 # our test states
291 'posts' => \&poe_posts,
292 'posts_start' => \&poe_posts_start,
293 'posts_end' => \&poe_posts_end,
294  
295 'alarms' => \&poe_alarms,
296 'manyalarms' => \&poe_manyalarms,
297  
298 'sessions' => \&poe_sessions,
299 'sessions_end' => \&poe_sessions_end,
300  
301 'stdin_read' => \&poe_stdin_read,
302 'stdin_write' => \&poe_stdin_write,
303 'myfh_read' => \&poe_myfh_read,
304 'myfh_write' => \&poe_myfh_write,
305  
306 'calls' => \&poe_calls,
307  
308 'eventsquirt' => \&poe_eventsquirt,
309 'eventsquirt_done' => \&poe_eventsquirt_done,
310  
311 'socketfactory' => \&poe_socketfactory,
312 'socketfactory_start' => \&poe_socketfactory_start,
313 'socketfactory_connects' => \&poe_socketfactory_connects,
314 'socketfactory_stream' => \&poe_socketfactory_stream,
315 'socketfactory_cleanup' => \&poe_socketfactory_cleanup,
316  
317 # misc states for test stuff
318 'server_sf_connect' => \&poe_server_sf_connect,
319 'server_sf_failure' => \&poe_server_sf_failure,
320 'server_rw_input' => \&poe_server_rw_input,
321 'server_rw_error' => \&poe_server_rw_error,
322  
323 'client_sf_connect' => \&poe_client_sf_connect,
324 'client_sf_failure' => \&poe_client_sf_failure,
325 'client_rw_input' => \&poe_client_rw_input,
326 'client_rw_error' => \&poe_client_rw_error,
327 },
328 );
329  
330 # start the kernel!
331 0 POE::Kernel->run();
332  
333 0 return;
334 }
335  
336 # inits our session
337 0 ▶sub poe__start {
Subroutine poe__start: not called CC=1 SCAR=6.9
Pod undocumented
338 # fire off the first test!
339 0 $_[KERNEL]->yield( 'posts' );
340  
341 0 return;
342 }
343  
344 0 ▶sub poe__stop {
Subroutine poe__stop: not called CC=1 SCAR=0.0
Pod undocumented
345 }
346  
347 0 ▶sub poe__default {
Subroutine poe__default: not called CC=1 SCAR=6.9
Pod undocumented
348 0 return 0;
349 }
350  
351 # a state that does nothing
352 0 ▶sub poe_null {
Subroutine poe_null: not called CC=1 SCAR=6.9
Pod undocumented
353 0 return 1;
354 }
355  
356 # How many posts per second? Post a bunch of events, keeping track of the time it takes.
357 0 ▶sub poe_posts {
Subroutine poe_posts: not called CC=2 SCAR=17.9
Pod undocumented
358 0 $_[KERNEL]->yield( 'posts_start' );
359 0 my $start = time();
360 0 my @start_times = times();
361 0 ▶ for (my $i = 0; $i < $metrics{'posts'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"posts"}) 0 0 0
362 0 $_[KERNEL]->yield( 'null' );
363 }
364 0 my @end_times = times();
365 0 my $elapsed = time() - $start;
366 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'posts'}, 'posts', $elapsed, $metrics{'posts'}/$elapsed );
367 0 print "posts times: @start_times @end_times\n";
368 0 $_[KERNEL]->yield( 'posts_end' );
369  
370 0 return;
371 }
372  
373 0 ▶sub poe_posts_start {
Subroutine poe_posts_start: not called CC=1 SCAR=6.9
Pod undocumented
374 0 $_[HEAP]->{start} = time();
375 0 $_[HEAP]->{starttimes} = [ times() ];
376  
377 0 return;
378 }
379  
380 0 ▶sub poe_posts_end {
Subroutine poe_posts_end: not called CC=1 SCAR=6.9
Pod undocumented
381 0 my $elapsed = time() - $_[HEAP]->{start};
382 0 my @end_times = times();
383 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'dispatches'}, 'dispatches', $elapsed, $metrics{'dispatches'}/$elapsed );
384 0 print "dispatches times: " . join( " ", @{ $_[HEAP]->{starttimes} } ) . " @end_times\n";
385 0 $_[KERNEL]->yield( 'alarms' );
386  
387 0 return;
388 }
389  
390 # How many alarms per second? Set a bunch of alarms and find out.
391 0 ▶sub poe_alarms {
Subroutine poe_alarms: not called CC=2 SCAR=17.9
Pod undocumented
392 0 my $start = time();
393 0 my @start_times = times();
394 0 ▶ for (my $i = 0; $i < $metrics{'alarms'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"alarms"}) 0 0 0
395 0 $_[KERNEL]->alarm( whee => rand(1_000_000) );
396 }
397 0 my $elapsed = time() - $start;
398 0 my @end_times = times();
399 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'alarms'}, 'alarms', $elapsed, $metrics{'alarms'}/$elapsed );
400 0 print "alarms times: @start_times @end_times\n";
401 0 $_[KERNEL]->alarm( 'whee' => undef );
402 0 $_[KERNEL]->yield( 'manyalarms' );
403  
404 0 return;
405 }
406  
407 # How many repetitive alarms per second? Set a bunch of
408 # additional alarms and find out. Also see how quickly they can
409 # be cleared.
410 0 ▶sub poe_manyalarms {
Subroutine poe_manyalarms: not called CC=3 SCAR=24.8
Pod undocumented
411 # can this POE::Kernel support this?
412 0 ▶ if ( $_[KERNEL]->can( 'alarm_add' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[2]->can('alarm_add')) { } 0 0 0
413 0 my $start = time();
414 0 my @start_times = times();
415 0 ▶ for (my $i = 0; $i < $metrics{'alarm_adds'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"alarm_adds"}) 0 0 0
416 0 $_[KERNEL]->alarm_add( whee => rand(1_000_000) );
417 }
418 0 my $elapsed = time() - $start;
419 0 my @end_times = times();
420 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'alarm_adds'}, 'alarm_adds', $elapsed, $metrics{'alarm_adds'}/$elapsed );
421 0 print "alarm_adds times: @start_times @end_times\n";
422  
423 0 $start = time();
424 0 @start_times = times();
425 0 $_[KERNEL]->alarm( whee => undef );
426 0 $elapsed = time() - $start;
427 0 @end_times = times();
428 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'alarm_adds'}, 'alarm_clears', $elapsed, $metrics{'alarm_adds'}/$elapsed );
429 0 print "alarm_clears times: @start_times @end_times\n";
430 } else {
431 0 print "SKIPPING br0ken alarm_adds because alarm_add() NOT SUPPORTED on this version of POE\n";
432 0 print "SKIPPING br0ken alarm_clears because alarm_add() NOT SUPPORTED on this version of POE\n";
433 }
434  
435 0 $_[KERNEL]->yield( 'sessions' );
436  
437 0 return;
438 }
439  
440 # How many sessions can we create and destroy per second?
441 # Create a bunch of sessions, and track that time. Let them
442 # self-destruct, and track that as well.
443 0 ▶sub poe_sessions {
Subroutine poe_sessions: not called CC=2 SCAR=17.9
Pod undocumented
444 0 my $start = time();
445 0 my @start_times = times();
446 0 ▶ for (my $i = 0; $i < $metrics{'session_creates'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"session_creates"}) 0 0 0
447 0 ▶ POE::Session->$pocosession( 'inline_states' => { _start => sub {}, _stop => sub {}, _default => sub { return 0 } } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
448 }
449 0 my $elapsed = time() - $start;
450 0 my @end_times = times();
451 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'session_creates'}, 'session_creates', $elapsed, $metrics{'session_creates'}/$elapsed );
452 0 print "session_creates times: @start_times @end_times\n";
453  
454 0 $_[KERNEL]->yield( 'sessions_end' );
455 0 $_[HEAP]->{start} = time();
456 0 $_[HEAP]->{starttimes} = [ times() ];
457  
458 0 return;
459 }
460  
461 0 ▶sub poe_sessions_end {
Subroutine poe_sessions_end: not called CC=1 SCAR=6.9
Pod undocumented
462 0 my $elapsed = time() - $_[HEAP]->{start};
463 0 my @end_times = times();
464 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'session_creates'}, 'session_destroys', $elapsed, $metrics{'session_creates'}/$elapsed );
465 0 print "session_destroys times: " . join( " ", @{ $_[HEAP]->{starttimes} } ) . " @end_times\n";
466  
467 0 $_[KERNEL]->yield( 'stdin_read' );
468  
469 0 return;
470 }
471  
472 # How many times can we select/unselect READ a from STDIN filehandle per second?
473 0 ▶sub poe_stdin_read {
Subroutine poe_stdin_read: not called CC=5 SCAR=34.0
Pod undocumented
474 # stupid, but we have to skip those tests
475 0 ▶ if ( $eventloop eq 'Tk' or $eventloop eq 'Prima' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($eventloop eq "Tk" or $eventloop eq "Prima") 0 0 0
Condition0%0/3
$eventloop eq "Tk" or $eventloop eq "Prima"
l!l&&r!l&&!r
000
MC/DC0%0/2
$eventloop eq "Tk" or $eventloop eq "Prima"
$eventloop eq "Tk" $eventloop eq "Prima"
Truth table0%0/3
A or B
A= $eventloop eq "Tk"B= $eventloop eq "Prima"
ABresult
1X1
011
000
476 0 print "SKIPPING br0ken select_read_STDIN because eventloop doesn't work: $eventloop\n";
477 0 print "SKIPPING br0ken select_write_STDIN because eventloop doesn't work: $eventloop\n";
478 0 $_[KERNEL]->yield( 'myfh_read' );
479 0 return;
480 }
481  
482 0 my $start = time();
483 0 my @start_times = times();
484 0 eval {
485 0 ▶ for (my $i = 0; $i < $metrics{'select_read_STDIN'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"select_read_STDIN"}) 0 0 0
486 0 $_[KERNEL]->select_read( *STDIN, 'whee' );
487 0 $_[KERNEL]->select_read( *STDIN );
488 }
489 };
490 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
491 0 print "SKIPPING br0ken select_read_STDIN because FAILED: $@\n";
492 } else {
493 0 my $elapsed = time() - $start;
494 0 my @end_times = times();
495 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'select_read_STDIN'}, 'select_read_STDIN', $elapsed, $metrics{'select_read_STDIN'}/$elapsed );
496 0 print "select_read_STDIN times: @start_times @end_times\n";
497 }
498  
499 0 $_[KERNEL]->yield( 'stdin_write' );
500  
501 0 return;
502 }
503  
504 # How many times can we select/unselect WRITE a from STDIN filehandle per second?
505 0 ▶sub poe_stdin_write {
Subroutine poe_stdin_write: not called CC=3 SCAR=24.8
Pod undocumented
506 0 my $start = time();
507 0 my @start_times = times();
508 0 eval {
509 0 ▶ for (my $i = 0; $i < $metrics{'select_write_STDIN'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"select_write_STDIN"}) 0 0 0
510 0 $_[KERNEL]->select_write( *STDIN, 'whee' );
511 0 $_[KERNEL]->select_write( *STDIN );
512 }
513 };
514 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
515 0 print "SKIPPING br0ken select_write_STDIN because FAILED: $@\n";
516 } else {
517 0 my $elapsed = time() - $start;
518 0 my @end_times = times();
519 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'select_write_STDIN'}, 'select_write_STDIN', $elapsed, $metrics{'select_write_STDIN'}/$elapsed );
520 0 print "select_write_STDIN times: @start_times @end_times\n";
521 }
522  
523 0 $_[KERNEL]->yield( 'myfh_read' );
524  
525 0 return;
526 }
527  
528 # How many times can we select/unselect READ a real filehandle?
529 0 ▶sub poe_myfh_read {
Subroutine poe_myfh_read: not called CC=9 SCAR=45.0
Pod undocumented
530 # stupid, but we have to skip those tests
531 0 ▶ if ( $eventloop eq 'Event_Lib' or $eventloop eq 'Tk' or $eventloop eq 'Prima' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($eventloop eq "Event_Lib" or $eventloop eq "Tk" or $eventloop eq "Prima") 0 0 0
Condition0%0/6
$eventloop eq "Event_Lib" or $eventloop eq "Tk" or $eventloop eq "Prima"
l!l&&r!l&&!r
000
$eventloop eq "Event_Lib" or $eventloop eq "Tk"
l!l&&r!l&&!r
000
MC/DC0%0/3
$eventloop eq "Event_Lib" or $eventloop eq "Tk" or $eventloop eq "Prima"
$eventloop eq "Event_Lib" $eventloop eq "Tk" $eventloop eq "Prima"
Truth table0%0/4
A or B or C
A= $eventloop eq "Event_Lib"B= $eventloop eq "Tk"C= $eventloop eq "Prima"
ABCresult
1XX1
01X1
0011
0000
532 0 print "SKIPPING br0ken select_read_MYFH because eventloop doesn't work: $eventloop\n";
533 0 print "SKIPPING br0ken select_write_MYFH because eventloop doesn't work: $eventloop\n";
534 0 $_[KERNEL]->yield( 'calls' );
535 0 return;
536 }
537  
538 0 my $start = time();
539 0 my @start_times = times();
540 0 eval {
541 0 ▶ open( my $fh, '+>', 'poebench' ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "+>", "poebench" or die $! 0 0 0
542 0 ▶ for (my $i = 0; $i < $metrics{'select_read_MYFH'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"select_read_MYFH"}) 0 0 0
543 0 $_[KERNEL]->select_read( $fh, 'whee' );
544 0 $_[KERNEL]->select_read( $fh );
545 }
546 0 ▶ close( $fh ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die $! 0 0 0
547 0 ▶ unlink( 'poebench' ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
unlink "poebench" or die $! 0 0 0
548 };
549 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
550 0 print "SKIPPING br0ken select_read_MYFH because FAILED: $@\n";
551 } else {
552 0 my $elapsed = time() - $start;
553 0 my @end_times = times();
554 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'select_read_MYFH'}, 'select_read_MYFH', $elapsed, $metrics{'select_read_MYFH'}/$elapsed );
555 0 print "select_read_MYFH times: @start_times @end_times\n";
556 }
557  
558 0 $_[KERNEL]->yield( 'myfh_write' );
559  
560 0 return;
561 }
562  
563 # How many times can we select/unselect WRITE a real filehandle?
564 0 ▶sub poe_myfh_write {
Subroutine poe_myfh_write: not called CC=6 SCAR=37.4
Pod undocumented
565 0 my $start = time();
566 0 my @start_times = times();
567 0 eval {
568 0 ▶ open( my $fh, '+>', 'poebench' ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "+>", "poebench" or die $! 0 0 0
569 0 ▶ for (my $i = 0; $i < $metrics{'select_write_MYFH'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"select_write_MYFH"}) 0 0 0
570 0 $_[KERNEL]->select_write( $fh, 'whee' );
571 0 $_[KERNEL]->select_write( $fh );
572 }
573 0 ▶ close( $fh ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die $! 0 0 0
574 0 ▶ unlink( 'poebench' ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
unlink "poebench" or die $! 0 0 0
575 };
576 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
577 0 print "SKIPPING br0ken select_write_MYFH because FAILED: $@\n";
578 } else {
579 0 my $elapsed = time() - $start;
580 0 my @end_times = times();
581 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'select_write_MYFH'}, 'select_write_MYFH', $elapsed, $metrics{'select_write_MYFH'}/$elapsed );
582 0 print "select_write_MYFH times: @start_times @end_times\n";
583 }
584  
585 0 $_[KERNEL]->yield( 'calls' );
586  
587 0 return;
588 }
589  
590 # How many times can we call a state?
591 0 ▶sub poe_calls {
Subroutine poe_calls: not called CC=2 SCAR=17.9
Pod undocumented
592 0 my $start = time();
593 0 my @start_times = times();
594 0 ▶ for (my $i = 0; $i < $metrics{'calls'}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $metrics{"calls"}) 0 0 0
595 0 $_[KERNEL]->call( $_[SESSION], 'null' );
596 }
597 0 my $elapsed = time() - $start;
598 0 my @end_times = times();
599 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'calls'}, 'calls', $elapsed, $metrics{'calls'}/$elapsed );
600 0 print "calls times: @start_times @end_times\n";
601  
602 0 $_[KERNEL]->yield( 'eventsquirt' );
603  
604 0 return;
605 }
606  
607 # How many events can we squirt through POE, one at a time?
608 0 ▶sub poe_eventsquirt {
Subroutine poe_eventsquirt: not called CC=1 SCAR=6.9
Pod undocumented
609 0 $_[HEAP]->{start} = time();
610 0 $_[HEAP]->{starttimes} = [ times() ];
611 0 $_[HEAP]->{yield_count} = $metrics{'single_posts'};
612 0 $_[KERNEL]->yield( 'eventsquirt_done' );
613  
614 0 return;
615 }
616  
617 0 ▶sub poe_eventsquirt_done {
Subroutine poe_eventsquirt_done: not called CC=2 SCAR=17.9
Pod undocumented
618 0 ▶ if (--$_[HEAP]->{yield_count}) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$_[3]{'yield_count'}) { } 0 0 0
619 0 $_[KERNEL]->yield( 'eventsquirt_done' );
620 } else {
621 0 my $elapsed = time() - $_[HEAP]->{start};
622 0 my @end_times = times();
623 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'single_posts'}, 'single_posts', $elapsed, $metrics{'single_posts'}/$elapsed );
624 0 print "single_posts times: " . join( " ", @{ $_[HEAP]->{starttimes} } ) . " @end_times\n";
625  
626 0 $_[KERNEL]->yield( 'socketfactory' );
627 }
628  
629 0 return;
630 }
631  
632 # tests socketfactory interactions
633 0 ▶sub poe_socketfactory {
Subroutine poe_socketfactory: not called CC=2 SCAR=17.9
Pod undocumented
634 # POE transitioned between Event to State on 0.19 for SocketFactory/ReadWrite
635 # 0.20+ throws deprecation error :(
636 0 $_[HEAP]->{'POE_naming'} = 'Event';
637 0 ▶ if ( version->new( $POE::VERSION ) < version->new( '0.20' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("version"->new($POE::VERSION) < "version"->new("0.20")) 0 0 0
638 0 $_[HEAP]->{'POE_naming'} = 'State';
639 }
640  
641 # create the socketfactory server
642 $_[HEAP]->{'SF'} = POE::Wheel::SocketFactory->new(
643 'Port' => INADDR_ANY,
644 'Address' => 'localhost',
645 'Reuse' => 'yes',
646  
647 'Success' . $_[HEAP]->{'POE_naming'} => 'server_sf_connect',
648 0 'Failure' . $_[HEAP]->{'POE_naming'} => 'server_sf_failure',
649 );
650  
651 # be evil, and get the port for the client to connect to
652 0 ( $_[HEAP]->{'SF_port'}, undef ) = sockaddr_in( getsockname( $_[HEAP]->{'SF'}->[ POE::Wheel::SocketFactory::MY_SOCKET_HANDLE() ] ) );
653  
654 # start the connect tests
655 0 $_[HEAP]->{'SF_counter'} = $metrics{'socket_connects'};
656 0 $_[HEAP]->{'SF_mode'} = 'socket_connects';
657 0 $_[HEAP]->{'start'} = time();
658 0 $_[HEAP]->{'starttimes'} = [ times() ];
659 0 $_[KERNEL]->yield( 'socketfactory_connects' );
660  
661 0 return;
662 }
663  
664 # handles SocketFactory connection
665 0 ▶sub poe_server_sf_connect {
Subroutine poe_server_sf_connect: not called CC=3 SCAR=24.8
Pod undocumented
666 # what test mode?
667 0 ▶ if ( $_[HEAP]->{'SF_mode'} eq 'socket_connects' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[3]{'SF_mode'} eq 'socket_connects') { } 0 0 0
elsif ($_[3]{'SF_mode'} eq 'socket_stream') { } 0 0 0
668 # simply discard this socket
669 } elsif ( $_[HEAP]->{'SF_mode'} eq 'socket_stream' ) {
670 # convert it to ReadWrite
671 my $wheel = POE::Wheel::ReadWrite->new(
672 'Handle' => $_[ARG0],
673 'Filter' => POE::Filter::Line->new,
674 'Driver' => POE::Driver::SysRW->new,
675  
676 'Input' . $_[HEAP]->{'POE_naming'} => 'server_rw_input',
677 0 'Error' . $_[HEAP]->{'POE_naming'} => 'server_rw_error',
678 );
679  
680 # save it in our heap
681 0 $_[HEAP]->{'RW'}->{ $wheel->ID } = $wheel;
682 } else {
683 0 die "unknown test mode";
684 }
685  
686 0 return;
687 }
688  
689 # handles SocketFactory errors
690 0 ▶sub poe_server_sf_failure {
Subroutine poe_server_sf_failure: not called CC=1 SCAR=6.9
Pod undocumented
691 # ARGH, we couldnt create listening socket
692 0 print "SKIPPING br0ken socket_connects because we were unable to setup listening socket\n";
693 0 print "SKIPPING br0ken socket_stream because we were unable to setup listening socket\n";
694  
695 0 $_[KERNEL]->yield( 'socketfactory_cleanup' );
696  
697 0 return;
698 }
699  
700 # handles ReadWrite input
701 0 ▶sub poe_server_rw_input {
Subroutine poe_server_rw_input: not called CC=3 SCAR=24.8
Pod undocumented
702 # what test mode?
703 0 ▶ if ( $_[HEAP]->{'SF_mode'} eq 'socket_connects' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[3]{'SF_mode'} eq 'socket_connects') { } 0 0 0
elsif ($_[3]{'SF_mode'} eq 'socket_stream') { } 0 0 0
704 # simply discard this data
705 } elsif ( $_[HEAP]->{'SF_mode'} eq 'socket_stream' ) {
706 # send it back to the client!
707 0 $_[HEAP]->{'RW'}->{ $_[ARG1] }->put( $_[ARG0] );
708 } else {
709 0 die "unknown test mode";
710 }
711  
712 0 return;
713 }
714  
715 # handles ReadWrite disconnects
716 0 ▶sub poe_server_rw_error {
Subroutine poe_server_rw_error: not called CC=2 SCAR=17.9
Pod undocumented
717 # simply get rid of the wheel
718 0 ▶ if ( exists $_[HEAP]->{'RW'}->{ $_[ARG3] } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[3]{"RW"}{$_[13]}) 0 0 0
719 # FIXME do we need this?
720 0 eval {
721 0 $_[HEAP]->{'RW'}->{ $_[ARG3] }->shutdown_input;
722 0 $_[HEAP]->{'RW'}->{ $_[ARG3] }->shutdown_output;
723 };
724  
725 0 delete $_[HEAP]->{'RW'}->{ $_[ARG3] };
726 }
727  
728 0 return;
729 }
730  
731 # starts the client connect tests
732 0 ▶sub poe_socketfactory_connects {
Subroutine poe_socketfactory_connects: not called CC=2 SCAR=17.9
Pod undocumented
733 0 ▶ if (--$_[HEAP]->{'SF_counter'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$_[3]{'SF_counter'}) { } 0 0 0
734 # open a new client connection!
735 $_[HEAP]->{'client_SF'} = POE::Wheel::SocketFactory->new(
736 'RemoteAddress' => 'localhost',
737 'RemotePort' => $_[HEAP]->{'SF_port'},
738  
739 'Success' . $_[HEAP]->{'POE_naming'} => 'client_sf_connect',
740 0 'Failure' . $_[HEAP]->{'POE_naming'} => 'client_sf_failure',
741 );
742 } else {
743 0 my $elapsed = time() - $_[HEAP]->{start};
744 0 my @end_times = times();
745 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'socket_connects'}, 'socket_connects', $elapsed, $metrics{'socket_connects'}/$elapsed );
746 0 print "socket_connects times: " . join( " ", @{ $_[HEAP]->{starttimes} } ) . " @end_times\n";
747  
748 0 $_[KERNEL]->yield( 'socketfactory_stream' );
749 }
750  
751 0 return;
752 }
753  
754 # starts the client stream tests
755 0 ▶sub poe_socketfactory_stream {
Subroutine poe_socketfactory_stream: not called CC=1 SCAR=6.9
Pod undocumented
756 # set the proper test mode
757 0 $_[HEAP]->{'SF_mode'} = 'socket_stream';
758  
759 # open a new client connection!
760 $_[HEAP]->{'client_SF'} = POE::Wheel::SocketFactory->new(
761 'RemoteAddress' => 'localhost',
762 'RemotePort' => $_[HEAP]->{'SF_port'},
763  
764 'Success' . $_[HEAP]->{'POE_naming'} => 'client_sf_connect',
765 0 'Failure' . $_[HEAP]->{'POE_naming'} => 'client_sf_failure',
766 );
767  
768 0 return;
769 }
770  
771 # the client connected to the server!
772 0 ▶sub poe_client_sf_connect {
Subroutine poe_client_sf_connect: not called CC=3 SCAR=24.8
Pod undocumented
773 # what test mode?
774 0 ▶ if ( $_[HEAP]->{'SF_mode'} eq 'socket_connects' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[3]{'SF_mode'} eq 'socket_connects') { } 0 0 0
elsif ($_[3]{'SF_mode'} eq 'socket_stream') { } 0 0 0
775 # simply discard this connection
776 0 delete $_[HEAP]->{'client_SF'};
777  
778 # make another connection!
779 0 $_[KERNEL]->yield( 'socketfactory_connects' );
780 } elsif ( $_[HEAP]->{'SF_mode'} eq 'socket_stream' ) {
781 # convert it to ReadWrite
782 my $wheel = POE::Wheel::ReadWrite->new(
783 'Handle' => $_[ARG0],
784 'Filter' => POE::Filter::Line->new,
785 'Driver' => POE::Driver::SysRW->new,
786  
787 'Input' . $_[HEAP]->{'POE_naming'} => 'client_rw_input',
788 0 'Error' . $_[HEAP]->{'POE_naming'} => 'client_rw_error',
789 );
790  
791 # save it in our heap
792 0 $_[HEAP]->{'client_RW'}->{ $wheel->ID } = $wheel;
793  
794 # begin the STREAM test!
795 0 $_[HEAP]->{'SF_counter'} = $metrics{'socket_stream'};
796 0 $_[HEAP]->{'SF_data'} = 'x' x ( $metrics{'socket_stream'} / 10 ); # set a reasonable-sized chunk of data
797 0 $_[HEAP]->{'start'} = time();
798 0 $_[HEAP]->{'starttimes'} = [ times() ];
799  
800 0 $wheel->put( $_[HEAP]->{'SF_data'} );
801 } else {
802 0 die "unknown test mode";
803 }
804  
805 0 return;
806 }
807  
808 # handles SocketFactory errors
809 0 ▶sub poe_client_sf_failure {
Subroutine poe_client_sf_failure: not called CC=3 SCAR=24.8
Pod undocumented
810 # ARGH, we couldnt create connecting socket
811 0 ▶ if ( $_[HEAP]->{'SF_mode'} eq 'socket_connects' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[3]{'SF_mode'} eq 'socket_connects') { } 0 0 0
elsif ($_[3]{'SF_mode'} eq 'socket_stream') { } 0 0 0
812 0 print "SKIPPING br0ken socket_connects because we were unable to setup connecting socket\n";
813  
814 # go to stream test
815 0 $_[KERNEL]->yield( 'socketfactory_stream' );
816 } elsif ( $_[HEAP]->{'SF_mode'} eq 'socket_stream' ) {
817 0 print "SKIPPING br0ken socket_stream because we were unable to setup connecting socket\n";
818  
819 0 $_[KERNEL]->yield( 'socketfactory_cleanup' );
820 }
821  
822 0 return;
823 }
824  
825 # handles ReadWrite input
826 0 ▶sub poe_client_rw_input {
Subroutine poe_client_rw_input: not called CC=2 SCAR=17.9
Pod undocumented
827 0 ▶ if (--$_[HEAP]->{'SF_counter'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$_[3]{'SF_counter'}) { } 0 0 0
828 # send it back to the server!
829 0 $_[HEAP]->{'client_RW'}->{ $_[ARG1] }->put( $_[ARG0] );
830 } else {
831 0 my $elapsed = time() - $_[HEAP]->{start};
832 0 my @end_times = times();
833 0 printf( "% 9d %-20.20s in % 9.3f seconds (% 11.3f per second)\n", $metrics{'socket_stream'}, 'socket_stream', $elapsed, $metrics{'socket_stream'}/$elapsed );
834 0 print "socket_stream times: " . join( " ", @{ $_[HEAP]->{starttimes} } ) . " @end_times\n";
835  
836 0 $_[KERNEL]->yield( 'socketfactory_cleanup' );
837  
838 }
839  
840 0 return;
841 }
842  
843 # handles ReadWrite disconnect
844 0 ▶sub poe_client_rw_error {
Subroutine poe_client_rw_error: not called CC=2 SCAR=17.9
Pod undocumented
845 # simply get rid of the wheel
846 0 ▶ if ( exists $_[HEAP]->{'client_RW'}->{ $_[ARG3] } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[3]{"client_RW"}{$_[13]}) 0 0 0
847 # FIXME do we need this?
848 0 eval {
849 0 $_[HEAP]->{'client_RW'}->{ $_[ARG3] }->shutdown_input;
850 0 $_[HEAP]->{'client_RW'}->{ $_[ARG3] }->shutdown_output;
851 };
852  
853 0 delete $_[HEAP]->{'client_RW'}->{ $_[ARG3] };
854 }
855  
856 0 return;
857 }
858  
859 # all done with the socketfactory tests
860 0 ▶sub poe_socketfactory_cleanup {
Subroutine poe_socketfactory_cleanup: not called CC=5 SCAR=34.0
Pod undocumented
861 # do cleanup
862 0 ▶ delete $_[HEAP]->{'SF'} if exists $_[HEAP]->{'SF'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[3]{"SF"} 0 0 0
863 0 ▶ delete $_[HEAP]->{'RW'} if exists $_[HEAP]->{'RW'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[3]{"RW"} 0 0 0
864 0 ▶ delete $_[HEAP]->{'client_SF'} if exists $_[HEAP]->{'client_SF'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[3]{"client_SF"} 0 0 0
865 0 ▶ delete $_[HEAP]->{'client_RW'} if exists $_[HEAP]->{'client_RW'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $_[3]{"client_RW"} 0 0 0
866  
867 # XXX all done with tests!
868 0 return;
869 }
870  
871 # Get the memory footprint
872 0 ▶sub dump_pidinfo {
Subroutine dump_pidinfo: not called CC=5 SCAR=34.0
Pod undocumented
873 0 my $ret = open( my $fh, '<', '/proc/self/status' );
874 0 ▶ if ( defined $ret ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ret) { } 0 0 0
875 0 ▶ while ( <$fh> ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
876 0 chomp;
877 0 ▶ if ( $_ ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 0 0
878 0 print "pidinfo: $_\n";
879 }
880 }
881 0 ▶ close( $fh ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die $! 0 0 0
882 } else {
883 0 print "UNABLE TO GET /proc/self/status\n";
884 }
885  
886 0 return;
887 }
888  
889 # print the local Perl info
890 0 ▶sub dump_perlinfo {
Subroutine dump_perlinfo: not called CC=2 SCAR=17.9
Pod undocumented
891 0 print "Running under perl binary: '" . $^X . "' v" . sprintf( "%vd", $^V ) . "\n";
892  
893 0 require Config;
894 0 my $config = Config::myconfig();
895 0 foreach my $l ( split( /\n/, $config ) ) {
896 0 print "perlconfig: $l\n";
897 }
898  
899 0 return;
900 }
901  
902 # print the local system information
903 0 ▶sub dump_sysinfo {
Subroutine dump_sysinfo: not called CC=5 SCAR=34.0
Pod undocumented
904 0 print "Running under machine: " . `uname -a` . "\n";
905  
906 # get cpuinfo
907 0 my $ret = open( my $fh, '<', '/proc/cpuinfo' );
908 0 ▶ if ( defined $ret ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ret) { } 0 0 0
909 0 ▶ while ( <$fh> ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
910 0 chomp;
911 0 ▶ if ( $_ ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 0 0
912 0 print "cpuinfo: $_\n";
913 }
914 }
915 0 ▶ close( $fh ) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
close $fh or die $! 0 0 0
916 } else {
917 0 print "UNABLE TO GET /proc/cpuinfo\n";
918 }
919  
920 0 return;
921 }
922  
923 1 1;
924 __END__
« Benchmarker/Utils.pm ↑ Summary Benchmarker/GetInstalledLoops.pm »