X-Git-Url: http://lab.mitty.jp/git/?p=lab.git;a=blobdiff_plain;f=misc%2Fhttpbench.pl;h=fc5a218cf44c08e165a0a1b7f50100183530a37f;hp=028c6b60b63d74283afb88cfc310553863283f69;hb=d6dd05b2a2c27ab6a8a0c22fa13d95c7ad6d78d5;hpb=512faedf38a2f9da3d7d98f4806ea3d42e4db8a3 diff --git a/misc/httpbench.pl b/misc/httpbench.pl index 028c6b6..fc5a218 100755 --- a/misc/httpbench.pl +++ b/misc/httpbench.pl @@ -34,16 +34,19 @@ warn "wait for $wait second between requests\n"; my $pm = Parallel::ForkManager->new($concurrency); -for (my $i = 0; $i < $loops; $i++) { - for (my $child = 0; $child < $concurrency; $child++) { - $pm->start and next; +for (my $child = 0; $child < $concurrency; $child++) { + if ($pm->start) { + warn "forks $child/$concurrency child ...\n"; + next; + } + for (my $i = 0; $i < $loops; $i++) { + print STDERR "processing $i/$loops loop\r"; foreach my $url (@urls) { get($url) or warn "fail: $url\n"; sleep($wait); } - $pm->finish; - } - print STDERR " ... ", $num * $concurrency * ($i + 1), " requesting\r"; + } + $pm->finish; } $pm->wait_all_children;