Search in sources :

Example 1 with AppStatTreeNode

use of com.android.tools.idea.monitor.ui.cpu.view.AppStatTreeNode in project android by JetBrains.

the class AppTrace method generateBottomUpTree.

private JComponent generateBottomUpTree(HNode<MethodUsage> graph) {
    AppStatTreeNode top = new AppStatTreeNode();
    convertGraphToTree(graph, top);
    JTree tree = new JTree(top);
    JComponent bottomUpColumnTree = new ColumnTreeBuilder(tree).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Method").setRenderer(new ColoredTreeCellRenderer() {

        @Override
        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            AppStatTreeNode node = (AppStatTreeNode) value;
            append(generateNameForColumn(node.getMethodNamespace(), node.getMethodName(), getSeparator()));
        }
    })).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Exclusive stats").setRenderer(new ColoredTreeCellRenderer() {

        @Override
        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            AppStatTreeNode node = (AppStatTreeNode) value;
            append(String.format("%2.1f%%", node.getPercentageExclusive() * 100));
        }
    })).build();
    return bottomUpColumnTree;
}
Also used : AppStatTreeNode(com.android.tools.idea.monitor.ui.cpu.view.AppStatTreeNode) ColoredTreeCellRenderer(com.intellij.ui.ColoredTreeCellRenderer) ColumnTreeBuilder(com.android.tools.adtui.common.ColumnTreeBuilder) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with AppStatTreeNode

use of com.android.tools.idea.monitor.ui.cpu.view.AppStatTreeNode in project android by JetBrains.

the class AppTrace method generateTopdownTree.

// Convert a HNode tree into an AppStat tree (better suited for rendition in a ColumnTree).
private JComponent generateTopdownTree(HNode<MethodUsage> graph) {
    AppStatTreeNode top = new AppStatTreeNode();
    // Intentionally discard first child
    graph = graph.getFirstChild();
    convertGraphToTree(graph, top);
    JTree tree = new JTree(top);
    JComponent topdownColumnTree = new ColumnTreeBuilder(tree).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Method").setRenderer(new ColoredTreeCellRenderer() {

        @Override
        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            AppStatTreeNode node = (AppStatTreeNode) value;
            append(generateNameForColumn(node.getMethodNamespace(), node.getMethodName(), getSeparator()));
        }
    })).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Inclusive stats").setRenderer(new ColoredTreeCellRenderer() {

        @Override
        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            AppStatTreeNode node = (AppStatTreeNode) value;
            append(String.format("%2.1f%%", node.getPercentageInclusive() * 100));
        }
    })).addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Exclusive stats").setRenderer(new ColoredTreeCellRenderer() {

        @Override
        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            AppStatTreeNode node = (AppStatTreeNode) value;
            append(String.format("%2.1f%%", node.getPercentageExclusive() * 100));
        }
    })).build();
    return topdownColumnTree;
}
Also used : AppStatTreeNode(com.android.tools.idea.monitor.ui.cpu.view.AppStatTreeNode) ColoredTreeCellRenderer(com.intellij.ui.ColoredTreeCellRenderer) ColumnTreeBuilder(com.android.tools.adtui.common.ColumnTreeBuilder) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with AppStatTreeNode

use of com.android.tools.idea.monitor.ui.cpu.view.AppStatTreeNode in project android by JetBrains.

the class AppTrace method convertGraphToTree.

private void convertGraphToTree(HNode<MethodUsage> graph, AppStatTreeNode treeNode) {
    MethodUsage top = graph.getData();
    if (top != null) {
        treeNode.setPercentageInclusive(top.getInclusivePercentage());
        treeNode.setPercentageExclusive(top.getExclusivePercentage());
        treeNode.setRuntimeExclusive(top.getExclusiveDuration());
        treeNode.setRuntimeInclusive(top.getInclusiveDuration());
        treeNode.setMethodName(top.getName());
        treeNode.setMethodNamespace(top.getNameSpace());
    }
    for (HNode<MethodUsage> n : graph.getChildren()) {
        AppStatTreeNode newNode = new AppStatTreeNode();
        treeNode.add(newNode);
        convertGraphToTree(n, newNode);
    }
}
Also used : AppStatTreeNode(com.android.tools.idea.monitor.ui.cpu.view.AppStatTreeNode) MethodUsage(com.android.tools.adtui.chart.hchart.MethodUsage)

Aggregations

AppStatTreeNode (com.android.tools.idea.monitor.ui.cpu.view.AppStatTreeNode)3 ColumnTreeBuilder (com.android.tools.adtui.common.ColumnTreeBuilder)2 ColoredTreeCellRenderer (com.intellij.ui.ColoredTreeCellRenderer)2 NotNull (org.jetbrains.annotations.NotNull)2 MethodUsage (com.android.tools.adtui.chart.hchart.MethodUsage)1