{
boolean success = false;
try
{
PerformanceLogger perfLogger = new PerformanceLogger( classname + PERF_DATA_PREFIX );
perfLogger.setXAxisLabel("Number of Threads");
perfLogger.setYAxisLabel("Tx/sec");
System.out.println("Threads from "+getMinimumNumberOfThreads()+" to "+getMaximumNumberOfThreads());
for (int threadCount=getMinimumNumberOfThreads();threadCount<=getMaximumNumberOfThreads();threadCount++)
{
PerformanceTest perfTest = (PerformanceTest)Thread.currentThread().getContextClassLoader().loadClass( classname ).newInstance();
perfTest.setServiceConfigs( configs );
perfTest.setParameters( _args );
PerformanceTestRunnerThread[] pRunner = new PerformanceTestRunnerThread[threadCount];
long startTimeForThreadSet= System.currentTimeMillis();
for (int count=0;count<threadCount;count++)
{
pRunner[count] = new PerformanceTestRunnerThread( perfTest, getNumberOfIterations() );
pRunner[count].start();
}
for (int count=0;count<threadCount;count++)
{
pRunner[count].join();
success &= pRunner[count].success();
}
long endTimeForThreadSet= System.currentTimeMillis();
long timeTaken = endTimeForThreadSet - startTimeForThreadSet;
long numberOfTransactions = getNumberOfIterations()*threadCount;
System.out.println( threadCount +" \t\t "+timeTaken+" \t\t"+(float) (numberOfTransactions/(timeTaken / 1000.0))+"\t\t"+numberOfTransactions);
double dataX, dataY;
switch ( _xDataToLog )
{
case NUMBER_OF_TRANSACTIONS :
{
dataX = numberOfTransactions;
break;
}
case NUMBER_OF_THREADS :
default:
{
dataX = threadCount;
break;
}
}
switch ( _yDataToLog )
{
case TIME_TAKEN :
{
dataY = timeTaken;
break;
}
case TRANSACTIONS_PER_SECOND :
default:
{
dataY = (numberOfTransactions/(timeTaken / 1000.0));
break;
}
}
perfLogger.addData( dataX, dataY );
}
perfLogger.output(System.err);
if ( _csvFilename != null )
{
generateCSV(_csvFilename, perfLogger);
}