Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

refactor(bench): keep stop logging within lint limits

altic-dev4e00cf6b3c08
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 794a3c51..b4b29f60 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -2577,9 +2577,7 @@ struct ContentView: View {
private func processStoppedTranscription(route: DictationOutputRoute, pipelineID: String, toggleStopRequestedAt: TimeInterval?) async {
let pipelineStartedAt = ProcessInfo.processInfo.systemUptime
let expectedOverlayLifecycleID = self.overlayLifecycleID
- var loadAverages = [Double](repeating: 0, count: 3)
- let loadSampleCount = getloadavg(&loadAverages, 3)
- let loadAverageField = loadSampleCount > 0 ? String(format: "%.1f", loadAverages[0]) : "nil"
+ let loadAverageField = self.benchmarkLoadAverage()
self.appBench("pipeline_begin id=\(pipelineID) route=\(route.rawValue) toggleStopRequestedAt=\(toggleStopRequestedAt.map { String($0) } ?? "nil") loadAvg1m=\(loadAverageField)")
defer {
self.appBench("pipeline_handler_return id=\(pipelineID) elapsedMs=\((ProcessInfo.processInfo.systemUptime - pipelineStartedAt) * 1000) deliveryMayBePending=true")
@@ -4773,6 +4771,12 @@ extension ContentView {
self.beginDictationRecording(for: .secondary, mode: mode)
}
+ private func benchmarkLoadAverage() -> String {
+ var loadAverages = [Double](repeating: 0, count: 3)
+ let loadSampleCount = getloadavg(&loadAverages, 3)
+ return loadSampleCount > 0 ? String(format: "%.1f", loadAverages[0]) : "nil"
+ }
+
private func appBench(_ message: String) {
DebugLogger.shared.benchmark("APP_BENCH", message: message, source: "AppBenchmark")
}
diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swift
index 1f4f677b..1551000b 100644
--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift
+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift
@@ -781,7 +781,7 @@ final class GlobalHotkeyManager: NSObject {
thread.start()
ready.wait()
- let runLoop = createdRunLoop ?? CFRunLoopGetMain()!
+ let runLoop: CFRunLoop = createdRunLoop ?? CFRunLoopGetMain()
self.keyboardTapRunLoop = runLoop
self.keyboardTapThread = thread
return runLoop