Add the TestPerformance.MAX_FILES_PER_PARSE_ITERATION configuration field

This commit is contained in:
Sam Harwell 2013-04-21 15:00:20 -05:00
parent 82f4d07243
commit f5294204ae
1 changed files with 10 additions and 0 deletions

View File

@ -111,6 +111,10 @@ public class TestPerformance extends BaseTest {
* {@link #TOP_PACKAGE}.
*/
private static final boolean RECURSIVE = true;
/**
* The maximum number of files to parse in a single iteration.
*/
private static final int MAX_FILES_PER_PARSE_ITERATION = Integer.MAX_VALUE;
/**
* {@code true} to call {@link Collections#shuffle} on the list of input
@ -445,10 +449,16 @@ public class TestPerformance extends BaseTest {
long startTime = System.currentTimeMillis();
tokenCount.set(0);
int inputSize = 0;
int inputCount = 0;
Collection<Future<Integer>> results = new ArrayList<Future<Integer>>();
ExecutorService executorService = Executors.newFixedThreadPool(NUMBER_OF_THREADS, new NumberedThreadFactory());
for (final CharStream input : sources) {
inputCount++;
if (inputCount > MAX_FILES_PER_PARSE_ITERATION) {
break;
}
input.seek(0);
inputSize += input.size();
Future<Integer> futureChecksum = executorService.submit(new Callable<Integer>() {