fix(processes): 对齐活动监视器内存口径与显示单位
This commit is contained in:
@@ -13,7 +13,7 @@ import Observation
|
||||
rows = (0..<500).map { index in
|
||||
ProcessMetrics(id: ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0),
|
||||
name: "worker-\(index)", path: nil, cpu: Double(index) / 100,
|
||||
residentBytes: 10_000_000, threads: 2, restricted: true)
|
||||
footprintBytes: 10_000_000, threads: 2, restricted: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,8 @@ private struct Host: View {
|
||||
precondition(table.numberOfRows == 500 && table.tableColumns.count == 6)
|
||||
precondition(table.frame.width >= table.enclosingScrollView!.contentSize.width - 1, "Native table must fill its viewport")
|
||||
precondition(coordinator.createdCells > 0 && coordinator.createdCells < 200, "Rows must be virtualized")
|
||||
let memoryCell = table.view(atColumn: 4, row: 0, makeIfNecessary: true) as! NSTableCellView
|
||||
precondition(memoryCell.textField?.stringValue == "9.5 MB", "Memory column must match Activity Monitor binary MB display")
|
||||
let chosen = state.rows[10].id
|
||||
table.selectRowIndexes(IndexSet(integer: 10), byExtendingSelection: false)
|
||||
precondition(state.selection == nil, "Native selection must be deferred")
|
||||
@@ -72,7 +74,7 @@ private struct Host: View {
|
||||
await until { table.selectedRow == 489 }
|
||||
precondition(state.selection == chosen, "Selection must follow identity after reordering")
|
||||
for index in 0..<12 {
|
||||
state.rows[0] = ProcessMetrics(id: state.rows[0].id, name: "updated-\(index)", path: nil, cpu: Double(index), residentBytes: nil, threads: nil, restricted: false)
|
||||
state.rows[0] = ProcessMetrics(id: state.rows[0].id, name: "updated-\(index)", path: nil, cpu: Double(index), footprintBytes: nil, threads: nil, restricted: false)
|
||||
try? await Task.sleep(for: .milliseconds(20))
|
||||
}
|
||||
let visible = table.rows(in: table.visibleRect)
|
||||
|
||||
Reference in New Issue
Block a user