f0240c3088
- Accumulate utterance PCM in FlowContinuousCapture for batch retry - Run full-utterance transcribeChunk when stitched final lags partial - Refactor Mac MLX tail drain to shared FlowUtteranceEndCoordinator - Add FlowUtterancePCMStore, UtteranceBatchFallbackPolicy, and tests Co-authored-by: Rocky <hkgood@users.noreply.github.com>
57 lines
1.8 KiB
Swift
57 lines
1.8 KiB
Swift
// FlowPipelineDiagnostics.swift
|
|
// OSGKeyboard · Shared
|
|
//
|
|
// Structured Flow pipeline metrics for Console.app filtering.
|
|
|
|
import Foundation
|
|
import os
|
|
|
|
public enum FlowPipelineDiagnostics {
|
|
public static func logDrain(_ report: FlowCaptureDrainReport) {
|
|
OSGLog.flow.info(
|
|
"tailDrain duration=\(report.drainDurationSeconds, format: .fixed(precision: 2))s " +
|
|
"postRoll=\(report.postRollDurationSeconds, format: .fixed(precision: 2))s " +
|
|
"silenceEnd=\(report.endedBySilence) tailSamples=\(report.tailSampleCount)"
|
|
)
|
|
}
|
|
|
|
public static func logTranscriptGuardUsedPartial(finalLength: Int, partialLength: Int) {
|
|
OSGLog.flow.warning(
|
|
"transcriptGuard partial preferred finalLen=\(finalLength) partialLen=\(partialLength)"
|
|
)
|
|
}
|
|
|
|
public static func logFinalChunkRecovery(action: String, chunkIndex: Int) {
|
|
OSGLog.asr.info("finalChunkRecovery \(action) chunk=\(chunkIndex)")
|
|
}
|
|
|
|
public static func logBatchFallback(
|
|
sampleCount: Int,
|
|
stitchedLength: Int,
|
|
partialLength: Int,
|
|
batchLength: Int
|
|
) {
|
|
OSGLog.flow.info(
|
|
"batchFallback samples=\(sampleCount) stitchedLen=\(stitchedLength) " +
|
|
"partialLen=\(partialLength) batchLen=\(batchLength)"
|
|
)
|
|
}
|
|
|
|
public static func logChunkFinalize(
|
|
chunkCount: Int,
|
|
lastChunkSamples: Int,
|
|
stitchedLength: Int,
|
|
chunkWarnings: Int
|
|
) {
|
|
OSGLog.flow.info(
|
|
"chunkPipeline chunks=\(chunkCount) lastChunkSamples=\(lastChunkSamples) stitchedLen=\(stitchedLength) warnings=\(chunkWarnings)"
|
|
)
|
|
}
|
|
|
|
public static func logStitcherSafeFallback(naiveLength: Int, mergedLength: Int) {
|
|
OSGLog.asr.warning(
|
|
"stitcher safe fallback naive=\(naiveLength) merged=\(mergedLength)"
|
|
)
|
|
}
|
|
}
|