Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build slice level breakdown #11359

Merged
merged 1 commit into from
Nov 29, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,29 @@ Map<Collector, Map<String, Long>> buildSliceLevelBreakdown() {
: value + currentSliceLeafBreakdownMap.get(timingTypeCountKey)
);

// compute the sliceEndTime for timingType using max of endTime across slice leaves
final long sliceLeafTimingTypeEndTime = currentSliceLeafBreakdownMap.get(timingTypeStartKey)
+ currentSliceLeafBreakdownMap.get(timingType.toString());
currentSliceBreakdown.compute(
timingTypeSliceEndTimeKey,
(key, value) -> (value == null) ? sliceLeafTimingTypeEndTime : Math.max(value, sliceLeafTimingTypeEndTime)
);

// compute the sliceStartTime for timingType using min of startTime across slice leaves
final long sliceLeafTimingTypeStartTime = currentSliceLeafBreakdownMap.get(timingTypeStartKey);
if (sliceLeafTimingTypeStartTime == 0L && currentSliceBreakdown.get(timingTypeCountKey) != 0L) {
// In case where a slice with multiple leaves, it is possible that any one of the leaves has 0 invocations for a
// specific breakdown type. For instance, let's consider a slice with three leaves: leaf A with a score count of 5,
// leaf B with a score count of 0, and leaf C with a score count of 4. In this situation, we only compute the timing
// type slice start/end time based on leaf A and leaf C. This is because leaf B has a start time of zero. And it
// doesn't represent an actual timing; rather, it indicates no invocations.
continue;
}
currentSliceBreakdown.compute(
timingTypeSliceStartTimeKey,
(key, value) -> (value == null) ? sliceLeafTimingTypeStartTime : Math.min(value, sliceLeafTimingTypeStartTime)
);

// compute the sliceEndTime for timingType using max of endTime across slice leaves
final long sliceLeafTimingTypeEndTime = sliceLeafTimingTypeStartTime + currentSliceLeafBreakdownMap.get(
timingType.toString()
);
currentSliceBreakdown.compute(
timingTypeSliceEndTimeKey,
(key, value) -> (value == null) ? sliceLeafTimingTypeEndTime : Math.max(value, sliceLeafTimingTypeEndTime)
);
}
// compute sliceMaxEndTime as max of sliceEndTime across all timing types
sliceMaxEndTime = Math.max(sliceMaxEndTime, currentSliceBreakdown.getOrDefault(timingTypeSliceEndTimeKey, Long.MIN_VALUE));
Expand Down
Loading