use of org.spf4j.stackmonitor.SampleGraph in project spf4j by zolyfarkas.
the class FlameStackPanelTest method testSampleGraph.
@Test
public void testSampleGraph() throws IOException, InterruptedException {
LOG.debug("Graph = {}", NODES2);
SampleGraph sg = new SampleGraph(Methods.ROOT, NODES2);
SampleGraph.AggSample aggRootVertex = sg.getAggRootVertex();
SampleGraph.AggSample child = sg.getChildren(aggRootVertex).iterator().next();
Assert.assertTrue(sg.isParentDescendant(aggRootVertex, child));
}
use of org.spf4j.stackmonitor.SampleGraph in project spf4j by zolyfarkas.
the class HotFlameStackPanel method paintGraph.
private void paintGraph(final Graphics2D g2, final double areaWidth, final double rowHeight) {
SampleNode samples = getSamples();
if (samples == null) {
return;
}
final SampleGraph graph = new SampleGraph(getMethod(), samples);
this.completeGraph = graph;
AggSample aggRoot = graph.getAggRootVertex();
int rootSamples = aggRoot.getNrSamples();
// calculate pixe/sample
final double pps = (areaWidth - 1) / rootSamples;
methodLocations = new HashMap<>();
PriorityQueue<AggSample> traversal = new PriorityQueue<>(new SComparator(graph));
traversal.add(aggRoot);
Set<AggSample> drawed = new HashSet<>(graph.getAggNodesNr());
AggSample next;
while ((next = traversal.poll()) != null) {
if (drawed.add(next)) {
drawMethod(g2, next, graph, pps, rowHeight);
traversal.addAll(graph.getChildren(next));
}
}
}
Aggregations