Skip to content

Commit

Permalink
Add forking IPC profiling script
Browse files Browse the repository at this point in the history
  • Loading branch information
exodist committed Jan 29, 2019
1 parent 7414d22 commit f269862
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions profiling/ok_test2_ipc_fork.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use strict;
use warnings;
use Test2::IPC;
use Test2::Tools::Tiny;

my $count = $ENV{OK_COUNT} || 100000;
plan($count);

my $procs = $ENV{PROC_COUNT} || 4;

$count /= $procs;

my @PIDS;

for (1 .. $procs) {
my $pid = fork();
if ($pid) { # parent;
push @PIDS => $pid;
}
else { # child
ok(1, "an ok $$") for 1 .. $count;
exit 0;
}
}

waitpid($_, 0) for @PIDS;

1;

0 comments on commit f269862

Please sign in to comment.