perf(efficiency): 落实首批采样减负与发行包瘦身

This commit is contained in:
2026-11-03 23:19:52 +08:00
parent 935701fca6
commit def3b1e130
40 changed files with 483 additions and 291 deletions
@@ -9,6 +9,8 @@ nonisolated enum SamplingDiagnostics {
guard enabled else { return }
var payload: [String: Any] = [
"event": event, "timestamp": snapshot.date.timeIntervalSince1970,
"recordedAt": Date().timeIntervalSince1970,
"uptime": ProcessInfo.processInfo.systemUptime,
"pid": ProcessInfo.processInfo.processIdentifier,
"load": snapshot.load
]
@@ -44,6 +46,7 @@ nonisolated enum SamplingDiagnostics {
if status == KERN_SUCCESS {
payload["residentBytes"] = info.resident_size
payload["footprintBytes"] = info.phys_footprint
payload["peakFootprintBytes"] = info.ledger_phys_footprint_peak
}
guard let data = try? JSONSerialization.data(withJSONObject: payload, options: [.sortedKeys]) else { return }
try? FileHandle.standardOutput.write(contentsOf: data + Data([10]))