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