#!/usr/local/bin/perl

$| = 1;

$port = 8080;
$trials    =   5;
@targets   = ( "soco.lcs.mit.edu" ) ;
@durations = ( 0.2 );
@windows   = (  10, 20, 50 );



foreach $target ( @targets ) {
    foreach $duration ( @durations ) {
	foreach $window ( @windows ) {
	    print "Duration: $duration sec  Concurrency: $window  Trials: $trials\n";

	    print STDOUT "Name      bytes        usec       MB/s" 
		. "   Succ   Attm     Succ     Attm\n";
	    print STDOUT "                                      " 
		. "  plays  plays  plays/s  plays/s\n";


	    for ($trial = 0; $trial < $trials; $trial++ ) {
		system "/disk/pu0/fubob/build/devel/maxhttp_cps -n $window -t $duration -r 2 $target $port";
		
		
		while ( `netstat -n -a | grep TIME_WAIT | wc -l` > 500) {
		    sleep 5;
		}
		
	    }
	}
    }
}


