System.err.println("Legacy Caliper is no more. " + LEGACY_ENV + " has no effect.");
}
try {
// TODO(gak): see if there's a better way to deal with options. probably a module
Injector optionsInjector = Guice.createInjector(new OptionsModule(args));
CaliperOptions options = optionsInjector.getInstance(CaliperOptions.class);
Module runnerModule = new ExperimentingRunnerModule();
Class<?> benchmarkClass = benchmarkClassForName(options.benchmarkClassName());
Injector injector = optionsInjector.createChildInjector(
new BenchmarkClassModule(benchmarkClass),
new OutputModule(stdout, stderr),
new BridgeModule(),
new GsonModule(),
new ConfigModule(),
new ServiceModule(),
runnerModule);
if (options.printConfiguration()) {
stdout.println("Configuration:");
ImmutableSortedMap<String, String> sortedProperties =
ImmutableSortedMap.copyOf(injector.getInstance(CaliperConfig.class).properties());
for (Entry<String, String> entry : sortedProperties.entrySet()) {
stdout.printf(" %s = %s%n", entry.getKey(), entry.getValue());
}
}
// check that the parameters are valid
injector.getInstance(BenchmarkClass.class).validateParameters(options.userParameters());
ServiceManager serviceManager = injector.getInstance(ServiceManager.class);
serviceManager.startAsync().awaitHealthy();
try {
CaliperRun run = injector.getInstance(CaliperRun.class); // throws wrapped ICE, IBE
run.run(); // throws IBE