@Override public Collection<String> addJVMOptions(BenchmarkParams params) { StringBuilder sb = new StringBuilder(); for (String param : params.getParamsKeys()) { if (sb.length() != 0) sb.append('-'); sb.append(param).append('-').append(params.getParam(param)); } long duration = getDurationSeconds(params.getWarmup()) + getDurationSeconds(params.getMeasurement()); return Arrays.asList( "-XX:+UnlockCommercialFeatures", "-XX:+FlightRecorder", "-XX:StartFlightRecording=settings=profile,duration=" + duration + "s,filename=" + params.getBenchmark() + "_" + sb + ".jfr"); }
private static Map<String, Integer> detectParameters(Collection<RunResult> results) { Map<String, Integer> params = new LinkedHashMap<>(); int paramPlaces = 0; for (RunResult result : results) { if (result.getParams() != null) { for (String param : result.getParams().getParamsKeys()) { int count = paramPlaces; if (params.containsKey(param)) { continue; } params.put(param, count); paramPlaces++; } } } return params; }
/** * Resolve a benchmark name (fqcn + "." + method name) to a {@link Description}. * * @param benchmarkName * @return */ @Override public Description apply(BenchmarkParams benchmark) { BenchmarkDescriptor descriptor = getBenchmarkDescriptor(benchmark); if (descriptor instanceof HierarchicalBenchmarkDescriptor) { Map<String, String> lookup = new HashMap<>(); for (String key : benchmark.getParamsKeys()) { lookup.put(key, benchmark.getParam(key)); } for (BenchmarkDescriptor child : ((HierarchicalBenchmarkDescriptor) descriptor).getChildren()) { if (child instanceof BenchmarkFixture) { BenchmarkFixture fixture = (BenchmarkFixture) child; if (fixture.getFixture().equals(lookup)) { return describeParametrizedMethodFunction.apply(getBenchmarkMethod(descriptor), fixture); } } } } return describeFunction.apply(descriptor); }
/** * Resolve a benchmark name (fqcn + "." + method name) to a {@link TestDescriptor}. * * @param benchmark * @return */ @Override public TestDescriptor apply(BenchmarkParams benchmark) { TestDescriptor descriptor = getBenchmarkDescriptor(benchmark); if (descriptor instanceof ParametrizedBenchmarkMethodDescriptor) { ParametrizedBenchmarkMethodDescriptor parametrized = (ParametrizedBenchmarkMethodDescriptor) descriptor; Map<String, String> lookup = new HashMap<>(); for (String key : benchmark.getParamsKeys()) { lookup.put(key, benchmark.getParam(key)); } for (TestDescriptor child : parametrized.getChildren()) { if (child instanceof BenchmarkFixtureDescriptor) { BenchmarkFixtureDescriptor fixture = (BenchmarkFixtureDescriptor) child; if (fixture.getFixture().getFixture().equals(lookup)) { return fixture; } } } } return descriptor; }
for (int i = 0; i < params.values().size(); i++) { boolean found = false; for (String param : result.getParams().getParamsKeys()) { if (params.get(param) == i) { builder.append(result.getParams().getParam(param)).append(", ");