Skip to content

Commit

Permalink
Post review commit: Show call nodes with total time == 0 if they have…
Browse files Browse the repository at this point in the history
… children
  • Loading branch information
julienw committed Jul 12, 2019
1 parent 26bb376 commit cce553a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/profile-logic/call-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,15 @@ export class CallTree {
children.length < childCount;
childCallNodeIndex++
) {
const childPrefixIndex = this._callNodeTable.prefix[childCallNodeIndex];
const childTotalTime = this._callNodeTimes.totalTime[
childCallNodeIndex
];
const childChildCount = this._callNodeChildCount[childCallNodeIndex];

if (
this._callNodeTable.prefix[childCallNodeIndex] === callNodeIndex &&
this._callNodeTimes.totalTime[childCallNodeIndex] !== 0
childPrefixIndex === callNodeIndex &&
(childTotalTime !== 0 || childChildCount !== 0)
) {
children.push(childCallNodeIndex);
}
Expand Down Expand Up @@ -381,16 +387,21 @@ export function computeCallTreeCountsAndTimings(
let rootCount = 0;

// We loop the call node table in reverse, so that we find the children
// before their parents.
// before their parents, and the total time is known at the time we reach a
// node.
for (
let callNodeIndex = callNodeTable.length - 1;
callNodeIndex >= 0;
callNodeIndex--
) {
callNodeTotalTime[callNodeIndex] += callNodeLeafTime[callNodeIndex];
if (callNodeTotalTime[callNodeIndex] === 0) {
const hasChildren = callNodeChildCount[callNodeIndex] !== 0;
const hasTotalTime = callNodeTotalTime[callNodeIndex] !== 0;

if (!hasChildren && !hasTotalTime) {
continue;
}

const prefixCallNode = callNodeTable.prefix[callNodeIndex];
if (prefixCallNode === -1) {
rootTotalTime += callNodeTotalTime[callNodeIndex];
Expand Down

0 comments on commit cce553a

Please sign in to comment.