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;
}
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;
}
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;
}
Aggregations