feat(memory): 重设计内存卡片并统一二进制容量单位
This commit is contained in:
@@ -11,6 +11,12 @@ nonisolated enum MetricFormat {
|
||||
return String(format: "%.1f GB", Double(value) / 1_000_000_000)
|
||||
}
|
||||
|
||||
static func memory(_ value: UInt64?) -> String {
|
||||
guard let value else { return "--" }
|
||||
if value == 0 { return "0 B" }
|
||||
return String(format: "%.1f GiB", Double(value) / 1_073_741_824)
|
||||
}
|
||||
|
||||
static func rate(_ value: Double?) -> String {
|
||||
guard let value, value.isFinite, value >= 0 else { return "--" }
|
||||
let units = ["B/s", "KB/s", "MB/s", "GB/s", "TB/s"]
|
||||
|
||||
Reference in New Issue
Block a user