BandwidthStatistic


@UnstableApi
public interface BandwidthStatistic

Known direct subclasses
ExponentialWeightedAverageStatistic

A BandwidthStatistic that calculates estimates using an exponential weighted average.

SlidingPercentileBandwidthStatistic

A BandwidthStatistic that calculates estimates based on a sliding window weighted percentile.

SlidingWeightedAverageBandwidthStatistic

A BandwidthStatistic that calculates estimates based on a sliding window weighted average.


The interface for different bandwidth estimation statistics.

Summary

Public methods

abstract void
addSample(long bytes, long durationUs)

Adds a transfer sample to the statistic.

abstract long

Returns the bandwidth estimate in bits per second, or ESTIMATE_NOT_AVAILABLE if there is no estimate available yet.

abstract void

Resets the statistic.

Public methods

addSample

abstract void addSample(long bytes, long durationUs)

Adds a transfer sample to the statistic.

Parameters
long bytes

The number of bytes transferred.

long durationUs

The duration of the transfer, in microseconds.

getBandwidthEstimate

abstract long getBandwidthEstimate()

Returns the bandwidth estimate in bits per second, or ESTIMATE_NOT_AVAILABLE if there is no estimate available yet.

reset

abstract void reset()

Resets the statistic. The statistic should drop all samples and reset to its initial state, similar to right after construction.