private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed if (sampler != null) { try { sampler.stop(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new RuntimeException(ex); } Map<String, SampleNode> samples = sampler.getStackCollectionsAndReset(); for (Map.Entry<String, SampleNode> entry : samples.entrySet()) { try { setFrames(entry.getValue(), "self:" + entry.getKey()); } catch (IOException ex) { throw new UncheckedIOException(ex); } } } }//GEN-LAST:event_jMenuItem2ActionPerformed
@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); } }
return Collections.EMPTY_LIST; Map<String, SampleNode> c = SAMPLER.getStackCollectionsAndReset(); SampleNode collected; if (c.isEmpty()) {
public Map<String, SampleNode> sampleTest(final Sampler sampler, final String filename) throws InterruptedException, IOException { sampler.registerJmx(); sampler.start(); MonitorTest.main(new String[]{}); final File serializedFile = File.createTempFile(filename, ".ssdump3"); Map<String, SampleNode> collected = sampler.getStackCollectionsAndReset(); Converter.saveLabeledDumps(serializedFile, collected); LOG.debug("Dumped to file {}", serializedFile); sampler.stop(); Map<String, SampleNode> loadedDumps = Converter.loadLabeledDumps(serializedFile); for (Map.Entry<String, SampleNode> entry : loadedDumps.entrySet()) { LOG.debug("Loaded {}", entry.getKey()); } return collected; } }