- Timestamp:
- Mar 6, 2014 5:38:23 PM (11 years ago)
- Branches:
- master
- Children:
- 178d578
- Parents:
- 8c96802
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/httpbench.pl
r8c96802 r45d3453 49 49 50 50 my ($startsec, $startmicro) = gettimeofday(); 51 {51 for (my $child = 0; $child < $concurrency; $child++) { 52 52 use bytes; 53 for (my $child = 0; $child < $concurrency; $child++) { 54 if ($pm->start) { 55 warn "forks $child/$concurrency child ...\n"; 56 next; 53 if ($pm->start) { 54 # parent 55 warn "forks $child/$concurrency child ...\n"; 56 } 57 else { 58 # child 59 my $transfer = 0; 60 for (my $i = 0; $i < $loops; $i++) { 61 print STDERR "processing $i/$loops loop\r"; 62 foreach my $url (@urls) { 63 my $res = $ua->get($url); 64 if ($res->is_success) { 65 $transfer += length($res->content); 66 } 67 else { 68 print STDERR "\nfail: $url"; 69 } 70 sleep($wait); 71 } 57 72 } 58 my $transfer = 0;59 for (my $i = 0; $i < $loops; $i++) {60 print STDERR "processing $i/$loops loop\r";61 foreach my $url (@urls) {62 my $res = $ua->get($url);63 if ($res->is_success) {64 $transfer += length($res->content);65 }66 else {67 print STDERR "\nfail: $url";68 }69 sleep($wait);70 }71 }72 73 $pm->finish(0, \$transfer); 73 74 } 74 $pm->wait_all_children;75 75 } 76 $pm->wait_all_children; 76 77 my ($endsec, $endmicro) = gettimeofday(); 77 78 my $elapsed = ($endsec - $startsec) + ($endmicro - $startmicro) / 10**6;
Note: See TracChangeset
for help on using the changeset viewer.