private File create(final BenchmarkParams b, final String suffix) { final File f = new File(TMP_BENCH, b.id() + suffix); if (!f.mkdirs()) { throw new IllegalStateException("Cannot mkdir " + f); } return f; }
/** * See: * http://docs.oracle.com/cd/E15289_01/doc.40/e15070/usingjfr.htm * and * http://docs.oracle.com/cd/E15289_01/doc.40/e15070/config_rec_data.htm * @param params * @return */ @Override @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") public Collection<String> addJVMOptions(final BenchmarkParams params) { final String id = params.id(); benchmarkName = id; dumpFile = DUMP_FOLDER + '/' + id + ".jfr"; String flightRecorderOptions = DEFAULT_OPTIONS + ",dumponexit=true,dumponexitpath=" + dumpFile; return Arrays.asList( "-XX:+FlightRecorder", "-XX:FlightRecorderOptions=" + flightRecorderOptions); }
@Override @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") public void beforeIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams) { benchmarkName = benchmarkParams.id(); SAMPLER.start(); }
@Override @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") public void beforeIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams) { benchmarkName = benchmarkParams.id(); SAMPLER.start(); }
@Override @Nonnull public Collection<? extends Result> afterIteration(final BenchmarkParams benchmarkParams, final IterationParams iterationParams, final IterationResult ir) { try { SAMPLER.stop(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); return Collections.EMPTY_LIST; } Map<String, SampleNode> c = SAMPLER.getStackCollectionsAndReset(); if (c.isEmpty()) { return Collections.EMPTY_LIST; } SampleNode collected = c.values().iterator().next(); try { return Collections.singletonList(new StackResult(collected, benchmarkParams.id(), true)); } catch (IOException ex) { throw new UncheckedIOException(ex); } }
throw new IllegalStateException("Unknown type of iteration " + itType); return Collections.singletonList(new StackResult(collected, benchmarkParams.id(), iterationId));
if (measurementIterationCount == iterationParams.getCount()) { if (outputDir == null) { outputDir = createTempDir(benchmarkParams.id().replaceAll("/", "-"));
if (measurementIterationCount == iterationParams.getCount()) { if (outputDir == null) { outputDir = createTempDir(benchmarkParams.id().replaceAll("/", "-"));