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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#!/usr/bin/perl -- # -*- perl -*-
#
###############################################################################
#
# ttcp_test.pl
#
###############################################################################
#
# Name: ttcp_test.pl
#
# Synopsis:
#
# ttcp_test.pl [test_name] [output] [max size] [host] [port]"
#
# Description:
#
# This script tests throughput performance of [test_name]
# ttcp program by sending series of 5 packets of 1K increment up
# to [max size] (1, 2, 4, 8, 16, 32, 64K, ..., [max size]) to
# the 5001@[host] server.
#
# Packet size (in Kbytes) and throughput (in Mbps) pairs are
# written in [test_name].dat file for further processing.
#
# Options:
# [test_name] - either ttcp or ttcp_crng or other compliant
# ttcp modification. The base should be ttcp.c
# for other implementations.
#
# [output] - output file name
#
# [max size] - maximum packet size in Kbytes. 64 is a good max.
#
# [host] - host where server is running.
#
# [port] - port server listening on.
#
# Author: Vladislav Grinchenko
# Date: 01/05/2000
#
###############################################################################
$usage = "USAGE: ttcp_test.pl [test_name] [data_file] [max size Kb] [host] [port]\n";
die $usage unless $#ARGV+1 == 5;
$prog = $ARGV[0];
$data = $ARGV[1];
$maxKb = $ARGV[2];
$host = $ARGV[3];
$port = $ARGV[4];
$msize = 1024;
$limit = $maxKb * 1024;
open (DATA,">$data") || die "Can't open output file: $data";
while ($msize <= $limit) {
for ($i = 1; $i <= 5; $i++) {
$Mbps = 0;
print "Iteration# ", $i, ": $prog -t -fm -s -l $msize -p $port $host";
@out = `$prog -t -fm -s -l $msize -p $port $host 2>/dev/null`;
@line = split(/[ \t\n]+/, $out[1]);
$Mbps = ($Mbps + $line[8])/2;
print " >>> Mbps: ", $Mbps, "\n";
sleep 1
}
print DATA ($msize/1024, " ", $Mbps,"\n");
print ("--------------------------------------\n");
$msize = $msize * 2;
}
close DATA;
|