feat(memory): 重设计内存卡片并统一二进制容量单位

This commit is contained in:
2026-11-03 16:51:14 +08:00
parent cc38066de2
commit 90ed18e6ac
11 changed files with 186 additions and 17 deletions
+6
View File
@@ -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"]