/usr/share/doc/crossroads/examples/xr-http-test is in crossroads 2.81-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/usr/bin/perl
use strict;
use LWP::UserAgent;
use Time::HiRes qw(sleep gettimeofday tv_interval);
$|++;
die <<"ENDUSAGE" if ($#ARGV != 2);
Usage: $0 URL THREADS DURATION
Will start THREADS to get URL. The entire test will run for DURATION
seconds.
ENDUSAGE
my ($url, $threads, $duration) = @ARGV;
for my $i (1..$threads) {
next if (fork());
my $t_start = [gettimeofday()];
my $runs = 0;
while (tv_interval($t_start) < $duration) {
$runs++;
my $t_run = [gettimeofday()];
my $ua = LWP::UserAgent->new();
$ua->timeout(5);
my $resp = $ua->get($url);
print(tv_interval($t_run), "\n")
if ($resp->is_success());
}
exit(0);
}
while(wait() != -1) {
}
|