Class SpeedManagerPingMapperImpl
- java.lang.Object
-
- com.biglybt.core.speedmanager.impl.SpeedManagerPingMapperImpl
-
- All Implemented Interfaces:
SpeedManagerPingMapper
class SpeedManagerPingMapperImpl extends java.lang.Object implements SpeedManagerPingMapper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SpeedManagerPingMapperImpl.limitEstimate
private static class
SpeedManagerPingMapperImpl.pingValue
private static class
SpeedManagerPingMapperImpl.region
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
SpeedManagerPingMapperImpl(SpeedManagerImpl _speed_manager, java.lang.String _name, int _entries, boolean _variance, boolean _transient)
-
Method Summary
-
-
-
Field Detail
-
VARIANCE_GOOD_VALUE
static final int VARIANCE_GOOD_VALUE
- See Also:
- Constant Field Values
-
VARIANCE_BAD_VALUE
static final int VARIANCE_BAD_VALUE
- See Also:
- Constant Field Values
-
VARIANCE_MAX
static final int VARIANCE_MAX
- See Also:
- Constant Field Values
-
RTT_BAD_MIN
static final int RTT_BAD_MIN
- See Also:
- Constant Field Values
-
RTT_BAD_MAX
static final int RTT_BAD_MAX
- See Also:
- Constant Field Values
-
RTT_MAX
static final int RTT_MAX
- See Also:
- Constant Field Values
-
MAX_BAD_LIMIT_HISTORY
static final int MAX_BAD_LIMIT_HISTORY
- See Also:
- Constant Field Values
-
SPEED_DIVISOR
static final int SPEED_DIVISOR
- See Also:
- Constant Field Values
-
SPEED_HISTORY_PERIOD
private static final int SPEED_HISTORY_PERIOD
- See Also:
- Constant Field Values
-
SPEED_HISTORY_COUNT
private static final int SPEED_HISTORY_COUNT
- See Also:
- Constant Field Values
-
speed_manager
private final SpeedManagerImpl speed_manager
-
name
private final java.lang.String name
-
variance
private final boolean variance
-
trans
private final boolean trans
-
ping_count
private int ping_count
-
pings
private SpeedManagerPingMapperImpl.pingValue[] pings
-
max_pings
private final int max_pings
-
prev_ping
private SpeedManagerPingMapperImpl.pingValue prev_ping
-
x_speeds
private final int[] x_speeds
-
y_speeds
private final int[] y_speeds
-
speeds_next
private int speeds_next
-
regions
private java.util.LinkedList regions
-
last_x
private int last_x
-
last_y
private int last_y
-
recent_metrics
private final int[] recent_metrics
-
recent_metrics_next
private int recent_metrics_next
-
up_estimate
private SpeedManagerPingMapperImpl.limitEstimate up_estimate
-
down_estimate
private SpeedManagerPingMapperImpl.limitEstimate down_estimate
-
last_bad_ups
private java.util.LinkedList last_bad_ups
-
last_bad_downs
private java.util.LinkedList last_bad_downs
-
BAD_PROGRESS_COUNTDOWN
private static final int BAD_PROGRESS_COUNTDOWN
- See Also:
- Constant Field Values
-
last_bad_up
private SpeedManagerPingMapperImpl.limitEstimate last_bad_up
-
bad_up_in_progress_count
private int bad_up_in_progress_count
-
last_bad_down
private SpeedManagerPingMapperImpl.limitEstimate last_bad_down
-
bad_down_in_progress_count
private int bad_down_in_progress_count
-
best_good_up
private SpeedManagerPingMapperImpl.limitEstimate best_good_up
-
best_good_down
private SpeedManagerPingMapperImpl.limitEstimate best_good_down
-
up_capacity
private SpeedManagerPingMapperImpl.limitEstimate up_capacity
-
down_capacity
private SpeedManagerPingMapperImpl.limitEstimate down_capacity
-
history_file
private java.io.File history_file
-
-
Constructor Detail
-
SpeedManagerPingMapperImpl
protected SpeedManagerPingMapperImpl(SpeedManagerImpl _speed_manager, java.lang.String _name, int _entries, boolean _variance, boolean _transient)
-
-
Method Detail
-
init
protected void init()
-
loadHistory
protected void loadHistory(java.io.File file)
-
saveHistory
protected void saveHistory()
-
loadLimits
protected java.util.LinkedList loadLimits(java.util.Map map, java.lang.String name)
-
loadLimit
protected SpeedManagerPingMapperImpl.limitEstimate loadLimit(java.util.Map m)
-
saveLimits
protected void saveLimits(java.util.Map map, java.lang.String name, java.util.List limits)
-
saveLimit
protected java.util.Map saveLimit(SpeedManagerPingMapperImpl.limitEstimate limit)
-
isActive
public boolean isActive()
- Specified by:
isActive
in interfaceSpeedManagerPingMapper
-
getNullLimit
protected SpeedManagerPingMapperImpl.limitEstimate getNullLimit()
-
getLimitString
protected java.lang.String getLimitString(java.util.List limits)
-
log
protected void log(java.lang.String str)
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceSpeedManagerPingMapper
-
addSpeed
protected void addSpeed(int x, int y)
-
addSpeedSupport
protected void addSpeedSupport(int x, int y)
-
addPing
protected void addPing(int x, int y, int rtt, boolean re_base)
-
addPingSupport
protected SpeedManagerPingMapperImpl.region addPingSupport(int x, int y, int rtt, int metric)
-
getHistory
public int[][] getHistory()
- Specified by:
getHistory
in interfaceSpeedManagerPingMapper
-
getZones
public SpeedManagerPingZone[] getZones()
- Specified by:
getZones
in interfaceSpeedManagerPingMapper
-
getEstimatedUploadLimit
public SpeedManagerLimitEstimate getEstimatedUploadLimit(boolean persistent)
- Specified by:
getEstimatedUploadLimit
in interfaceSpeedManagerPingMapper
-
getEstimatedDownloadLimit
public SpeedManagerLimitEstimate getEstimatedDownloadLimit(boolean persistent)
- Specified by:
getEstimatedDownloadLimit
in interfaceSpeedManagerPingMapper
-
getLastBadUploadLimit
public SpeedManagerLimitEstimate getLastBadUploadLimit()
- Specified by:
getLastBadUploadLimit
in interfaceSpeedManagerPingMapper
-
getLastBadDownloadLimit
public SpeedManagerLimitEstimate getLastBadDownloadLimit()
- Specified by:
getLastBadDownloadLimit
in interfaceSpeedManagerPingMapper
-
getBadUploadHistory
public SpeedManagerLimitEstimate[] getBadUploadHistory()
- Specified by:
getBadUploadHistory
in interfaceSpeedManagerPingMapper
-
getBadDownloadHistory
public SpeedManagerLimitEstimate[] getBadDownloadHistory()
- Specified by:
getBadDownloadHistory
in interfaceSpeedManagerPingMapper
-
adjustForPersistence
protected SpeedManagerLimitEstimate adjustForPersistence(SpeedManagerPingMapperImpl.limitEstimate estimate, SpeedManagerPingMapperImpl.limitEstimate best_good, SpeedManagerPingMapperImpl.limitEstimate last_bad, boolean persistent)
-
updateLimitEstimates
protected void updateLimitEstimates()
-
checkCapacityDecrease
protected void checkCapacityDecrease(boolean is_up, SpeedManagerPingMapperImpl.limitEstimate capacity, java.util.LinkedList bads)
-
getEstimatedLimit
protected SpeedManagerPingMapperImpl.limitEstimate getEstimatedLimit(boolean up)
-
getCurrentMetricRating
public double getCurrentMetricRating()
Description copied from interface:SpeedManagerPingMapper
+1 : good -1 : bad >-1 <+1 : relative goodness/badness- Specified by:
getCurrentMetricRating
in interfaceSpeedManagerPingMapper
- Returns:
-
getEstimatedUploadCapacityBytesPerSec
public SpeedManagerLimitEstimate getEstimatedUploadCapacityBytesPerSec()
-
setEstimatedDownloadCapacityBytesPerSec
public void setEstimatedDownloadCapacityBytesPerSec(int bytes_per_sec, float estimate_type)
-
getEstimatedDownloadCapacityBytesPerSec
public SpeedManagerLimitEstimate getEstimatedDownloadCapacityBytesPerSec()
-
setEstimatedUploadCapacityBytesPerSec
public void setEstimatedUploadCapacityBytesPerSec(int bytes_per_sec, float estimate_type)
-
reset
protected void reset()
-
convertMetricToRating
protected double convertMetricToRating(int metric)
-
getLimitStr
protected java.lang.String getLimitStr(java.util.List limits, boolean short_form)
-
getShortString
protected java.lang.String getShortString(SpeedManagerLimitEstimate l)
-
generateEvidence
protected void generateEvidence(IndentWriter writer)
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceSpeedManagerPingMapper
-
main
public static void main(java.lang.String[] args)
-
-