public class SyntheticREDQueue extends Object implements BandwidthEstimator
| Constructor and Description |
|---|
SyntheticREDQueue(I2PAppContext ctx,
int bwBps)Construct with default queue size thresholds based on bandwidth. |
SyntheticREDQueue(I2PAppContext ctx,
int bwBps,
int minThB,
int maxThB)Construct specifying bandwidth and queue size thresholds. |
| Modifier and Type | Method and Description |
|---|---|
void | addSample(int size)Unconditionally accepts the given packet size. |
void | dispose()Remove this instance from the tuning list. |
static void | expungeStaleInstances()Remove cleared (GC'd) weak references from the list. |
float | getBandwidthEstimate()Returns the current bandwidth estimate in bytes/ms. |
static float | getCurrentMaxDropProbability()Returns current max drop probability across all instances. |
static int | getCurrentMaxThreshold()Returns the maximum threshold from the first active instance, or -1 if none. |
static int | getCurrentMinThreshold()Returns the minimum threshold from the first active instance, or -1 if none. |
static List<SyntheticREDQueue> | getInstances()Returns a snapshot of all active SyntheticREDQueue instances. |
int | getMaxBandwidth() |
float | getMaxDropProbability()Returns the current max drop probability. |
int | getMaxThreshold()Returns the current maximum threshold in bytes. |
int | getMinThreshold()Returns the current minimum threshold in bytes. |
float | getQueueSizeEstimate()Returns the current estimated average queue size in bytes. |
boolean | offer(int size,
float factor)Offer a packet to the queue. |
String | toString()Returns a human-readable string displaying the current bandwidth and queue size estimates,
formatted for debugging or informational output. |
static void | updateAllMaxDropProbability(float probability)Update max drop probability on all active instances. |
static void | updateAllMaxThresholds(int threshold)Update max threshold on all active instances. |
static void | updateAllMinThresholds(int threshold)Update min threshold on all active instances. |
public SyntheticREDQueue(I2PAppContext ctx, int bwBps)
ctx - the I2P application contextbwBps - nominal output bandwidth in bytes per secondpublic SyntheticREDQueue(I2PAppContext ctx, int bwBps, int minThB, int maxThB)
ctx - the I2P application contextbwBps - nominal output bandwidth in bytes per secondminThB - minimum threshold queue size to start dropping (Bytes)maxThB - maximum threshold queue size to drop all packets (Bytes)public void addSample(int size)
addSample in interface BandwidthEstimatorsize - size of packet in bytespublic void dispose()
public static void expungeStaleInstances()
public float getBandwidthEstimate()
getBandwidthEstimate in interface BandwidthEstimatorpublic static float getCurrentMaxDropProbability()
public static int getCurrentMaxThreshold()
public static int getCurrentMinThreshold()
public static List<SyntheticREDQueue> getInstances()
public int getMaxBandwidth()
public float getMaxDropProbability()
public int getMaxThreshold()
public int getMinThreshold()
public float getQueueSizeEstimate()
public boolean offer(int size,
float factor)size - size in bytes of the packetfactor - drop probability adjustment factor (1.0 for standard, 0 disables dropping)public String toString()
public static void updateAllMaxDropProbability(float probability)
probability - new max drop probability (0.0 - 1.0)public static void updateAllMaxThresholds(int threshold)
threshold - new maximum threshold in bytes (must be greater than min)public static void updateAllMinThresholds(int threshold)
threshold - new minimum threshold in bytes (must be less than max)