Class NetworkAdminSpeedTesterBTImpl.TorrentSpeedTestMonitorThread

java.lang.Object
java.lang.Thread
com.biglybt.core.networkmanager.admin.impl.NetworkAdminSpeedTesterBTImpl.TorrentSpeedTestMonitorThread
All Implemented Interfaces:
Runnable
Enclosing class:
NetworkAdminSpeedTesterBTImpl

private class NetworkAdminSpeedTesterBTImpl.TorrentSpeedTestMonitorThread extends Thread
-------------------- helper class to monitor test. -------------------
  • Field Details

  • Constructor Details

    • TorrentSpeedTestMonitorThread

      public TorrentSpeedTestMonitorThread(Download d)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • updateTestProgress

      public void updateTestProgress(long currTime, DownloadStats stats)
      Calculate the test progression as a value between 0-100.
      Parameters:
      currTime - - current time as long.
      stats - - Download stats
    • calculate

      private Map calculate(List history)
      Calculate the avererage and standard deviation for a history.
      Parameters:
      history - - List of Long values but that contains the sum downloaded at that time.
      Returns:
      Mapinvalid input: '<'String,Double> with values "ave" and "stddev" set
    • convertSumToDeltas

      private List convertSumToDeltas(List sumHistory)
      Convert a list of sums into a list of download rates per second.
      Parameters:
      sumHistory - - List with download sum for each second.
      Returns:
      - List with the download rate for each second.
    • findIndexPeak

      private int findIndexPeak(int numStats)
    • calculateDownloadRate

      NetworkAdminSpeedTesterResult calculateDownloadRate()
      Based on the previous data cancluate an average and a standard deviation. Return this data in a Map object.
      Returns:
      Mapinvalid input: '<'String,Float> as a contain for stats. Map keys are "ave" and "dev".
    • checkForTestDone

      boolean checkForTestDone()
      In this version the test is limited to MAX_TEST_TIME since the start of the test of MAX_PEAK_TIME (i.e. time since the peak download rate has been reached). Which ever condition is first will finish the download.
      Returns:
      true if the test done condition has been reached.
    • checkForNewPeakValue

      long checkForNewPeakValue(DownloadStats stat, long lastTotalDownload, long currTime)
      We set a new "peak" value if it has exceeded the previous peak value by 10%.
      Parameters:
      stat - -
      lastTotalDownload - -
      currTime - -
      Returns:
      total downloaded so far.