Class SpeedManagerAlgorithmProviderDHTPing
- java.lang.Object
-
- com.biglybt.core.speedmanager.impl.v2.SpeedManagerAlgorithmProviderDHTPing
-
- All Implemented Interfaces:
COConfigurationListener
,SpeedManagerAlgorithmProvider
public class SpeedManagerAlgorithmProviderDHTPing extends java.lang.Object implements SpeedManagerAlgorithmProvider, COConfigurationListener
This class implements an Vivaldi strategy for adjusting the upload limit. It will every 30 seconds calculate the distance to the center of the Vivaldi structure and if it determines that it is going away from it will lower the limit. If it getting closer it will increase the upload limit.
-
-
Field Summary
Fields Modifier and Type Field Description private SpeedManagerAlgorithmProviderAdapter
adapter
private int
consecutiveDownticks
private int
consecutiveUpticks
private PluginInterface
dhtPlugin
private boolean
hadAdjustmentLastInterval
private int
intervalCount
private int
lastMetricValue
private SpeedLimitMonitor
limitMonitor
private static int
metricBadResult
private static int
metricBadTolerance
private static int
metricGoodResult
private static int
metricGoodTolerance
private static int
numIntervalsBetweenCal
(package private) PingSourceManager
pingSourceManager
private java.util.List
pingTimeList
(package private) int
sessionMaxUploadRate
private static boolean
skipIntervalAfterAdjustment
private long
timeSinceLastUpdate
-
Fields inherited from interface com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProvider
UPDATE_PERIOD_MILLIS
-
-
Constructor Summary
Constructors Constructor Description SpeedManagerAlgorithmProviderDHTPing(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 processingprivate float
calculateDownTickMultiple(int c)
Want to drop rate faster then increase.private boolean
calculateMediaDHTPingTime()
DHT Ping data is one of the metrics used.private float
calculateUpTickMultiple(int c)
Want to rise much slower then drop.void
configurationSaved()
private float
consectiveMultiplier()
The longer were get the same signal the stronger it is.void
destroy()
private float
determineSignalStrength(int currMetricValue)
Determined by the vivaldi value and the number of consecutive calculations with the same result.private void
endLimitTesting()
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)
private void
logCurrentData(int downRate, int currDownLimit, int upRate, int currUploadLimit)
log "curr-data" line to the AutoSpeed-Beta file.private void
logLimitStatus()
Log the limit status.private void
logNewLimits(SMUpdate update)
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 valuesprivate void
setNewLimits(SMUpdate update)
Just update the limits.void
updateStats()
Called periodically (see period above) to allow stats to be updated.
-
-
-
Field Detail
-
adapter
private final SpeedManagerAlgorithmProviderAdapter adapter
-
dhtPlugin
private PluginInterface dhtPlugin
-
timeSinceLastUpdate
private long timeSinceLastUpdate
-
metricGoodResult
private static int metricGoodResult
-
metricGoodTolerance
private static int metricGoodTolerance
-
metricBadResult
private static int metricBadResult
-
metricBadTolerance
private static int metricBadTolerance
-
consecutiveUpticks
private int consecutiveUpticks
-
consecutiveDownticks
private int consecutiveDownticks
-
limitMonitor
private final SpeedLimitMonitor limitMonitor
-
lastMetricValue
private int lastMetricValue
-
numIntervalsBetweenCal
private static int numIntervalsBetweenCal
-
skipIntervalAfterAdjustment
private static boolean skipIntervalAfterAdjustment
-
pingTimeList
private java.util.List pingTimeList
-
hadAdjustmentLastInterval
private boolean hadAdjustmentLastInterval
-
intervalCount
private int intervalCount
-
pingSourceManager
final PingSourceManager pingSourceManager
-
sessionMaxUploadRate
int sessionMaxUploadRate
-
-
Constructor Detail
-
SpeedManagerAlgorithmProviderDHTPing
SpeedManagerAlgorithmProviderDHTPing(SpeedManagerAlgorithmProviderAdapter _adapter)
-
-
Method Detail
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceSpeedManagerAlgorithmProvider
-
configurationSaved
public void configurationSaved()
- Specified by:
configurationSaved
in interfaceCOConfigurationListener
-
reset
public void reset()
Reset any state to start of day values- Specified by:
reset
in interfaceSpeedManagerAlgorithmProvider
-
updateStats
public void updateStats()
Called periodically (see period above) to allow stats to be updated.- Specified by:
updateStats
in interfaceSpeedManagerAlgorithmProvider
-
logCurrentData
private void logCurrentData(int downRate, int currDownLimit, int upRate, int currUploadLimit)
log "curr-data" line to the AutoSpeed-Beta file.- Parameters:
downRate
- -currDownLimit
- -upRate
- -currUploadLimit
- -
-
pingSourceFound
public void pingSourceFound(SpeedManagerPingSource source, boolean is_replacement)
Called when a new source of ping times has been found- Specified by:
pingSourceFound
in interfaceSpeedManagerAlgorithmProvider
- Parameters:
source
- -is_replacement
- One of the initial sources or a replacement for a failed one
-
pingSourceFailed
public void pingSourceFailed(SpeedManagerPingSource source)
Ping source has failed- Specified by:
pingSourceFailed
in interfaceSpeedManagerAlgorithmProvider
- Parameters:
source
- -
-
calculate
public void calculate(SpeedManagerPingSource[] sources)
Called whenever a new set of ping values is available for processing- Specified by:
calculate
in interfaceSpeedManagerAlgorithmProvider
- Parameters:
sources
- -
-
endLimitTesting
private void endLimitTesting()
-
logLimitStatus
private void logLimitStatus()
Log the limit status. Max, Min and Conf. log("limits:down-max:down-min:down-conf:up-max:up-min:up-conf");
-
calculateMediaDHTPingTime
private boolean calculateMediaDHTPingTime()
DHT Ping data is one of the metrics used. Calculate it here.- Returns:
- - true if should exit early from the caluculate method.
-
logNewLimits
private void logNewLimits(SMUpdate update)
-
setNewLimits
private void setNewLimits(SMUpdate update)
Just update the limits.- Parameters:
update
- - SMUpdate
-
determineSignalStrength
private float determineSignalStrength(int currMetricValue)
Determined by the vivaldi value and the number of consecutive calculations with the same result.- Parameters:
currMetricValue
- -- Returns:
- -
-
consectiveMultiplier
private float consectiveMultiplier()
The longer were get the same signal the stronger it is. On upticks however we only increase the rates when if the upload or download is saturated.- Returns:
- -
-
calculateUpTickMultiple
private float calculateUpTickMultiple(int c)
Want to rise much slower then drop.- Parameters:
c
- - number of upsignals recieved in a row- Returns:
- - multiple factor.
-
calculateDownTickMultiple
private float calculateDownTickMultiple(int c)
Want to drop rate faster then increase.- Parameters:
c
- -- Returns:
- -
-
getIdlePingMillis
public int getIdlePingMillis()
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)
-
-