Search in sources :

Example 1 with Keyed

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

the class DescendantFlatAggregator method aggregate.

/**
 * This method aggregates all descendants of a {@link Node} into a {@link Flat}, using the original
 * {@link CombinedGrouping} from the {@link Tree} the {@link Node} belongs to.
 *
 * @see SubAggregator#aggregate(Object)
 */
@Override
public Flat aggregate(Node parent) {
    Aggregation<Keyed<String>> aggregation = parent.getAggregation();
    AggregationProfile source = aggregation.getSource();
    CombinedGrouping grouping = aggregation.getGrouping();
    Flat result = new Flat(source, grouping);
    result.getData().addAll(// Create a stream of all descendant nodes, and aggregate according to the Grouping
    parent.flattenDescendants().collect(groupingBy(// Group Nodes by their key
    Node::getKey, // Downstream collector, aggregates the Nodes in a single group
    of(// Supplier, creates an empty Entry
    () -> {
        Entry entry = new Entry(aggregation);
        // Set the reference by default for all nodes to the global aggregation.
        entry.setReference(source.getGlobalData());
        return entry;
    }, // Accumulator, adds a Node to the accumulator Node
    (x, y) -> x.combine(y), // Combiner, combines to entries
    (x, y) -> x.combine(y)))).values());
    return result;
}
Also used : AggregationProfile(com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile) Entry(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry) Flat(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Flat) Keyed(com.insightfullogic.honest_profiler.core.aggregation.result.Keyed) CombinedGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping)

Example 2 with Keyed

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

the class DescendantTreeAggregator method aggregate.

// Aggregator Implementation
/**
 * @see SubAggregator#aggregate(Object)
 */
@Override
public Tree aggregate(Entry input) {
    Aggregation<Keyed<String>> aggregation = input.getAggregation();
    AggregationProfile source = aggregation.getSource();
    CombinedGrouping grouping = aggregation.getGrouping();
    Tree result = new Tree(source, input.getAggregation().getGrouping());
    Node root = new Node(input);
    result.getData().add(root);
    addChildren(source, root, result, grouping);
    return result;
}
Also used : AggregationProfile(com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile) LeanNode(com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode) Node(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node) Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree) Keyed(com.insightfullogic.honest_profiler.core.aggregation.result.Keyed) CombinedGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping)

Example 3 with Keyed

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

the class AncestorTreeAggregator method aggregate.

// Aggregator Implementation
/**
 * @see SubAggregator#aggregate(Object)
 */
@Override
public Tree aggregate(Entry input) {
    Aggregation<Keyed<String>> aggregation = input.getAggregation();
    AggregationProfile source = aggregation.getSource();
    CombinedGrouping grouping = aggregation.getGrouping();
    Tree result = new Tree(source, input.getAggregation().getGrouping());
    Node root = new Node(input);
    result.getData().add(root);
    addAncestors(source, root, result, grouping);
    return result;
}
Also used : AggregationProfile(com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile) LeanNode(com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode) Node(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node) Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree) Keyed(com.insightfullogic.honest_profiler.core.aggregation.result.Keyed) CombinedGrouping(com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping)

Aggregations

AggregationProfile (com.insightfullogic.honest_profiler.core.aggregation.AggregationProfile)3 CombinedGrouping (com.insightfullogic.honest_profiler.core.aggregation.grouping.CombinedGrouping)3 Keyed (com.insightfullogic.honest_profiler.core.aggregation.result.Keyed)3 Node (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node)2 Tree (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)2 LeanNode (com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode)2 Entry (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry)1 Flat (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Flat)1