perf(efficiency): 落实首批采样减负与发行包瘦身
This commit is contained in:
@@ -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]))
|
||||
|
||||
Reference in New Issue
Block a user