net.i2p.router.transport.udp

## Class SimpleBandwidthEstimator

- java.lang.Object
- - net.i2p.router.transport.udp.SimpleBandwidthEstimator

- All Implemented Interfaces:
    BandwidthEstimator

      class SimpleBandwidthEstimator
      extends Object
      implements BandwidthEstimator

  A Westwood+ bandwidth estimator with: <ul> <li>A first-stage anti-aliasing low-pass filter based on RTT</li> <li>A time-varying EWMA filter based on inter-arrival time</li> </ul> <p>This estimator is adapted from the Linux kernel's <code>tcp_westwood.c</code> implementation and the Westwood+ research paper.</p> <p>Ref: <em>TCP Westwood: End-to-End Congestion Control for Wired/Wireless Networks</em> - Casetti et al.</p> <p>Ref: <em>End-to-End Bandwidth Estimation for Congestion Control in Packet Networks</em> - Grieco and Mascolo.</p> <p>Adapted for I2P streaming transport in 0.9.49.</p>

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleBandwidthEstimator(I2PAppContext ctx, PeerState state)` Creates a new bandwidth estimator for the given peer.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSample(int acked)` Records a new bandwidth sample based on the number of bytes acknowledged.
    `float` | `getBandwidthEstimate()` Returns the current bandwidth estimate in bytes per millisecond.
    `float` | `getBandwidthEstimate(long now)` Returns the current bandwidth estimate at the specified time.
    `String` | `toString()` Returns a string representation of this estimator's current state.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleBandwidthEstimator

          SimpleBandwidthEstimator(I2PAppContext ctx,
                                   PeerState state)

      Creates a new bandwidth estimator for the given peer.
      Parameters:
        `ctx` - I2P application context
        `state` - peer state for RTT and other transport metrics

  - ### Method Detail

    - #### addSample

          public void addSample(int acked)

      Records a new bandwidth sample based on the number of bytes acknowledged.
      Specified by:
        `addSample` in interface `BandwidthEstimator`
      Parameters:
        `acked` - number of bytes newly acknowledged

    - #### getBandwidthEstimate

          public float getBandwidthEstimate()

      Returns the current bandwidth estimate in bytes per millisecond.
      Specified by:
        `getBandwidthEstimate` in interface `BandwidthEstimator`
      Returns:
        bandwidth estimate in bytes per millisecond

    - #### getBandwidthEstimate

          public float getBandwidthEstimate(long now)

      Returns the current bandwidth estimate at the specified time.
      Parameters:
        `now` - current time in milliseconds
      Returns:
        bandwidth estimate in bytes per millisecond

    - #### toString

          public String toString()

      Returns a string representation of this estimator's current state.
      Overrides:
        `toString` in class `Object`
      Returns:
        string representation