Class SpeedManagerAlgorithmProviderDHTPing
java.lang.Object
com.biglybt.core.speedmanager.impl.v2.SpeedManagerAlgorithmProviderDHTPing
- All Implemented Interfaces:
COConfigurationListener, SpeedManagerAlgorithmProvider
public class SpeedManagerAlgorithmProviderDHTPing
extends 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
FieldsModifier and TypeFieldDescriptionprivate final SpeedManagerAlgorithmProviderAdapterprivate intprivate intprivate PluginInterfaceprivate booleanprivate intprivate intprivate final SpeedLimitMonitorprivate static intprivate static intprivate static intprivate static intprivate static int(package private) final PingSourceManagerprivate List(package private) longprivate static booleanprivate longFields inherited from interface SpeedManagerAlgorithmProvider
UPDATE_PERIOD_MILLIS -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidcalculate(SpeedManagerPingSource[] sources) Called whenever a new set of ping values is available for processingprivate floatcalculateDownTickMultiple(int c) Want to drop rate faster then increase.private booleanDHT Ping data is one of the metrics used.private floatcalculateUpTickMultiple(int c) Want to rise much slower then drop.voidprivate floatThe longer were get the same signal the stronger it is.voiddestroy()private floatdetermineSignalStrength(int currMetricValue) Determined by the vivaldi value and the number of consecutive calculations with the same result.private voidbooleanIndicates whether or not the provider is adjusting download as well as upload limitslongReturns the current view of when choking occursintintVarious getters for interesting info shown in stats viewintlongprotected voidprivate voidlogCurrentData(long downRate, long currDownLimit, long upRate, long currUploadLimit) log "curr-data" line to the AutoSpeed-Beta file.private voidLog the limit status.private voidlogNewLimits(SMUpdate update) voidPing source has failedvoidpingSourceFound(SpeedManagerPingSource source, boolean is_replacement) Called when a new source of ping times has been foundvoidreset()Reset any state to start of day valuesprivate voidsetNewLimits(SMUpdate update) Just update the limits.voidCalled periodically (see period above) to allow stats to be updated.
-
Field Details
-
adapter
-
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
-
lastMetricValue
private int lastMetricValue -
numIntervalsBetweenCal
private static int numIntervalsBetweenCal -
skipIntervalAfterAdjustment
private static boolean skipIntervalAfterAdjustment -
pingTimeList
-
hadAdjustmentLastInterval
private boolean hadAdjustmentLastInterval -
intervalCount
private int intervalCount -
pingSourceManager
-
sessionMaxUploadRate
long sessionMaxUploadRate
-
-
Constructor Details
-
SpeedManagerAlgorithmProviderDHTPing
SpeedManagerAlgorithmProviderDHTPing(SpeedManagerAlgorithmProviderAdapter _adapter)
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroyin interfaceSpeedManagerAlgorithmProvider
-
configurationSaved
public void configurationSaved()- Specified by:
configurationSavedin interfaceCOConfigurationListener
-
reset
public void reset()Reset any state to start of day values- Specified by:
resetin interfaceSpeedManagerAlgorithmProvider
-
updateStats
public void updateStats()Called periodically (see period above) to allow stats to be updated.- Specified by:
updateStatsin interfaceSpeedManagerAlgorithmProvider
-
logCurrentData
private void logCurrentData(long downRate, long currDownLimit, long upRate, long currUploadLimit) log "curr-data" line to the AutoSpeed-Beta file.- Parameters:
downRate- -currDownLimit- -upRate- -currUploadLimit- -
-
pingSourceFound
Called when a new source of ping times has been found- Specified by:
pingSourceFoundin interfaceSpeedManagerAlgorithmProvider- Parameters:
source- -is_replacement- One of the initial sources or a replacement for a failed one
-
pingSourceFailed
Ping source has failed- Specified by:
pingSourceFailedin interfaceSpeedManagerAlgorithmProvider- Parameters:
source- -
-
calculate
Called whenever a new set of ping values is available for processing- Specified by:
calculatein 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 calculate method.
-
logNewLimits
-
setNewLimits
-
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 received 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:
getIdlePingMillisin interfaceSpeedManagerAlgorithmProvider- Returns:
- -
-
getCurrentPingMillis
public int getCurrentPingMillis()- Specified by:
getCurrentPingMillisin interfaceSpeedManagerAlgorithmProvider
-
getMaxPingMillis
public int getMaxPingMillis()- Specified by:
getMaxPingMillisin interfaceSpeedManagerAlgorithmProvider
-
getCurrentChokeSpeed
public long getCurrentChokeSpeed()Returns the current view of when choking occurs- Specified by:
getCurrentChokeSpeedin interfaceSpeedManagerAlgorithmProvider- Returns:
- speed in bytes/sec
-
getMaxUploadSpeed
public long getMaxUploadSpeed()- Specified by:
getMaxUploadSpeedin interfaceSpeedManagerAlgorithmProvider
-
getAdjustsDownloadLimits
public boolean getAdjustsDownloadLimits()Description copied from interface:SpeedManagerAlgorithmProviderIndicates whether or not the provider is adjusting download as well as upload limits- Specified by:
getAdjustsDownloadLimitsin interfaceSpeedManagerAlgorithmProvider- Returns:
-
log
-