- Timestamp:
- Mar 6, 2014 6:19:23 PM (11 years ago)
- Branches:
- master
- Children:
- 3813e29
- Parents:
- 45d3453
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/httpbench.pl
r45d3453 r178d578 17 17 'c|concurrency=i' => \ my $concurrency, 18 18 'n|loops=i' => \ my $loops, 19 'd|duration=i' => \ my $duration, 19 20 'w|wait=f' => \ my $wait, 20 21 ) or usage(); … … 24 25 $concurrency ||= 1; 25 26 $loops ||= 1; 27 $duration ||= 0; 26 28 $wait ||= 0; 27 29 … … 30 32 31 33 my $num = scalar @urls; 32 warn "$num urls with $concurrency clients, $loops loops\n"; 33 warn "Total: ", $num * $concurrency * $loops, " requests\n"; 34 my $l = ($duration) ? "$duration seconds loops" : "$loops loops"; 35 warn "$num urls with $concurrency clients, $l\n"; 36 warn "Total: ", $num * $concurrency * $loops, " requests\n" if (! $duration); 34 37 warn "wait for $wait second between requests\n" if ($wait); 35 38 … … 58 61 # child 59 62 my $transfer = 0; 60 for (my $i = 0; $i < $loops; $i++) { 63 my $i = 0; 64 while (1) { 65 if ($duration) { 66 last if (time() - $startsec > $duration); 67 } 68 else { 69 last if ($i >= $loops); 70 } 71 61 72 print STDERR "processing $i/$loops loop\r"; 62 73 foreach my $url (@urls) { … … 70 81 sleep($wait); 71 82 } 83 84 $i++; 72 85 } 73 86 $pm->finish(0, \$transfer);
Note: See TracChangeset
for help on using the changeset viewer.