use of com.android.tools.perflib.vmtrace.ThreadInfo in project android by JetBrains.
the class TraceViewPanel method setTrace.
public void setTrace(@NotNull VmTraceData trace) {
myTraceData = trace;
List<ThreadInfo> threads = trace.getThreads(true);
if (threads.isEmpty()) {
return;
}
ThreadInfo defaultThread = Iterables.find(threads, new Predicate<ThreadInfo>() {
@Override
public boolean apply(ThreadInfo input) {
return MAIN_THREAD_NAME.equals(input.getName());
}
}, threads.get(0));
myTraceViewCanvas.setTrace(trace, defaultThread, getCurrentRenderClock());
myThreadCombo.setModel(new DefaultComboBoxModel(threads.toArray()));
myThreadCombo.setSelectedItem(defaultThread);
myThreadCombo.setRenderer(new ColoredListCellRenderer() {
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
String name = value instanceof ThreadInfo ? ((ThreadInfo) value).getName() : value.toString();
append(name);
}
});
myThreadCombo.setEnabled(true);
myRenderClockSelectorCombo.setEnabled(true);
myVmStatsTreeTableModel.setTraceData(trace, defaultThread);
myVmStatsTreeTableModel.setClockType(getCurrentRenderClock());
myTreeTable.setModel(myVmStatsTreeTableModel);
VmStatsTreeUtils.adjustTableColumnWidths(myTreeTable);
VmStatsTreeUtils.setCellRenderers(myTreeTable);
VmStatsTreeUtils.setSpeedSearch(myTreeTable);
VmStatsTreeUtils.enableSorting(myTreeTable, myVmStatsTreeTableModel);
}
use of com.android.tools.perflib.vmtrace.ThreadInfo in project android by JetBrains.
the class TraceViewPanel method searchTextChanged.
private void searchTextChanged(@Nullable String pattern) {
if (StringUtil.isEmpty(pattern)) {
myTraceViewCanvas.setHighlightMethods(null);
myResultsLabel.setText("");
return;
}
ThreadInfo thread = (ThreadInfo) myThreadCombo.getSelectedItem();
SearchResult results = myTraceData.searchFor(pattern, thread);
myTraceViewCanvas.setHighlightMethods(results.getMethods());
String result = String.format("%1$d %2$s, %3$d %4$s", results.getMethods().size(), StringUtil.pluralize("method", results.getMethods().size()), results.getInstances().size(), StringUtil.pluralize("instance", results.getInstances().size()));
myResultsLabel.setText(result);
}
Aggregations