[tools] Use code attribution in timeline view
Reflect the code attribution (in particular, "attribute non-functions to JS functions") in the timeline view, which visualises the distribution of each code kind. This allows easier visualisation of which tiers are active, ignoring stubs that are shared between tiers (like ICs). Change-Id: I1f2818ffd4e466ce18c01627865186e6a94e2bed Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4105021 Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/main@{#84829}
This commit is contained in:
parent
9be597d194
commit
9bfc84f18f
@ -150,11 +150,7 @@ function findNextFrame(file, stack, stackPos, step, filter) {
|
|||||||
codeId = stack[stackPos];
|
codeId = stack[stackPos];
|
||||||
code = codeId >= 0 ? file.code[codeId] : undefined;
|
code = codeId >= 0 ? file.code[codeId] : undefined;
|
||||||
|
|
||||||
if (filter) {
|
if (!filter || filter(code?.type, code?.kind)) return stackPos;
|
||||||
let type = code ? code.type : undefined;
|
|
||||||
let kind = code ? code.kind : undefined;
|
|
||||||
if (filter(type, kind)) return stackPos;
|
|
||||||
}
|
|
||||||
stackPos += step;
|
stackPos += step;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -399,8 +395,9 @@ class FunctionListTree {
|
|||||||
|
|
||||||
|
|
||||||
class CategorySampler {
|
class CategorySampler {
|
||||||
constructor(file, bucketCount) {
|
constructor(file, bucketCount, filter) {
|
||||||
this.bucketCount = bucketCount;
|
this.bucketCount = bucketCount;
|
||||||
|
this.filter = filter;
|
||||||
|
|
||||||
this.firstTime = file.ticks[0].tm;
|
this.firstTime = file.ticks[0].tm;
|
||||||
let lastTime = file.ticks[file.ticks.length - 1].tm;
|
let lastTime = file.ticks[file.ticks.length - 1].tm;
|
||||||
@ -426,7 +423,8 @@ class CategorySampler {
|
|||||||
let bucket = this.buckets[i];
|
let bucket = this.buckets[i];
|
||||||
bucket.total++;
|
bucket.total++;
|
||||||
|
|
||||||
let codeId = (stack.length > 0) ? stack[0] : -1;
|
let stackPos = findNextFrame(file, stack, 0, 2, this.filter);
|
||||||
|
let codeId = stackPos >= 0 ? stack[stackPos] : -1;
|
||||||
let code = codeId >= 0 ? file.code[codeId] : undefined;
|
let code = codeId >= 0 ? file.code[codeId] : undefined;
|
||||||
let kind = resolveCodeKindAndVmState(code, vmState);
|
let kind = resolveCodeKindAndVmState(code, vmState);
|
||||||
bucket[kind]++;
|
bucket[kind]++;
|
||||||
|
@ -908,6 +908,7 @@ class TimelineView {
|
|||||||
height === oldState.timelineSize.height &&
|
height === oldState.timelineSize.height &&
|
||||||
newState.file === oldState.file &&
|
newState.file === oldState.file &&
|
||||||
newState.currentCodeId === oldState.currentCodeId &&
|
newState.currentCodeId === oldState.currentCodeId &&
|
||||||
|
newState.callTree.attribution === oldState.callTree.attribution &&
|
||||||
newState.start === oldState.start &&
|
newState.start === oldState.start &&
|
||||||
newState.end === oldState.end) {
|
newState.end === oldState.end) {
|
||||||
// No change, nothing to do.
|
// No change, nothing to do.
|
||||||
@ -945,11 +946,10 @@ class TimelineView {
|
|||||||
this.selectionStart = (start - firstTime) / (lastTime - firstTime) * width;
|
this.selectionStart = (start - firstTime) / (lastTime - firstTime) * width;
|
||||||
this.selectionEnd = (end - firstTime) / (lastTime - firstTime) * width;
|
this.selectionEnd = (end - firstTime) / (lastTime - firstTime) * width;
|
||||||
|
|
||||||
let stackProcessor = new CategorySampler(file, bucketCount);
|
let filter = filterFromFilterId(this.currentState.callTree.attribution);
|
||||||
|
let stackProcessor = new CategorySampler(file, bucketCount, filter);
|
||||||
generateTree(file, 0, Infinity, stackProcessor);
|
generateTree(file, 0, Infinity, stackProcessor);
|
||||||
let codeIdProcessor = new FunctionTimelineProcessor(
|
let codeIdProcessor = new FunctionTimelineProcessor(currentCodeId, filter);
|
||||||
currentCodeId,
|
|
||||||
filterFromFilterId(this.currentState.callTree.attribution));
|
|
||||||
generateTree(file, 0, Infinity, codeIdProcessor);
|
generateTree(file, 0, Infinity, codeIdProcessor);
|
||||||
|
|
||||||
let buffer = document.createElement("canvas");
|
let buffer = document.createElement("canvas");
|
||||||
|
Loading…
Reference in New Issue
Block a user