Skip to content

Commit 6ac2976

Browse files
committed
Use exclusive time in human output
This commit updates the HumanOutput class to compute summary tables using the exclusive time of each span. Previously the inclusive time was used which hid hot spots by causing spans to double-count the runtime of their children.
1 parent 2fc1c09 commit 6ac2976

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

profile-parser.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ def display(traces)
313313
trace.each do |span|
314314
case span.object
315315
when FunctionSlice
316-
span_map[:functions] << span.object
316+
span_map[:functions] << span
317317
when ResourceSlice
318-
span_map[:resources] << span.object
318+
span_map[:resources] << span
319319
when OtherSlice
320-
span_map[:other] << span.object
320+
span_map[:other] << span
321321
end
322322
end
323323
end
@@ -337,13 +337,13 @@ def truncate(str, width)
337337
end
338338
end
339339

340-
def process_group(title, slices)
340+
def process_group(title, spans)
341341
total = 0
342342
itemized_totals = Hash.new { |h, k| h[k] = 0 }
343343

344-
slices.each do |slice|
345-
total += Integer(slice.time * 1000)
346-
itemized_totals[slice.name] += Integer(slice.time * 1000)
344+
spans.each do |span|
345+
total += span.exclusive_time
346+
itemized_totals[span.stack.last] += span.exclusive_time
347347
end
348348

349349
rows = itemized_totals.to_a.sort { |a, b| b[1] <=> a[1] }

0 commit comments

Comments
 (0)