Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions src/profile-logic/call-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ interface CallTreeInternal {
hasChildren(callNodeIndex: IndexIntoCallNodeTable): boolean;
createChildren(nodeIndex: IndexIntoCallNodeTable): CallNodeChildren;
createRoots(): CallNodeChildren;
getSelfAndTotal(nodeIndex: IndexIntoCallNodeTable): SelfAndTotal;
getSelf(nodeIndex: IndexIntoCallNodeTable): number;
getTotal(nodeIndex: IndexIntoCallNodeTable): number;
findHeaviestPathInSubtree(
callNodeIndex: IndexIntoCallNodeTable
): CallNodePath;
Expand Down Expand Up @@ -171,10 +172,12 @@ export class CallTreeInternalNonInverted implements CallTreeInternal {
return this._callNodeHasChildren[callNodeIndex] !== 0;
}

getSelfAndTotal(callNodeIndex: IndexIntoCallNodeTable): SelfAndTotal {
const self = this._callTreeTimings.self[callNodeIndex];
const total = this._callTreeTimings.total[callNodeIndex];
return { self, total };
getSelf(callNodeIndex: IndexIntoCallNodeTable): number {
return this._callTreeTimings.self[callNodeIndex];
}

getTotal(callNodeIndex: IndexIntoCallNodeTable): number {
return this._callTreeTimings.total[callNodeIndex];
}

findHeaviestPathInSubtree(
Expand Down Expand Up @@ -216,11 +219,12 @@ export class CallTreeInternalFunctionList implements CallTreeInternal {
return this._timings.sortedFuncs;
}

getSelfAndTotal(nodeIndex: IndexIntoCallNodeTable): SelfAndTotal {
return {
self: this._timings.funcSelf[nodeIndex],
total: this._timings.funcTotal[nodeIndex],
};
getSelf(nodeIndex: IndexIntoCallNodeTable): number {
return this._timings.funcSelf[nodeIndex];
}

getTotal(nodeIndex: IndexIntoCallNodeTable): number {
return this._timings.funcTotal[nodeIndex];
}

findHeaviestPathInSubtree(
Expand Down Expand Up @@ -288,13 +292,19 @@ class CallTreeInternalInverted implements CallTreeInternal {
return children;
}

getSelfAndTotal(callNodeIndex: IndexIntoCallNodeTable): SelfAndTotal {
getSelf(callNodeIndex: IndexIntoCallNodeTable): number {
if (this._callNodeInfo.isRoot(callNodeIndex)) {
return this._totalPerRootFunc[callNodeIndex];
}
return 0;
}

getTotal(callNodeIndex: IndexIntoCallNodeTable): number {
if (this._callNodeInfo.isRoot(callNodeIndex)) {
const total = this._totalPerRootFunc[callNodeIndex];
return { self: total, total };
return this._totalPerRootFunc[callNodeIndex];
}
const { total } = this._getTotalAndHasChildren(callNodeIndex);
return { self: 0, total };
return total;
}

_getTotalAndHasChildren(
Expand Down Expand Up @@ -445,7 +455,8 @@ export class CallTree {
this._thread.funcTable.name[funcIndex]
);

const { self, total } = this._internal.getSelfAndTotal(callNodeIndex);
const total = this._internal.getTotal(callNodeIndex);
const self = this._internal.getSelf(callNodeIndex);
const totalRelative = total / this._rootTotalSummary;
const selfRelative = self / this._rootTotalSummary;

Expand Down
Loading