ThroughputTracker

class ThroughputTracker(windowSize: Int = 10, timeSource: TimeSource = TimeSource.Monotonic)(source)

Sliding window throughput tracker to calculate current transfer speed in bytes per second. Adapted from kmp-ble's DfuProgress throughput tracking.

Constructors

Link copied to clipboard
constructor(windowSize: Int = 10, timeSource: TimeSource = TimeSource.Monotonic)

Functions

Link copied to clipboard

Returns the current throughput in bytes per second based on the sliding window.

Link copied to clipboard
fun record(bytesSent: Long)

Record that bytesSent total bytes have been sent at the current time.