Search in sources :

Example 1 with DiffNode

use of com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode 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 2 with DiffNode

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

the class TreeDiffViewTest method testTreeDiffViewScenario.

// Actual Test Method
@Test
public void testTreeDiffViewScenario() {
    FxRobot robot = new FxRobot();
    waitUntil(asyncFx(() -> getMainStage().setMaximized(true)));
    newProfileTab(robot, app(), 0, "Base : " + baseScenario.getName(), baseScenario, LOG);
    newProfileTab(robot, app(), 1, "New : " + newScenario.getName(), newScenario, LOG);
    selectTab(robot, 1);
    selectCtxMenu(robot, "#compareButton", 0, "Base : " + baseScenario.getName());
    selectTab(robot, 2);
    selectView(robot, TREE);
    selectFrameGrouping(robot, frameGrouping, "#tree");
    selectThreadGrouping(robot, threadGrouping, "#tree");
    clickExpandAll(robot, "#tree");
    TreeTableView<DiffNode> tableView = getTreeDiffTableView(robot);
    newScenario.checkTreeDiffAggregation(baseScenario, new TreeDiffTableViewCheckAdapter(threadGrouping, frameGrouping, tableView));
}
Also used : TreeDiffTableViewCheckAdapter(com.insightfullogic.honest_profiler.framework.checker.TreeDiffTableViewCheckAdapter) DiffNode(com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode) FxRobot(org.testfx.api.FxRobot) AbstractJavaFxTest(com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest) Test(org.junit.Test)

Aggregations

DiffNode (com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffNode)2 Tree (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)1 TreeDiffTableViewCheckAdapter (com.insightfullogic.honest_profiler.framework.checker.TreeDiffTableViewCheckAdapter)1 AbstractJavaFxTest (com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest)1 GraphicsContext (javafx.scene.canvas.GraphicsContext)1 Test (org.junit.Test)1 FxRobot (org.testfx.api.FxRobot)1