Class PingSpaceMapper

java.lang.Object
com.biglybt.core.speedmanager.impl.v2.PingSpaceMapper

public class PingSpaceMapper extends Object
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.
  • Field Details

    • 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

      private PingSpaceMapper.Result getHighestMeshIndexWithGoodPing()
    • getHighestMeshIndexWithAnyPing

      private PingSpaceMapper.Result 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

      private PingSpaceMapper.Result[] 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:
      -