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