use of org.apache.lucene.benchmark.byTask.tasks.PerfTask in project lucene-solr by apache.
the class Algorithm method extractTasks.
private void extractTasks(ArrayList<PerfTask> extrct, TaskSequence seq) {
if (seq == null)
return;
extrct.add(seq);
ArrayList<PerfTask> t = sequence.getTasks();
if (t == null)
return;
for (final PerfTask p : t) {
if (p instanceof TaskSequence) {
extractTasks(extrct, (TaskSequence) p);
} else {
extrct.add(p);
}
}
}
use of org.apache.lucene.benchmark.byTask.tasks.PerfTask in project lucene-solr by apache.
the class TestPerfTasksParse method testParseParallelTaskSequenceRepetition.
/** Test the repetiotion parsing for parallel tasks */
public void testParseParallelTaskSequenceRepetition() throws Exception {
String taskStr = "AddDoc";
String parsedTasks = "[ " + taskStr + " ] : 1000";
Benchmark benchmark = new Benchmark(new StringReader(propPart + parsedTasks));
Algorithm alg = benchmark.getAlgorithm();
ArrayList<PerfTask> algTasks = alg.extractTasks();
boolean foundAdd = false;
for (final PerfTask task : algTasks) {
if (task.toString().indexOf(taskStr) >= 0) {
foundAdd = true;
}
if (task instanceof TaskSequence) {
assertEquals("repetions should be 1000 for " + parsedTasks, 1000, ((TaskSequence) task).getRepetitions());
assertTrue("sequence for " + parsedTasks + " should be parallel!", ((TaskSequence) task).isParallel());
}
assertTrue("Task " + taskStr + " was not found in " + alg.toString(), foundAdd);
}
}
use of org.apache.lucene.benchmark.byTask.tasks.PerfTask in project lucene-solr by apache.
the class TestPerfTasksParse method testParseTaskSequenceRepetition.
/** Test the repetiotion parsing for sequential tasks */
public void testParseTaskSequenceRepetition() throws Exception {
String taskStr = "AddDoc";
String parsedTasks = "{ " + taskStr + " } : 1000";
Benchmark benchmark = new Benchmark(new StringReader(propPart + parsedTasks));
Algorithm alg = benchmark.getAlgorithm();
ArrayList<PerfTask> algTasks = alg.extractTasks();
boolean foundAdd = false;
for (final PerfTask task : algTasks) {
if (task.toString().indexOf(taskStr) >= 0) {
foundAdd = true;
}
if (task instanceof TaskSequence) {
assertEquals("repetions should be 1000 for " + parsedTasks, 1000, ((TaskSequence) task).getRepetitions());
assertFalse("sequence for " + parsedTasks + " should be sequential!", ((TaskSequence) task).isParallel());
}
assertTrue("Task " + taskStr + " was not found in " + alg.toString(), foundAdd);
}
}
Aggregations