LatencyTracker
Collects latency samples and computes percentile statistics. Not thread-safe - confine to a single coroutine or use external serialization.
val tracker = LatencyTracker()
repeat(50) {
tracker.measure { peripheral.read(characteristic) }
}
val stats = tracker.summarize("GATT read")
println("p50=${stats.p50}, p95=${stats.p95}, p99=${stats.p99}")Content copied to clipboard