Search in sources :

Example 1 with NumericInfo

use of com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo in project honest-profiler by jvm-profiling-tools.

the class ReferenceUtil method switchReference.

/**
 * Set the reference of all {@link Node}s contained in the provided {@link Tree} according to the specified
 * {@link ReferenceMode}. The reference of a {@link Node} is used for calculating the percentage values.
 * <p>
 * Please consult the {@link ReferenceMode} documentation for more information about the meaning of the reference
 * modes.
 * <p>
 * WARNING : the {@link ReferenceMode#THREAD} mode can only be used for {@link Tree}s or {@link TreeDiff}s where the
 * top-level children represent thread-level aggregations. Similarly, the {@link ReferenceMode#PARENT} mode can only
 * be used in {@link Tree}s or {@link TreeDiff}s.
 * <p>
 * @param tree the {@link Tree} whose references are to be changed
 * @param mode the strategy for setting the references
 */
public static void switchReference(Tree tree, ReferenceMode mode) {
    switch(mode) {
        case GLOBAL:
            NumericInfo global = tree.getSource().getGlobalData();
            tree.flatten().forEach(node -> node.setReference(global));
            return;
        case THREAD:
            tree.getData().forEach(rootNode -> {
                // The root nodes are presumed to be thread-level aggregations. If not, the results are unspecified.
                NumericInfo reference = rootNode.getData();
                rootNode.getChildren().forEach(child -> child.flatten().forEach(node -> node.setReference(reference)));
            });
            return;
        case PARENT:
            tree.getData().forEach(node -> setReferenceToParent(null, node));
            return;
    }
}
Also used : Tree(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree) Node(com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node) NumericInfo(com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo) TreeDiff(com.insightfullogic.honest_profiler.core.aggregation.result.diff.TreeDiff) NumericInfo(com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo)

Example 2 with NumericInfo

use of com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo in project honest-profiler by jvm-profiling-tools.

the class LeanProfileGenerator method assertTotalTimeEquals.

public void assertTotalTimeEquals(long totalTime, long threadId, StackFrame... stack) {
    NumericInfo info = getNode(threadId, stack).getData();
    assertEquals("Wrong Total Time", BigInteger.valueOf(totalTime), info.getTotalTime());
}
Also used : NumericInfo(com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo)

Example 3 with NumericInfo

use of com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo in project honest-profiler by jvm-profiling-tools.

the class LeanProfileGenerator method assertSelfCountEquals.

public void assertSelfCountEquals(int selfCount, long threadId, StackFrame... stack) {
    NumericInfo info = getNode(threadId, stack).getData();
    assertEquals("Wrong Self Count", selfCount, info.getSelfCnt());
}
Also used : NumericInfo(com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo)

Example 4 with NumericInfo

use of com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo in project honest-profiler by jvm-profiling-tools.

the class LeanProfileGenerator method assertCountsEqual.

public void assertCountsEqual(int selfCount, int totalCount, long threadId, StackFrame... stack) {
    NumericInfo info = getNode(threadId, stack).getData();
    assertEquals("Wrong Self Count", selfCount, info.getSelfCnt());
    assertEquals("Wrong Total Count", totalCount, info.getTotalCnt());
}
Also used : NumericInfo(com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo)

Example 5 with NumericInfo

use of com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo in project honest-profiler by jvm-profiling-tools.

the class LeanProfileGenerator method assertTotalCountEquals.

public void assertTotalCountEquals(int totalCount, long threadId, StackFrame... stack) {
    NumericInfo info = getNode(threadId, stack).getData();
    assertEquals("Wrong Total Count", totalCount, info.getTotalCnt());
}
Also used : NumericInfo(com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo)

Aggregations

NumericInfo (com.insightfullogic.honest_profiler.core.profiles.lean.info.NumericInfo)8 TreeDiff (com.insightfullogic.honest_profiler.core.aggregation.result.diff.TreeDiff)1 Node (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node)1 Tree (com.insightfullogic.honest_profiler.core.aggregation.result.straight.Tree)1 LeanProfileGenerator (com.insightfullogic.honest_profiler.framework.generator.LeanProfileGenerator)1 Test (org.junit.Test)1