#!/usr/local/bin/perl

$| = 1;


$trials    =   5;
@targets   = ( "soco.lcs.mit.edu" ) ;
@durations = ( 1.8);
@windows   = (   9, 20 );

# For emacs
#@durations = ( 100 );
#@windows = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18,
#	    20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 250, 300, 400); 


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/playtrace -n $window -t $duration -r 3 $target";
		
		
		while ( `netstat -n -a | grep TIME_WAIT | wc -l` > 100) {
		    sleep 5;
		}
		
	    }
	}
    }
}


