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 class
A region on the grid for accumulating counts.(package private) static class
Class 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) int
(package private) int
private static final int
static final int
static 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 TypeMethodDescriptionvoid
addMetricToMap
(int metric) private PingSpaceMapper.Result[]
Look at the Map and find the highest index for each category.private int
convertBitsPerSec2meshIndex
(int bitsPerSec) We have a hard coded mesh.private int
convertMeshIndex2bitsPerSec
(int meshIndex) The reverse of bit/sec -> mesh index calculation.private void
private PingSpaceMapper.Result
private PingSpaceMapper.Result
int
Make a guess at the download capacity based on metric data.int
Make a guess at the upload capacity based on metric data.boolean
hadChockingPing
(boolean isDownloadTest) Try to determine if a chocking ping occured during this test.void
reset()
Start accumulating data from scratch.void
setCurrentTransferRates
(int downloadBitPerSec, int uploadBitsPerSec)
-
Field Details
-
gridRegion
PingSpaceMapper.GridRegion[][] gridRegion -
lastDownloadBitsPerSec
int lastDownloadBitsPerSec -
lastUploadBitsPerSec
int 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 int convertBitsPerSec2meshIndex(int 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(int downloadBitPerSec, int 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:
- -
-