try {
ClassLoader usercodeLoader = new URLClassLoader(
new URL[]{new URL("file:///e:/javalib/xMark/java/")});
Class userClass = usercodeLoader.loadClass("Q" + q);
CompiledUserQuery cuq = (CompiledUserQuery) userClass.newInstance();
cuq.setConfiguration(config);
final DynamicQueryContext dqc = new DynamicQueryContext(config);
cuq.setDynamicContext(dqc);
int runs = 0;
long totalTime = 0;
long min = Integer.MAX_VALUE;
long max = 0;
if (checkResults && f==0) {
dqc.setContextItem(doc);
File out = new File("e:/javalib/xmark/output/q" + q + ".out");
//out.mkdirs();
OutputStream os = new FileOutputStream(out);
Result result = new StreamResult(os);
cuq.run(result, props);
os.close();
compare(new File("e:/javalib/xmark/output/q" + q + ".out"),
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;