Search in sources :

Example 1 with MergedCallNode

use of com.jetbrains.actionscript.profiler.calltreetable.MergedCallNode in project intellij-plugins by JetBrains.

the class CPUSnapshotView method createHotSpotsTreeTable.

private void createHotSpotsTreeTable() {
    myHotSpotsTreeTable = new CallTreeTable(getProject());
    myHotSpotsTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            final Object node = myHotSpotsTreeTable.getSelectedValue();
            if (!(node instanceof MergedCallNode))
                return;
            myAlarm.cancelAllRequests();
            final MergedCallNode mergedCallNode = (MergedCallNode) node;
            myAlarm.addRequest(() -> {
                FrameInfo[] frames = new FrameInfo[] { mergedCallNode.getFrameInfo() };
                final Pair<Map<FrameInfo, Long>, Map<FrameInfo, Long>> countMaps = mergedCallNode.getCallTree().getCalleesTimeMaps(frames);
                final Map<FrameInfo, Long> countMap = countMaps.getFirst();
                final Map<FrameInfo, Long> selfCountMap = countMaps.getSecond();
                DefaultMutableTreeNode tracesRoot = (DefaultMutableTreeNode) myTracesTreeTable.getSortableTreeTableModel().getRoot();
                JTreeUtil.removeChildren(tracesRoot, myTracesTreeTable.getSortableTreeTableModel());
                fillTreeModelRoot(tracesRoot, mergedCallNode.getCallTree(), countMap, selfCountMap, false, frames);
                myTracesTreeTable.reload();
                TreeUtil.expand(myTracesTreeTable.getTree(), 1);
            }, 500);
        }
    });
}
Also used : FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MergedCallNode(com.jetbrains.actionscript.profiler.calltreetable.MergedCallNode) ListSelectionEvent(javax.swing.event.ListSelectionEvent) CallTreeTable(com.jetbrains.actionscript.profiler.calltreetable.CallTreeTable) Map(java.util.Map) ListSelectionListener(javax.swing.event.ListSelectionListener) Pair(com.intellij.openapi.util.Pair)

Aggregations

Pair (com.intellij.openapi.util.Pair)1 CallTreeTable (com.jetbrains.actionscript.profiler.calltreetable.CallTreeTable)1 MergedCallNode (com.jetbrains.actionscript.profiler.calltreetable.MergedCallNode)1 FrameInfo (com.jetbrains.actionscript.profiler.sampler.FrameInfo)1 Map (java.util.Map)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1