// JmxReporter jmxReporter = new JmxReporter(Metrics.defaultRegistry());
File csvOut = new File("csvout");
csvOut.mkdirs();
CsvReporter csvReporter = new CsvReporter(csvOut, Metrics.defaultRegistry());
// GangliaReporter csvReporter = new
// GangliaReporter(Metrics.defaultRegistry(),"localhost",8649,"zoie-perf");
int updateInterval = conf.getInt("perf.update.intervalSec", 2);
csvReporter.start(updateInterval, TimeUnit.SECONDS);
long maxEventsPerMin = conf.getLong("perf.maxEventsPerMin");
dataProvider.setMaxEventsPerMinute(maxEventsPerMin);
int numThreads = conf.getInt("perf.query.threads", 10);
SearchThread[] searchThreads = null;
if (doSearchTest) {
searchThreads = new SearchThread[numThreads];
for (int i = 0; i < numThreads; ++i) {
searchThreads[i] = new SearchThread();
}
} else {
searchThreads = new SearchThread[0];
}
dataProvider.start();
for (int i = 0; i < searchThreads.length; ++i) {
searchThreads[i].start();
}
ZoiePerfVersion perfVersion = ZoiePerfVersion.fromString(testHandler.consumer.getVersion());
long eventCount;
while ((eventCount = perfVersion.countVersion + 1) < maxSize) {
Thread.sleep(500);
perfVersion = ZoiePerfVersion.fromString(testHandler.consumer.getVersion());
}
dataProvider.stop();
testHandler.consumer.stop();
long end = System.currentTimeMillis();
for (int i = 0; i < searchThreads.length; ++i) {
searchThreads[i].terminate();
}
for (int i = 0; i < searchThreads.length; ++i) {
searchThreads[i].join();
}
// consoleReporter.shutdown();
// jmxReporter.shutdown();
csvReporter.shutdown();
System.out.println("Test duration: " + (end - start) + " ms");
System.out.println("Amount of event consumed: " + eventCount);
}