public double runWithTimeMeasurement(int timeMillis, TestCase tc, int iterations) throws Exception
{
long start = System.currentTimeMillis();
double sumTime = 0;
int count = 0;
System.err.println("test-time "+timeMillis+" iteration "+iterations);
while ( System.currentTimeMillis()-start < timeMillis )
{
double time = tc.run(transformer, serializer, value, iterations);
sumTime += time;
measurementVals[count] = time;
count++;
}
double avg = sumTime / count;
Arrays.sort(measurementVals,0,count);
System.err.println("-----------------------------------------------------------------------------");
System.err.println(serializer.getName());
System.err.println("min:" + measurementVals[0]);
System.err.println("1/4:"+measurementVals[count/4]);
System.err.println("1/2:"+measurementVals[count/2]);
System.err.println("3/4:"+measurementVals[count/4*3]);
System.err.println("max:"+measurementVals[count-1]);
System.err.println("average:"+ avg +" deviation:"+(avg-measurementVals[count/2]));
System.err.println("-----------------------------------------------------------------------------");
return avg;
}