ThroughputMeter
Measures data throughput for BLE transfer operations.
Accumulates byte counts and computes throughput over the measurement window. Not thread-safe - confine to a single coroutine or use external serialization.
val meter = ThroughputMeter()
meter.start()
repeat(100) {
val data = peripheral.read(characteristic)
meter.record(data.size)
}
val result = meter.stop("GATT reads")
println("${result.bytesPerSecond / 1024} KB/s")Content copied to clipboard