Commit 9ff68b0c authored by jarin's avatar jarin Committed by Commit bot

[profview] Add runtime-entry top-down tree.

Review-Url: https://codereview.chromium.org/2811953003
Cr-Commit-Position: refs/heads/master@{#44561}
parent f3e4b7c1
......@@ -130,6 +130,7 @@ function findNextFrame(file, stack, stackPos, step, filter) {
while (stackPos >= 0 && stackPos < stack.length) {
codeId = stack[stackPos];
code = codeId >= 0 ? file.code[codeId] : undefined;
if (filter) {
let type = code ? code.type : undefined;
let kind = code ? code.kind : undefined;
......@@ -198,6 +199,31 @@ function createEmptyNode(name) {
};
}
class RuntimeCallTreeProcessor {
constructor() {
this.tree = createEmptyNode("root");
this.tree.delayedExpansion = { frameList : [], ascending : false };
}
addStack(file, tickIndex) {
this.tree.ticks++;
let stack = file.ticks[tickIndex].s;
let i;
for (i = 0; i < stack.length; i += 2) {
let codeId = stack[i];
if (codeId < 0) return;
let code = file.code[codeId];
if (code.type !== "CPP" && code.type !== "SHARED_LIB") {
i -= 2;
break;
}
}
if (i < 0 || i >= stack.length) return;
addOrUpdateChildNode(this.tree, file, tickIndex, i, false);
}
}
class PlainCallTreeProcessor {
constructor(filter, isBottomUp) {
this.filter = filter;
......
......@@ -526,7 +526,8 @@ class CallTreeView {
case "top-down":
addOptions(this.selectAttribution, attributions, calltree.attribution);
addOptions(this.selectCategories, [
{ value : "none", text : "None" }
{ value : "none", text : "None" },
{ value : "rt-entry", text : "Runtime entries" }
], calltree.categories);
addOptions(this.selectSort, [
{ value : "time", text : "Time (including children)" },
......@@ -605,8 +606,13 @@ class CallTreeView {
let stackProcessor;
let filter = filterFromFilterId(this.currentState.callTree.attribution);
if (mode === "top-down") {
stackProcessor =
new PlainCallTreeProcessor(filter, false);
if (this.currentState.callTree.categories === "rt-entry") {
stackProcessor =
new RuntimeCallTreeProcessor();
} else {
stackProcessor =
new PlainCallTreeProcessor(filter, false);
}
} else if (mode === "function-list") {
stackProcessor = new FunctionListTree(
filter, this.currentState.callTree.categories === "code-type");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment