Fix metric display for data sizes exceeding TB (#14078)#14079
Merged
Conversation
Contributor
Greptile SummaryExtended Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Metric as GPU Task Metric
participant Accumulator as SizeInBytesAccumulator
participant SIB as SizeInBytes
participant Display as Metric Display
Accumulator->>SIB: Create SizeInBytes(value)
Note over SIB: value = raw bytes count
Display->>SIB: toString()
SIB->>SIB: unitVal = value, unitIndex = 0
loop while unitIndex < SizeUnitNames.length && unitVal >= 1024
SIB->>SIB: nextUnitVal = unitVal >> 10
SIB->>SIB: remainVal = unitVal - (nextUnitVal << 10)
SIB->>SIB: unitVal = nextUnitVal
SIB->>SIB: unitIndex += 1
end
Note over SIB: OLD: Array("B", "KB", "MB", "GB", "TB")<br/>NEW: Array("B", "KB", "MB", "GB", "TB", "PB", "EB")
SIB->>SIB: finalVal = (unitVal + remainVal/1024).formatted("%.2f")
SIB->>SIB: result = finalVal + SizeUnitNames(unitIndex) + " (" + value + " bytes)"
SIB-->>Display: Return formatted string
Note over Display: OLD: 1024.00TB for 1PB<br/>NEW: 1.00PB for 1PB
|
Add PB (Petabyte) and EB (Exabyte) units to SizeInBytes.SizeUnitNames to correctly format very large data sizes in metrics. Previously, data sizes over 1TB would display with large TB values (e.g., 1024.00TB) instead of proper larger units (e.g., 1.00PB). Closes NVIDIA#14078 Signed-off-by: Ferdinand Xu <ferdinandx@nvidia.com>
Contributor
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
ebb44ac to
edfa025
Compare
Collaborator
Author
|
build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add PB (Petabyte) and EB (Exabyte) units to SizeInBytes.SizeUnitNames to correctly format very large data sizes in metrics.
Previously, data sizes over 1TB would display with large TB values (e.g., 1024.00TB) instead of proper larger units (e.g., 1.00PB).
Fixes #14078