in reply to using Net::Telnet to test Apache
#!/usr/bin/perl use strict; use Time::HiRes qw( time tv_interval ); use Net::Telnet (); $0 = 'ruffbench'; unless (@ARGV){ die "Usage: $0 <host> [<host2> <host3> ...]\n"; } my $port = '80'; my $t = new Net::Telnet; my $get = "GET / HTTP/1.0\n\n"; my %time; foreach my $host (@ARGV) { print "$0: Connecting to $host. Starting timer.\n"; my $start = [ time() ]; $t->open(Host=>$host, Port=>$port); print "$0: Connected to $host. Sending request...\n"; $t->print($get); print $t->waitfor(String=>"Content-Type", Timeout=>5 ); my $end = [ time() ]; $t->close; print "\n$0: Connection closed. Timer stopped.\n\n"; $time{$host} = tv_interval($start, $end); } print "$0: Summary of results:\n"; foreach my $host (@ARGV) { printf "%9s: %10s ... %2.2f seconds\n", $0, $host, $time{$host}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: using Net::Telnet to test Apache
by Fastolfe (Vicar) on Nov 14, 2000 at 03:52 UTC | |
by meonkeys (Chaplain) on Nov 14, 2000 at 07:05 UTC | |
by Fastolfe (Vicar) on Nov 14, 2000 at 07:37 UTC | |
by meonkeys (Chaplain) on Nov 14, 2000 at 07:55 UTC | |
by merlyn (Sage) on Nov 14, 2000 at 08:11 UTC | |
by AgentM (Curate) on Nov 14, 2000 at 07:24 UTC | |
by meonkeys (Chaplain) on Nov 14, 2000 at 07:51 UTC | |
by AgentM (Curate) on Nov 14, 2000 at 08:23 UTC |