Search in sources :

Example 6 with Entry

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

the class FlatGenerator method assertContains.

public static final void assertContains(Flat flat, String key, int selfCount, int totalCount, long selfTime, long totalTime) {
    Optional<Entry> result = flat.getData().stream().filter(entry -> key.equals(entry.getKey())).findFirst();
    assertTrue("No entry found with key " + key, result.isPresent());
    Entry entry = result.get();
    assertEquals("Wrong self count for entry " + key, selfCount, entry.getSelfCnt());
    assertEquals("Wrong total count for entry " + key, totalCount, entry.getTotalCnt());
    assertEquals("Wrong self time for entry " + key, selfTime, entry.getSelfTime());
    assertEquals("Wrong total time for entry " + key, totalTime, entry.getTotalTime());
}
Also used : ThreadGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.ThreadGrouping) AggregationUtil.nano(com.insightfullogic.honest_profiler.framework.AggregationUtil.nano) Assert.assertTrue(org.junit.Assert.assertTrue) FlatProfileAggregator(com.insightfullogic.honest_profiler.core.aggregation.aggregator.FlatProfileAggregator) Flat(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Flat) LeanLogCollectorDriver(com.insightfullogic.honest_profiler.framework.LeanLogCollectorDriver) CombinedGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping) FilterSpecification(com.insightfullogic.honest_profiler.core.aggregation.filter.FilterSpecification) Entry(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry) Optional(java.util.Optional) AggregationProfile(com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile) LeanProfile(com.insightfullogic.honest_profiler.core.profiles.lean.LeanProfile) CombinedGrouping.combine(com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping.combine) FrameGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.FrameGrouping) Assert.assertEquals(org.junit.Assert.assertEquals) Entry(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry)

Example 7 with Entry

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

the class FlatViewTest method testFlatViewScenario.

// Actual Test Method
@Test
public void testFlatViewScenario() {
    FxRobot robot = new FxRobot();
    newProfileTab(robot, app(), 0, scenario.getName(), scenario, LOG);
    selectView(robot, FLAT);
    selectFrameGrouping(robot, frameGrouping, "#flat");
    TableView<Entry> tableView = getFlatTableView(robot);
    runLater(() -> scenario.checkFlatAggregation(new FlatTableViewCheckAdapter(BY_ID, frameGrouping, tableView)));
}
Also used : Entry(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry) FxRobot(org.testfx.api.FxRobot) FlatTableViewCheckAdapter(com.insightfullogic.honest_profiler.framework.checker.FlatTableViewCheckAdapter) AbstractJavaFxTest(com.insightfullogic.honest_profiler.ports.javafx.framework.AbstractJavaFxTest) Test(org.junit.Test)

Example 8 with Entry

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

the class AncestorTreeAggregator method addAncestors.

/**
 * Recursive method for aggregating the parents (and ancestors) of the {@link LeanNode}s which are aggregated by the
 * provided {@link Node} and adding them as children.
 * <p>
 * @param source the original {@link AggregationProfile}
 * @param child the input {@link Node} whose ancestors will be aggregated and added as children
 * @param tree the resulting {@link Tree}
 * @param grouping the key calculation grouping
 */
private void addAncestors(AggregationProfile source, Node child, Tree tree, CombinedGrouping grouping) {
    Map<String, Node> result = child.getAggregatedNodes().stream().map(node -> node.getParent()).filter(node -> node != null).distinct().collect(groupingBy(// Group LeanNodes by calculated key
    node -> grouping.apply(source, node), // Downstream collector, aggregates LeanNodes in a single group
    of(// Supplier, creates an empty Node
    () -> {
        Node node = new Node(tree);
        // Set the reference by default for all nodes to the global aggregation.
        node.setReference(source.getGlobalData());
        return node;
    }, // Accumulator, aggregates a LeanNode into the Entry accumulator
    (node, leanNode) -> {
        node.add(leanNode);
        node.setKey(grouping.apply(source, leanNode));
    }, // Combiner, combines two Nodes with the same key
    (node1, node2) -> node1.combine(node2))));
    // Add the aggregated parents as children to the Node, and recurse
    result.entrySet().forEach(mapEntry -> {
        // The "child" Node in the ancestor Tree has its parents (the values of the calculated map) as children.
        child.addChild(mapEntry.getValue());
        // Recursively add ancestors
        addAncestors(source, mapEntry.getValue(), tree, grouping);
    });
}
Also used : CombinedGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping) LeanNode(com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode) Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree) Map(java.util.Map) Aggregation(com.insightfullogic.honest_profiler.core.aggregation.result.Aggregation) Keyed(com.insightfullogic.honest_profiler.core.aggregation.result.Keyed) Entry(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry) Node(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) AggregationProfile(com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile) Collector.of(java.util.stream.Collector.of) LeanNode(com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode) Node(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node)

Aggregations

Entry (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry)8 AggregationProfile (com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile)4 CombinedGrouping (com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping)4 Flat (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Flat)3 Keyed (com.insightfullogic.honest_profiler.core.aggregation.result.Keyed)2 LeanNode (com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode)2 LeanProfile (com.insightfullogic.honest_profiler.core.profiles.lean.LeanProfile)2 FlatTableViewCheckAdapter (com.insightfullogic.honest_profiler.framework.checker.FlatTableViewCheckAdapter)2 FlatGenerator (com.insightfullogic.honest_profiler.framework.generator.FlatGenerator)2 Map (java.util.Map)2 Collector.of (java.util.stream.Collector.of)2 Collectors.groupingBy (java.util.stream.Collectors.groupingBy)2 FlatProfileAggregator (com.insightfullogic.honest_profiler.core.aggregation.aggregator.FlatProfileAggregator)1 FilterSpecification (com.insightfullogic.honest_profiler.core.aggregation.filter.FilterSpecification)1 CombinedGrouping.combine (com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping.combine)1 FrameGrouping (com.insightfullogic.honest_profiler.core.aggregation.grouping.FrameGrouping)1 ThreadGrouping (com.insightfullogic.honest_profiler.core.aggregation.grouping.ThreadGrouping)1 Aggregation (com.insightfullogic.honest_profiler.core.aggregation.result.Aggregation)1 Node (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node)1 Tree (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)1