Class SpeedManagerAlgorithmProviderV1
- java.lang.Object
-
- com.biglybt.core.speedmanager.impl.v1.SpeedManagerAlgorithmProviderV1
-
- All Implemented Interfaces:
SpeedManagerAlgorithmProvider
public class SpeedManagerAlgorithmProviderV1 extends java.lang.Object implements SpeedManagerAlgorithmProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SpeedManagerAlgorithmProviderV1.pingSource
-
Field Summary
Fields Modifier and Type Field Description private SpeedManagerAlgorithmProviderAdapter
adapter
private static boolean
ADJUST_DOWNLOAD_ENABLE
private static float
ADJUST_DOWNLOAD_RATIO
private Average
choke_speed_average
private static java.lang.String
CONFIG_CHOKE_PING
private static java.lang.String
CONFIG_DOWNADJ_ENABLE
private static java.lang.String
CONFIG_DOWNADJ_RATIO
private static java.lang.String
CONFIG_FORCED_MIN
private static java.lang.String
CONFIG_LATENCY_FACTOR
private static java.lang.String
CONFIG_MAX_DEC
private static java.lang.String
CONFIG_MAX_INC
private static java.lang.String
CONFIG_MAX_UP
private static java.lang.String
CONFIG_MIN_UP
private static java.lang.String[]
CONFIG_PARAMS
private static int
DECREASING
private int
direction
private static int
FORCED_MAX_TICKS
private static int
FORCED_MIN_AT_START_TICK_LIMIT
private static int
FORCED_MIN_SPEED
private static int
FORCED_MIN_TICKS
private int
idle_average
private boolean
idle_average_set
private int
idle_ticks
private static int
IDLE_UPLOAD_SPEED
private static int
INCREASING
private static int
INITIAL_IDLE_AVERAGE
private static int
LATENCY_FACTOR
private static int
MAX_DECREMENT
private static int
MAX_INCREMENT
private int
max_ping
private static int
MAX_UP
private int
max_upload_average
private static int
MIN_IDLE_AVERAGE
private static int
MIN_UP
private int
mode
private static int
MODE_FORCED_MAX
private static int
MODE_FORCED_MIN
private static int
MODE_RUNNING
private int
mode_ticks
private Average
ping_average_history
private static int
PING_AVERAGE_HISTORY_COUNT
private static int
PING_CHOKE_TIME
private java.util.Map
ping_sources
private int
replacement_contacts
private int
saved_limit
private int
ticks
private static int
UNLIMITED
private Average
upload_average
private Average
upload_short_average
private Average
upload_short_prot_average
-
Fields inherited from interface com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProvider
UPDATE_PERIOD_MILLIS
-
-
Constructor Summary
Constructors Constructor Description SpeedManagerAlgorithmProviderV1(SpeedManagerAlgorithmProviderAdapter _adapter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calculate(SpeedManagerPingSource[] sources)
Called whenever a new set of ping values is available for processingvoid
destroy()
boolean
getAdjustsDownloadLimits()
Indicates whether or not the provider is adjusting download as well as upload limitsint
getCurrentChokeSpeed()
Returns the current view of when choking occursint
getCurrentPingMillis()
int
getIdlePingMillis()
Various getters for interesting info shown in stats viewint
getMaxPingMillis()
int
getMaxUploadSpeed()
protected void
log(java.lang.String str)
void
pingSourceFailed(SpeedManagerPingSource source)
Ping source has failedvoid
pingSourceFound(SpeedManagerPingSource source, boolean is_replacement)
Called when a new source of ping times has been foundvoid
reset()
Reset any state to start of day valuesvoid
updateStats()
Called periodically (see period above) to allow stats to be updated.
-
-
-
Field Detail
-
CONFIG_MIN_UP
private static final java.lang.String CONFIG_MIN_UP
- See Also:
- Constant Field Values
-
CONFIG_MAX_UP
private static final java.lang.String CONFIG_MAX_UP
- See Also:
- Constant Field Values
-
CONFIG_MAX_INC
private static final java.lang.String CONFIG_MAX_INC
- See Also:
- Constant Field Values
-
CONFIG_MAX_DEC
private static final java.lang.String CONFIG_MAX_DEC
- See Also:
- Constant Field Values
-
CONFIG_CHOKE_PING
private static final java.lang.String CONFIG_CHOKE_PING
- See Also:
- Constant Field Values
-
CONFIG_DOWNADJ_ENABLE
private static final java.lang.String CONFIG_DOWNADJ_ENABLE
- See Also:
- Constant Field Values
-
CONFIG_DOWNADJ_RATIO
private static final java.lang.String CONFIG_DOWNADJ_RATIO
- See Also:
- Constant Field Values
-
CONFIG_LATENCY_FACTOR
private static final java.lang.String CONFIG_LATENCY_FACTOR
- See Also:
- Constant Field Values
-
CONFIG_FORCED_MIN
private static final java.lang.String CONFIG_FORCED_MIN
- See Also:
- Constant Field Values
-
PING_CHOKE_TIME
private static int PING_CHOKE_TIME
-
MIN_UP
private static int MIN_UP
-
MAX_UP
private static int MAX_UP
-
ADJUST_DOWNLOAD_ENABLE
private static boolean ADJUST_DOWNLOAD_ENABLE
-
ADJUST_DOWNLOAD_RATIO
private static float ADJUST_DOWNLOAD_RATIO
-
MAX_INCREMENT
private static int MAX_INCREMENT
-
MAX_DECREMENT
private static int MAX_DECREMENT
-
LATENCY_FACTOR
private static int LATENCY_FACTOR
-
FORCED_MIN_SPEED
private static int FORCED_MIN_SPEED
-
CONFIG_PARAMS
private static final java.lang.String[] CONFIG_PARAMS
-
UNLIMITED
private static final int UNLIMITED
- See Also:
- Constant Field Values
-
MODE_RUNNING
private static final int MODE_RUNNING
- See Also:
- Constant Field Values
-
MODE_FORCED_MIN
private static final int MODE_FORCED_MIN
- See Also:
- Constant Field Values
-
MODE_FORCED_MAX
private static final int MODE_FORCED_MAX
- See Also:
- Constant Field Values
-
FORCED_MAX_TICKS
private static final int FORCED_MAX_TICKS
- See Also:
- Constant Field Values
-
FORCED_MIN_TICKS
private static final int FORCED_MIN_TICKS
- See Also:
- Constant Field Values
-
FORCED_MIN_AT_START_TICK_LIMIT
private static final int FORCED_MIN_AT_START_TICK_LIMIT
- See Also:
- Constant Field Values
-
PING_AVERAGE_HISTORY_COUNT
private static final int PING_AVERAGE_HISTORY_COUNT
- See Also:
- Constant Field Values
-
IDLE_UPLOAD_SPEED
private static final int IDLE_UPLOAD_SPEED
- See Also:
- Constant Field Values
-
INITIAL_IDLE_AVERAGE
private static final int INITIAL_IDLE_AVERAGE
- See Also:
- Constant Field Values
-
MIN_IDLE_AVERAGE
private static final int MIN_IDLE_AVERAGE
- See Also:
- Constant Field Values
-
INCREASING
private static final int INCREASING
- See Also:
- Constant Field Values
-
DECREASING
private static final int DECREASING
- See Also:
- Constant Field Values
-
adapter
private final SpeedManagerAlgorithmProviderAdapter adapter
-
upload_average
private final Average upload_average
-
upload_short_average
private final Average upload_short_average
-
upload_short_prot_average
private final Average upload_short_prot_average
-
ping_average_history
private final Average ping_average_history
-
choke_speed_average
private final Average choke_speed_average
-
ping_sources
private java.util.Map ping_sources
-
replacement_contacts
private volatile int replacement_contacts
-
mode
private int mode
-
mode_ticks
private volatile int mode_ticks
-
saved_limit
private int saved_limit
-
direction
private int direction
-
ticks
private int ticks
-
idle_ticks
private int idle_ticks
-
idle_average
private int idle_average
-
idle_average_set
private boolean idle_average_set
-
max_ping
private int max_ping
-
max_upload_average
private int max_upload_average
-
-
Constructor Detail
-
SpeedManagerAlgorithmProviderV1
public SpeedManagerAlgorithmProviderV1(SpeedManagerAlgorithmProviderAdapter _adapter)
-
-
Method Detail
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceSpeedManagerAlgorithmProvider
-
updateStats
public void updateStats()
Description copied from interface:SpeedManagerAlgorithmProvider
Called periodically (see period above) to allow stats to be updated.- Specified by:
updateStats
in interfaceSpeedManagerAlgorithmProvider
-
reset
public void reset()
Description copied from interface:SpeedManagerAlgorithmProvider
Reset any state to start of day values- Specified by:
reset
in interfaceSpeedManagerAlgorithmProvider
-
pingSourceFound
public void pingSourceFound(SpeedManagerPingSource source, boolean is_replacement)
Description copied from interface:SpeedManagerAlgorithmProvider
Called when a new source of ping times has been found- Specified by:
pingSourceFound
in interfaceSpeedManagerAlgorithmProvider
is_replacement
- One of the initial sources or a replacement for a failed one
-
pingSourceFailed
public void pingSourceFailed(SpeedManagerPingSource source)
Description copied from interface:SpeedManagerAlgorithmProvider
Ping source has failed- Specified by:
pingSourceFailed
in interfaceSpeedManagerAlgorithmProvider
-
calculate
public void calculate(SpeedManagerPingSource[] sources)
Description copied from interface:SpeedManagerAlgorithmProvider
Called whenever a new set of ping values is available for processing- Specified by:
calculate
in interfaceSpeedManagerAlgorithmProvider
-
getIdlePingMillis
public int getIdlePingMillis()
Description copied from interface:SpeedManagerAlgorithmProvider
Various getters for interesting info shown in stats view- Specified by:
getIdlePingMillis
in interfaceSpeedManagerAlgorithmProvider
- Returns:
-
getCurrentPingMillis
public int getCurrentPingMillis()
- Specified by:
getCurrentPingMillis
in interfaceSpeedManagerAlgorithmProvider
-
getMaxPingMillis
public int getMaxPingMillis()
- Specified by:
getMaxPingMillis
in interfaceSpeedManagerAlgorithmProvider
-
getCurrentChokeSpeed
public int getCurrentChokeSpeed()
Returns the current view of when choking occurs- Specified by:
getCurrentChokeSpeed
in interfaceSpeedManagerAlgorithmProvider
- Returns:
- speed in bytes/sec
-
getMaxUploadSpeed
public int getMaxUploadSpeed()
- Specified by:
getMaxUploadSpeed
in interfaceSpeedManagerAlgorithmProvider
-
getAdjustsDownloadLimits
public boolean getAdjustsDownloadLimits()
Description copied from interface:SpeedManagerAlgorithmProvider
Indicates whether or not the provider is adjusting download as well as upload limits- Specified by:
getAdjustsDownloadLimits
in interfaceSpeedManagerAlgorithmProvider
- Returns:
-
log
protected void log(java.lang.String str)
-
-