Search in sources :

Example 6 with FrameInfo

use of com.jetbrains.actionscript.profiler.sampler.FrameInfo in project intellij-plugins by JetBrains.

the class CallTreeTestUtil method getCallTreeNodeFromXmlTag.

private static CallTreeNode getCallTreeNodeFromXmlTag(XmlTag rootTag) {
    int count = Integer.MAX_VALUE;
    String countStr = rootTag.getAttributeValue("count");
    if (countStr != null) {
        count = Integer.parseInt(countStr);
    }
    FrameInfo frameInfo = FrameUtil.getFrameInfo(rootTag.getName());
    CallTreeNode node = new CallTreeNode(frameInfo, count);
    if (rootTag.isEmpty()) {
        return node;
    }
    for (XmlTag childTag : rootTag.getSubTags()) {
        CallTreeNode childNode = getCallTreeNodeFromXmlTag(childTag);
        node.addChildRecursive(childNode);
        Assert.assertTrue("Bad edge " + node.getFrameInfo() + "->" + childNode.getFrameInfo(), childNode.calcSelfTiming() <= count);
    }
    return node;
}
Also used : FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo) XmlTag(com.intellij.psi.xml.XmlTag)

Example 7 with FrameInfo

use of com.jetbrains.actionscript.profiler.sampler.FrameInfo in project intellij-plugins by JetBrains.

the class CPUSnapshotView method buildPerformanceSamples.

private void buildPerformanceSamples(final DefaultTreeModel treeModel) {
    final boolean skipSystemStuff = myFilterSystemStuff.isSelected();
    CallTree filteredCallTree = rawCallTree;
    if (skipSystemStuff) {
        filteredCallTree = CallTreeUtil.filterSystemStuff(filteredCallTree);
    }
    final Pair<Map<FrameInfo, Long>, Map<FrameInfo, Long>> countMaps = filteredCallTree.getTimeMaps();
    final Map<FrameInfo, Long> countMap = countMaps.getFirst();
    final Map<FrameInfo, Long> selfCountMap = countMaps.getSecond();
    DefaultMutableTreeNode tracesRoot = (DefaultMutableTreeNode) treeModel.getRoot();
    JTreeUtil.removeChildren(tracesRoot, treeModel);
    fillTreeModelRoot(tracesRoot, filteredCallTree, countMap, selfCountMap, true, FrameInfo.EMPTY_FRAME_INFO_ARRAY);
    treeModel.reload();
}
Also used : FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CallTree(com.jetbrains.actionscript.profiler.calltree.CallTree) Map(java.util.Map)

Example 8 with FrameInfo

use of com.jetbrains.actionscript.profiler.sampler.FrameInfo 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

FrameInfo (com.jetbrains.actionscript.profiler.sampler.FrameInfo)8 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 Map (java.util.Map)3 XmlTag (com.intellij.psi.xml.XmlTag)2 CallInfo (com.jetbrains.actionscript.profiler.vo.CallInfo)2 Pair (com.intellij.openapi.util.Pair)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 FrameInfoProducer (com.jetbrains.actionscript.profiler.base.FrameInfoProducer)1 CallTree (com.jetbrains.actionscript.profiler.calltree.CallTree)1 CallTreeTable (com.jetbrains.actionscript.profiler.calltreetable.CallTreeTable)1 MergedCallNode (com.jetbrains.actionscript.profiler.calltreetable.MergedCallNode)1 ArrayList (java.util.ArrayList)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 MutableTreeNode (javax.swing.tree.MutableTreeNode)1