in perf/src/main/java/com/spotify/ffwd/FastForwardPerf.java [61:107]
public void run(String... argv) throws Exception {
final CmdLineParser parser = new CmdLineParser(this);
parser.parseArgument(argv);
if (help) {
parser.printUsage(System.out);
return;
}
final Map<String, String> attributes = buildBaseAttributes();
final ExecutorService executor = Executors.newFixedThreadPool(threads);
final Metric m = FastForward.metric("test").attributes(attributes);
System.out.println("Sending:");
for (int id = 0; id < batches; id++) {
System.out.print(".");
System.out.flush();
if ((id + 1) % 100 == 0) {
System.out.println();
}
final CountDownLatch latch = new CountDownLatch(threads);
final Batch batch = new Batch(m, latch, System.nanoTime());
for (int i = 0; i < threads; i++) {
executor.submit(new BatchRunnable(batch));
}
latch.await();
for (final Throwable error : batch.errors) {
System.out.println("Error in batch #" + id);
error.printStackTrace(System.out);
}
}
System.out.println();
System.out.println("Shutting down threads");
executor.shutdown();
System.exit(0);
}