Class SpeedManagerImpl
java.lang.Object
com.biglybt.core.speedmanager.impl.SpeedManagerImpl
- All Implemented Interfaces:
SpeedManagerAlgorithmProviderAdapter
,SpeedManager
,AEDiagnosticsEvidenceGenerator
public class SpeedManagerImpl
extends Object
implements SpeedManager, SpeedManagerAlgorithmProviderAdapter, AEDiagnosticsEvidenceGenerator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final SpeedManagerAdapter
private String
private static final int
private static final int
private static final String
private static final String
private static final String[]
static final String
static final String
private static final int
private static final int
(package private) final Map
private SpeedManagerImpl.pingContact[]
(package private) final Core
private static boolean
(package private) final AsyncDispatcher
private static boolean
private boolean
private final CopyOnWriteList
private final AEDiagnosticsLogger
private static final int
private static final int
(package private) static final int
private static final int
private Object
(package private) final SpeedManagerPingMapperImpl
(package private) final SpeedManagerPingMapperImpl[]
private static final boolean
private SpeedManagerAlgorithmProvider
private int
private static final int
private static final int
(package private) static final int
private static final int
private static final int
private DHTSpeedTester
private int
private final CopyOnWriteList
protected static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
addPingHistory
(int rtt, boolean re_base) private void
Creates a mapper starting from current time.protected void
destroy
(SpeedManagerPingMapper mapper) protected void
void
generate
(IndentWriter writer) getASN()
int
Returns the current view of when choking occursint
int
int
int
int
int
int
int
int
int
protected void
protected void
informListeners
(int type) protected void
boolean
boolean
void
void
void
reset()
void
setCurrentDownloadLimit
(int bytes_per_second) void
setCurrentUploadLimit
(int bytes_per_second) void
setEnabled
(boolean _enabled) protected void
setEnabledSupport
(boolean _enabled) void
setEstimatedDownloadCapacityBytesPerSec
(int bytes_per_sec, float metric) void
setEstimatedUploadCapacityBytesPerSec
(int bytes_per_sec, float metric) void
setLoggingEnabled
(boolean enabled) void
setSpeedTester
(DHTSpeedTester _tester)
-
Field Details
-
UPDATE_PERIOD_MILLIS
protected static final int UPDATE_PERIOD_MILLIS- See Also:
-
CONTACT_NUMBER
private static final int CONTACT_NUMBER- See Also:
-
CONTACT_PING_SECS
private static final int CONTACT_PING_SECS- See Also:
-
LONG_PERIOD_SECS
private static final int LONG_PERIOD_SECS- See Also:
-
LONG_PERIOD_TICKS
private static final int LONG_PERIOD_TICKS- See Also:
-
SHORT_ESTIMATE_SECS
private static final int SHORT_ESTIMATE_SECS- See Also:
-
MEDIUM_ESTIMATE_SECS
private static final int MEDIUM_ESTIMATE_SECS- See Also:
-
SHORT_ESTIMATE_SAMPLES
static final int SHORT_ESTIMATE_SAMPLES- See Also:
-
MEDIUM_ESTIMATE_SAMPLES
static final int MEDIUM_ESTIMATE_SAMPLES- See Also:
-
SAVE_PERIOD_SECS
private static final int SAVE_PERIOD_SECS- See Also:
-
SAVE_PERIOD_TICKS
private static final int SAVE_PERIOD_TICKS- See Also:
-
AUTO_ADJUST_PERIOD_SECS
private static final int AUTO_ADJUST_PERIOD_SECS- See Also:
-
AUTO_ADJUST_PERIOD_TICKS
private static final int AUTO_ADJUST_PERIOD_TICKS- See Also:
-
SPEED_AVERAGE_PERIOD
private static final int SPEED_AVERAGE_PERIOD- See Also:
-
DEBUG
private static boolean DEBUG -
CONFIG_VERSION_STR
- See Also:
-
CONFIG_VERSION
- See Also:
-
CONFIG_AVAIL
- See Also:
-
CONFIG_DEBUG
- See Also:
-
CONFIG_PARAMS
-
emulated_ping_source
private static boolean emulated_ping_source -
core
-
speed_tester
-
adapter
-
provider
-
provider_version
private int provider_version -
enabled
private boolean enabled -
pm_enabled
private static final boolean pm_enabled- See Also:
-
contacts
-
total_contacts
private volatile int total_contacts -
contacts_array
-
original_limits
-
dispatcher
-
ping_mapper
-
ping_mappers
-
transient_mappers
-
logger
-
asn
-
listeners
-
-
Constructor Details
-
SpeedManagerImpl
-
-
Method Details
-
getSpeedManager
- Specified by:
getSpeedManager
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getASN
- Specified by:
getASN
in interfaceSpeedManager
-
getEstimatedUploadCapacityBytesPerSec
- Specified by:
getEstimatedUploadCapacityBytesPerSec
in interfaceSpeedManager
-
setEstimatedUploadCapacityBytesPerSec
public void setEstimatedUploadCapacityBytesPerSec(int bytes_per_sec, float metric) - Specified by:
setEstimatedUploadCapacityBytesPerSec
in interfaceSpeedManager
-
getEstimatedDownloadCapacityBytesPerSec
- Specified by:
getEstimatedDownloadCapacityBytesPerSec
in interfaceSpeedManager
-
setEstimatedDownloadCapacityBytesPerSec
public void setEstimatedDownloadCapacityBytesPerSec(int bytes_per_sec, float metric) - Specified by:
setEstimatedDownloadCapacityBytesPerSec
in interfaceSpeedManager
-
reset
public void reset()- Specified by:
reset
in interfaceSpeedManager
-
enableOrAlgChanged
protected void enableOrAlgChanged() -
createTransientPingMapper
Description copied from interface:SpeedManagerAlgorithmProviderAdapter
Creates a mapper starting from current time. Must be destroyed by calling "destroy" when done with- Specified by:
createTransientPingMapper
in interfaceSpeedManagerAlgorithmProviderAdapter
- Returns:
-
destroy
-
setSpeedTester
- Specified by:
setSpeedTester
in interfaceSpeedManager
-
addPingHistory
protected void addPingHistory(int rtt, boolean re_base) -
isAvailable
public boolean isAvailable()- Specified by:
isAvailable
in interfaceSpeedManager
-
setEnabled
public void setEnabled(boolean _enabled) - Specified by:
setEnabled
in interfaceSpeedManager
-
setEnabledSupport
protected void setEnabledSupport(boolean _enabled) -
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceSpeedManager
-
getSpeedTester
- Specified by:
getSpeedTester
in interfaceSpeedManager
-
getPingSources
- Specified by:
getPingSources
in interfaceSpeedManager
-
getActiveMapper
- Specified by:
getActiveMapper
in interfaceSpeedManager
-
getPingMapper
- Specified by:
getPingMapper
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getMappers
- Specified by:
getMappers
in interfaceSpeedManager
-
getIdlePingMillis
public int getIdlePingMillis() -
getCurrentPingMillis
public int getCurrentPingMillis() -
getMaxPingMillis
public int getMaxPingMillis() -
getCurrentChokeSpeed
public int getCurrentChokeSpeed()Returns the current view of when choking occurs- Returns:
- speed in bytes/sec
-
getMaxUploadSpeed
public int getMaxUploadSpeed() -
getCurrentUploadLimit
public int getCurrentUploadLimit()- Specified by:
getCurrentUploadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
setCurrentUploadLimit
public void setCurrentUploadLimit(int bytes_per_second) - Specified by:
setCurrentUploadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentDownloadLimit
public int getCurrentDownloadLimit()- Specified by:
getCurrentDownloadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
setCurrentDownloadLimit
public void setCurrentDownloadLimit(int bytes_per_second) - Specified by:
setCurrentDownloadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentProtocolUploadSpeed
public int getCurrentProtocolUploadSpeed()- Specified by:
getCurrentProtocolUploadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentDataUploadSpeed
public int getCurrentDataUploadSpeed()- Specified by:
getCurrentDataUploadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentDataDownloadSpeed
public int getCurrentDataDownloadSpeed()- Specified by:
getCurrentDataDownloadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentProtocolDownloadSpeed
public int getCurrentProtocolDownloadSpeed()- Specified by:
getCurrentProtocolDownloadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
autoAdjust
private void autoAdjust() -
setLoggingEnabled
public void setLoggingEnabled(boolean enabled) -
log
- Specified by:
log
in interfaceSpeedManagerAlgorithmProviderAdapter
-
informDownCapChanged
protected void informDownCapChanged() -
informUpCapChanged
protected void informUpCapChanged() -
informListeners
protected void informListeners(int type) -
addListener
- Specified by:
addListener
in interfaceSpeedManager
-
removeListener
- Specified by:
removeListener
in interfaceSpeedManager
-
generate
- Specified by:
generate
in interfaceAEDiagnosticsEvidenceGenerator
-