Search in sources :

Example 6 with Tree

use of com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree in project honest-profiler by jvm-profiling-tools.

the class FlameViewController method refresh.

// AbstractViewController Implementation
@Override
protected void refresh() {
    Tree tree = getTarget();
    if (tree != null) {
        flameCanvas.setWidth(currentWidth);
        flameCanvas.setHeight(currentHeight);
        flameCanvas.render(tree.filter(getFilterSpecification()));
    }
}
Also used : Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)

Example 7 with Tree

use of com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree in project honest-profiler by jvm-profiling-tools.

the class FlameDiffViewCanvas method render.

// AbstractFlameCanvas Implementation
@Override
public void render(final TreeDiff tree) {
    clearBlocks();
    // The diff should be fully constructed, i.e. both base and new aggregations should be present.
    Tree baseTree = tree.getBaseAggregation();
    Tree newTree = tree.getNewAggregation();
    baseMethodMap = methodMapFor(baseTree);
    newMethodMap = methodMapFor(newTree);
    final GraphicsContext ctx = getGraphics();
    // Total number of samples
    long nrSamples = baseTree.getSource().getGlobalData().getTotalCnt() + newTree.getSource().getGlobalData().getTotalCnt();
    // TODO Reaggregate when filtering so the width can be calculated properly. Now we have bla
    // Total number of samples in the leaves (the Tree may be filtered so we can't use the AggregationProfile global
    // data)
    // long nrSamples = rootNode.flattenDescendants()
    // .filter(node -> node.getChildren().size() == 0)
    // .flatMap(node -> node.getAggregatedNodes().stream())
    // .mapToLong(node -> node.getData().getTotalCnt()).sum();
    // Any frame will be represented with its width proportional to its total sample count divided by the profile
    // total sample count
    double colWidth = getWidth() / nrSamples;
    // Nr Rows = max depth of a stack. The root Node represents all threads, but since the descendant depth of a
    // Node without children is defined as 0, this works out fine.
    int nrRows = tree.getData().stream().mapToInt(DiffNode::getDescendantDepth).max().getAsInt() + 1;
    double rowHeight = max(getHeight() / nrRows, ctx.getFont().getSize() + 2);
    double startX = 0;
    double startY = getHeight() - rowHeight;
    for (DiffNode node : tree.getData()) {
        startX += renderNode(ctx, node, 0, colWidth, rowHeight, startX, startY);
    }
}
Also used : GraphicsContext(javafx.scene.canvas.GraphicsContext) DiffNode(com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode) Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)

Example 8 with Tree

use of com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree in project honest-profiler by jvm-profiling-tools.

the class AncestorTreeAggregatorTest method checkMultipleAncestorsSingleThread.

// Descendants of intermediate node
private void checkMultipleAncestorsSingleThread(ThreadGrouping tg, FrameGrouping fg) {
    Tree tree = get(SCENARIOS.get(1), tg, fg, F_03);
    assertAggregationSizeEquals(tree, 4);
    assertContains(tree, 0, 1, keysFor(fg, F_03));
    assertContains(tree, 0, 1, keysFor(fg, F_03, F_04));
    assertContains(tree, 0, 1, keysFor(fg, F_03, F_04, F_05));
}
Also used : Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)

Example 9 with Tree

use of com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree in project honest-profiler by jvm-profiling-tools.

the class TreeFilterTest method check.

private <U> void check(TreeGenerator gen, Target target, Comparison comparison, U value, ScenarioStraightFilter filter) {
    try {
        Tree filtered = gen.filter(treeFilter(target, comparison, value));
        scenario.checkTreeAggregation(new TreeCheckAdapter(filtered), filter);
    } catch (AssertionError ae) {
        throw new AssertionError("Failure : Unfiltered =\n" + gen.getTree(), ae);
    }
}
Also used : Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree) TreeCheckAdapter(com.insightfullogic.honest_profiler.framework.checker.TreeCheckAdapter)

Example 10 with Tree

use of com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree in project honest-profiler by jvm-profiling-tools.

the class AncestorTreeAggregatorTest method checkLeafAncestors.

// Descendants of leaf node
private void checkLeafAncestors(ThreadGrouping tg, FrameGrouping fg) {
    Tree tree = get(SCENARIOS.get(0), tg, fg, F_01);
    assertAggregationSizeEquals(tree, 2);
    assertContains(tree, 1, 1, keysFor(fg, F_01));
}
Also used : Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)

Aggregations

Tree (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)16 Node (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node)6 AggregationProfile (com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile)5 CombinedGrouping (com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping)5 LeanNode (com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode)5 Keyed (com.insightfullogic.honest_profiler.core.aggregation.result.Keyed)4 Map (java.util.Map)3 Collector.of (java.util.stream.Collector.of)3 Collectors.groupingBy (java.util.stream.Collectors.groupingBy)3 Aggregation (com.insightfullogic.honest_profiler.core.aggregation.result.Aggregation)2 Entry (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry)2 DiffNode (com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode)1 TreeDiff (com.insightfullogic.honest_profiler.core.aggregation.result.diff.TreeDiff)1 LeanProfile (com.insightfullogic.honest_profiler.core.profiles.lean.LeanProfile)1 NumericInfo (com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo)1 TreeCheckAdapter (com.insightfullogic.honest_profiler.framework.checker.TreeCheckAdapter)1 NodeTreeItem (com.insightfullogic.honest_profiler.ports.javafx.view.tree.NodeTreeItem)1 GraphicsContext (javafx.scene.canvas.GraphicsContext)1