System.out.println("Total time was " + (stop-start) + " ms for " + (double)totalBytes/(double)(stop-start) + " bytes/ms");
    public static void main(String[] args) {	RequestSet requests = null;	int clients = 2;	boolean random = false;	int runForSeconds = 60;	boolean reuseConnections = false;	int requestCount = -1;	// process arguments	for(int i = 0; i < args.length; i++) {	    // specify request file	    if (args[i].equals("-requests")) 		requests = readXmlRequestFile( args[++i] );	    // dump request file	    else if (args[i].equals("-show"))		requests.show();	    	    // set number of clients	    else if (args[i].equals("-clients"))		clients = new Integer(args[++i]).intValue();	    // randomly traverse request set;	    else if (args[i].equals("-random"))		random = true;	    // randomly traverse request set;	    else if (args[i].equals("-reuseConnections"))		reuseConnections = true;	    else if (args[i].equals("-time")) {		requestCount = -1;		runForSeconds = new Integer(args[++i]).intValue();	    }	    else if (args[i].equals("-count")) {		requestCount = new Integer(args[++i]).intValue();		runForSeconds = -1;	    }	}	// tell HTTPClient to accept cookies	CookieModule.setCookiePolicyHandler(null);	// start desired number of clieants	Worker[] workers = new Worker[ clients ];	for (int i = 0; i < clients; i++) {	    workers[i] = new Worker( requests.enumerator(random, requestCount), reuseConnections );	    workers[i].start();	}	try {	    if (runForSeconds != -1) {		Thread.currentThread().sleep( runForSeconds * 1000 );		for (int i = 0; i < clients; i++) {		    workers[i].stop( new WorkerTimeUp() );		}	    }	    for (int i = 0; i < clients; i++) {		workers[i].join();	    }	} catch (InterruptedException e) {	    System.err.println("Timing loop interrupted!");	    System.exit( -1 );	}	// gather statistics	long totalBytes = 0;	long totalLatency = 0;	int numRequests = 0;	int numVerifiedRequests = 0;	for (int i = 0; i < clients; i++) {	    totalBytes += workers[i].totalBytes;	    totalLatency += workers[i].totalLatency;	    numRequests += workers[i].numRequests;	    numVerifiedRequests += workers[i].numVerifiedRequests;	}	// check number of requests or time	if (requestCount != -1) 	    if (numRequests != requestCount*clients)		System.err.println("ERROR: got only " + numRequests +				   " pages, not the " + requestCount*clients +				   " expected");	// report statistics	System.out.println("Downloaded " + totalBytes + " bytes in " + numRequests + " requests");	System.out.println("Verified " + numVerifiedRequests + " requests");	System.out.println("Average latency of " + (double)totalLatency/(double)numRequests + " ms");    }