Skip to content

Commit

Permalink
Refactor the changes
Browse files Browse the repository at this point in the history
Co-authored-by: Yuri Shkuro <[email protected]>
Signed-off-by: Maksim <[email protected]>
  • Loading branch information
maxgaponov and yurishkuro authored Nov 29, 2023
1 parent 2f2d0b9 commit 8d3593d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ function computeSelfTime(span: Span, allSpans: Span[]): number {
// To work around that, we multiply start/end times by 10 and subtract one from the end.
// So instead of [1-10] we get [10-99]. This makes the intervals work like half-open.
if (!span.hasChildren) return span.duration;
const spanRange = new DRange(10 * span.startTime, 10 * (span.startTime + span.duration) - 1).subtract(
getChildOfDrange(span.spanID, allSpans)
const spanRange = new DRange(10 * span.startTime, 10 * (span.startTime + span.duration) - 1);
const children = getChildOfSpans(span.spanID, allSpans);
children.forEach(child => {
spanRange.subtract(10 * child.startTime, 10 * (child.startTime + child.duration) - 1);
);
return Math.round(spanRange.length / 10);
}
Expand Down

0 comments on commit 8d3593d

Please sign in to comment.