Class PingSpaceMapper
java.lang.Object
com.biglybt.core.speedmanager.impl.v2.PingSpaceMapper
Classifies the ping-times and then maps them against the a
grid of upload and download rates.
Create a two dimensional map of upload and download rates. Map onto this
space ping times.
The mesh size will be smaller near zero, and larger higher up.
0 - 100 kByte/sec - 10 kBytes mesh size.
100 - 500 kBytes/sec - 50 kBytes mesh size.
500 - 5000 kBytes/sec - 100 kBytes mesh size.
Anything above 5 MBytes/sec is one region.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classA region on the grid for accumulating counts.(package private) static classClass to return a result. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int(package private) final int(package private) static final int(package private) final int(package private) PingSpaceMapper.GridRegion[][](package private) long(package private) longprivate static final intstatic final intstatic final int(package private) int -
Constructor Summary
ConstructorsConstructorDescriptionPingSpaceMapper(int _goodPingInMilliSec, int _badPingInMilliSec) Create a grid and define good and bad ping times. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetricToMap(int metric) private PingSpaceMapper.Result[]Look at the Map and find the highest index for each category.private longconvertBitsPerSec2meshIndex(long bitsPerSec) We have a hard coded mesh.private intconvertMeshIndex2bitsPerSec(int meshIndex) The reverse of bit/sec -> mesh index calculation.private voidprivate PingSpaceMapper.Resultprivate PingSpaceMapper.ResultintMake a guess at the download capacity based on metric data.intMake a guess at the upload capacity based on metric data.booleanhadChockingPing(boolean isDownloadTest) Try to determine if a chocking ping occured during this test.voidreset()Start accumulating data from scratch.voidsetCurrentTransferRates(long downloadBitPerSec, long uploadBitsPerSec)
-
Field Details
-
gridRegion
PingSpaceMapper.GridRegion[][] gridRegion -
lastDownloadBitsPerSec
long lastDownloadBitsPerSec -
lastUploadBitsPerSec
long lastUploadBitsPerSec -
goodPingInMilliSec
final int goodPingInMilliSec -
badPingInMilliSec
final int badPingInMilliSec -
totalPointsInMap
int totalPointsInMap -
maxMeshIndex
private static final int maxMeshIndex- See Also:
-
RESULT_UPLOAD_INDEX
public static final int RESULT_UPLOAD_INDEX- See Also:
-
RESULT_DOWNLOAD_INDEX
public static final int RESULT_DOWNLOAD_INDEX- See Also:
-
GOOD_PING_INDEX
static final int GOOD_PING_INDEX- See Also:
-
ANY_PING_INDEX
static final int ANY_PING_INDEX- See Also:
-
-
Constructor Details
-
PingSpaceMapper
public PingSpaceMapper(int _goodPingInMilliSec, int _badPingInMilliSec) Create a grid and define good and bad ping times.- Parameters:
_goodPingInMilliSec- -_badPingInMilliSec- -
-
-
Method Details
-
createNewGrid
private void createNewGrid() -
convertBitsPerSec2meshIndex
private long convertBitsPerSec2meshIndex(long bitsPerSec) We have a hard coded mesh. 0-9999 = 0, 10000-- Parameters:
bitsPerSec- -- Returns:
- - mesh index.
-
convertMeshIndex2bitsPerSec
private int convertMeshIndex2bitsPerSec(int meshIndex) The reverse of bit/sec -> mesh index calculation.- Parameters:
meshIndex- - value between 0 and 70- Returns:
- lowest BitsPerSecond that meets that criteria.
-
setCurrentTransferRates
public void setCurrentTransferRates(long downloadBitPerSec, long uploadBitsPerSec) -
addMetricToMap
public void addMetricToMap(int metric) -
reset
public void reset()Start accumulating data from scratch. -
getHighestMeshIndexWithGoodPing
-
getHighestMeshIndexWithAnyPing
-
hadChockingPing
public boolean hadChockingPing(boolean isDownloadTest) Try to determine if a chocking ping occured during this test.- Parameters:
isDownloadTest- - set true if this is a download_search_test. set false if upload search test.- Returns:
- - true if it appears a chocking ping occured.
-
calculate
Look at the Map and find the highest index for each category.- Returns:
- Result[2], where index 0 is goodPing, index 1 is anyPing
-
guessUploadLimit
public int guessUploadLimit()Make a guess at the upload capacity based on metric data.- Returns:
- -
-
guessDownloadLimit
public int guessDownloadLimit()Make a guess at the download capacity based on metric data.- Returns:
- -
-