refactor(project): 清理闲置展示链路与重复采样状态

This commit is contained in:
2026-11-09 00:41:09 +08:00
parent 7b3abe37c5
commit b73d51c953
57 changed files with 210 additions and 2822 deletions
+2 -10
View File
@@ -5,12 +5,6 @@ import Darwin
nonisolated enum SamplingDiagnostics {
static let enabled = ProcessInfo.processInfo.environment["KYMO_DIAGNOSTICS"] == "1"
static func recordTextPresentation(processes: Int, cells: Int) {
guard enabled else { return }
let line = "{\"event\":\"textPresentation\",\"processes\":\(processes),\"createdCells\":\(cells)}\n"
try? FileHandle.standardOutput.write(contentsOf: Data(line.utf8))
}
static func recordEnergy(_ snapshot: ProcessEnergySnapshot) {
guard enabled else { return }
let payload: [String: Any] = ["event": "energy", "recordedAt": Date().timeIntervalSince1970,
@@ -21,14 +15,13 @@ nonisolated enum SamplingDiagnostics {
try? FileHandle.standardOutput.write(contentsOf: data + Data([10]))
}
static func record(_ snapshot: MetricsSnapshot, event: String = "sample", hiddenHostAlive: Bool? = nil, windowNumber: Int? = nil, hoveredPlots: Int? = nil, nativePlots: Int? = nil, pointerInsidePanel: Bool? = nil, plotBounds: [[Double]]? = nil, animatedPlots: Int? = nil) {
static func record(_ snapshot: MetricsSnapshot, event: String = "sample", hiddenHostAlive: Bool? = nil, windowNumber: Int? = nil, hoveredPlots: Int? = nil, nativePlots: Int? = nil, pointerInsidePanel: Bool? = nil, plotBounds: [[Double]]? = nil) {
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
"pid": ProcessInfo.processInfo.processIdentifier
]
payload["hiddenHostAlive"] = hiddenHostAlive
payload["windowNumber"] = windowNumber
@@ -36,7 +29,6 @@ nonisolated enum SamplingDiagnostics {
payload["nativePlots"] = nativePlots
payload["pointerInsidePanel"] = pointerInsidePanel
payload["plotBounds"] = plotBounds
payload["animatedPlots"] = animatedPlots
payload["cpu"] = snapshot.cpu?.usage
payload["cores"] = snapshot.cpu?.cores.count
payload["cpuTemperature"] = snapshot.cpuTemperature