Search in sources :

Example 1 with FrameInfo

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

the class CallTreeNode method addChildren.

public void addChildren(List<FrameInfo> reversedFrames, long duration) {
    CallTreeNode node = this;
    for (FrameInfo frame : reversedFrames) {
        CallTreeNode child = node.findChildByName(frame);
        if (child == null) {
            child = new CallTreeNode(frame, 0);
            node.addChild(child);
        }
        child.duration += duration;
        node = child;
    }
}
Also used : FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo)

Example 2 with FrameInfo

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

the class MergedCallNode method doLoadChildren.

@Override
protected void doLoadChildren() {
    FrameInfo[] frames = Arrays.copyOf(callFrames, callFrames.length + 1);
    frames[frames.length - 1] = getFrameInfo();
    Pair<Map<FrameInfo, Long>, Map<FrameInfo, Long>> countMaps;
    if (backTrace) {
        countMaps = callTree.getCallersTimeMaps(frames);
    } else {
        countMaps = callTree.getCalleesTimeMaps(ArrayUtil.reverseArray(frames));
    }
    final Map<FrameInfo, Long> countMap = countMaps.getFirst();
    final Map<FrameInfo, Long> selfCountMap = countMaps.getSecond();
    List<FrameInfo> traces = ResolveUtil.filterByScope(countMap.keySet(), scope);
    ArrayList<CallInfo> callInfos = new ArrayList<>();
    for (final FrameInfo t : traces) {
        callInfos.add(new CallInfo(t, countMap.get(t), selfCountMap.get(t)));
    }
    for (int index = 0; index < callInfos.size(); ++index) {
        insert(new MergedCallNode<T>(callInfos.get(index), callTree, frames, backTrace, scope), index);
    }
}
Also used : CallInfo(com.jetbrains.actionscript.profiler.vo.CallInfo) ArrayList(java.util.ArrayList) FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo) Map(java.util.Map)

Example 3 with FrameInfo

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

the class FrameInfoCellRenderer method customizeCellRenderer.

@Override
protected void customizeCellRenderer(Object value, boolean selected) {
    if (value instanceof DefaultMutableTreeNode) {
        value = ((DefaultMutableTreeNode) value).getUserObject();
    }
    if (!(value instanceof FrameInfoProducer) && !(value instanceof FrameInfo)) {
        if (value != null && value.toString() != null) {
            append(value.toString());
        }
        return;
    }
    FrameInfo frameInfo;
    if (value instanceof FrameInfoProducer) {
        frameInfo = ((FrameInfoProducer) value).getFrameInfo();
    } else {
        frameInfo = (FrameInfo) value;
    }
    appendFrameInfo(frameInfo, selected);
    boolean inScope;
    if (frameInfo.getFilePath() != null) {
        final VirtualFile vf = VirtualFileManager.getInstance().findFileByUrl(VfsUtil.pathToUrl(frameInfo.getFilePath()));
        inScope = vf != null && scope.accept(vf);
    } else {
        inScope = ResolveUtil.containsInScope(frameInfo.getQName(), scope);
    }
    setIcon(inScope ? scopeIcon : nonScopeIcon);
}
Also used : FrameInfoProducer(com.jetbrains.actionscript.profiler.base.FrameInfoProducer) FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo) VirtualFile(com.intellij.openapi.vfs.VirtualFile) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 4 with FrameInfo

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

the class CPUSnapshotView method fillTreeModelRoot.

private <T extends Sample> void fillTreeModelRoot(TreeNode node, CallTree callTree, final Map<FrameInfo, Long> countMap, final Map<FrameInfo, Long> selfCountMap, boolean backTrace, FrameInfo[] frames) {
    final MutableTreeNode root = (MutableTreeNode) node;
    List<FrameInfo> traces = scopeMatcher.fun(new ArrayList<>(countMap.keySet()));
    GlobalSearchScope scope = getCurrentScope();
    int index = 0;
    for (final FrameInfo s : traces) {
        root.insert(new MergedCallNode<T>(new CallInfo(s, countMap.get(s), selfCountMap.get(s)), callTree, frames, backTrace, scope), index++);
    }
}
Also used : FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) CallInfo(com.jetbrains.actionscript.profiler.vo.CallInfo) MutableTreeNode(javax.swing.tree.MutableTreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 5 with FrameInfo

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

the class CallTreeTest method checkResults.

private static void checkResults(XmlTag[] subTags, Map<FrameInfo, Long> countMap, Map<FrameInfo, Long> selfTimeMap) {
    assertEquals("different sizes", subTags.length, countMap.size());
    assertEquals("different sizes", subTags.length, selfTimeMap.size());
    for (XmlTag xmlTag : subTags) {
        String name = xmlTag.getName();
        Long count = Long.parseLong(xmlTag.getAttributeValue("count"));
        Long selftime = Long.parseLong(xmlTag.getAttributeValue("selftime"));
        FrameInfo frameInfo = FrameUtil.getFrameInfo(name);
        assertEquals("bad count for " + name, count, countMap.get(frameInfo));
        assertEquals("bad selftime for " + name, selftime, selfTimeMap.get(frameInfo));
    }
}
Also used : FrameInfo(com.jetbrains.actionscript.profiler.sampler.FrameInfo) XmlTag(com.intellij.psi.xml.XmlTag)

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