new File("e:/javalib/xmark/gold1m/q" + q + ".out"));
}
for (int t=0; t<1000; t++) {
dqc.setContextItem(doc);
Result result = new Sink();
long start, end;
start = System.currentTimeMillis();
cuq.run(result, props);
end = System.currentTimeMillis();
runs++;
long time = (end - start);
if (time < min) min = time;
if (time > max) max = time;
totalTime += time;
if (totalTime > 30000 && t>=2) break;
}
double avg = ((double)totalTime) / runs;
String avgs = format.format(avg);
System.out.println(" <query q='" + q +
"' avg='" + avgs +
"' runs='" + runs +
"' min='" + min +
"' max='" + max + "'/>");
} catch (XPathException err) {
System.err.println("Error in test " + q);
System.err.println(err.getMessageAndLocation());
}
}
} else {
for (int q=1; q<=20; q++) {
if (test != -1 && test != q) {
continue;
}
try {
File query = new File(dir + 'q' + q + ".xq");
StaticQueryContext qenv = config.newStaticQueryContext();
qenv.setBaseURI(query.toURI().toString());
if (val) {
qenv.getExecutable().setSchemaAware(true);
}
XQueryExpression exp = qenv.compileQuery(new FileReader(query));
int runs = 0;
long totalTime = 0;
long min = Integer.MAX_VALUE;
long max = 0;
for (int t=0; t<1000; t++) {
final DynamicQueryContext context = new DynamicQueryContext(config);
context.setContextItem(doc);
Result result = new Sink();
long start, end;
if (pull) {
start = System.currentTimeMillis();
exp.pull(context, result, props);
end = System.currentTimeMillis();