Class NetworkAdminSpeedTesterBTImpl.TorrentSpeedTestMonitorThread
java.lang.Object
java.lang.Thread
com.biglybt.core.networkmanager.admin.impl.NetworkAdminSpeedTesterBTImpl.TorrentSpeedTestMonitorThread
- All Implemented Interfaces:
Runnable
- Enclosing class:
- NetworkAdminSpeedTesterBTImpl
-------------------- helper class to monitor test. -------------------
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
(package private) final List
(package private) final List
static final long
static final long
(package private) long
(package private) long
(package private) long
static final String
(package private) final Download
(package private) final List
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Map
Calculate the avererage and standard deviation for a history.(package private) NetworkAdminSpeedTesterResult
Based on the previous data cancluate an average and a standard deviation.(package private) long
checkForNewPeakValue
(DownloadStats stat, long lastTotalDownload, long currTime) We set a new "peak" value if it has exceeded the previous peak value by 10%.(package private) boolean
In this version the test is limited to MAX_TEST_TIME since the start of the test of MAX_PEAK_TIME (i.e.private List
convertSumToDeltas
(List sumHistory) Convert a list of sums into a list of download rates per second.private int
findIndexPeak
(int numStats) void
run()
void
updateTestProgress
(long currTime, DownloadStats stats) Calculate the test progression as a value between 0-100.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
historyDownloadSpeed
-
historyUploadSpeed
-
timestamps
-
testDownload
-
MAX_TEST_TIME
public static final long MAX_TEST_TIME- See Also:
-
MAX_PEAK_TIME
public static final long MAX_PEAK_TIME- See Also:
-
startTime
long startTime -
peakTime
long peakTime -
peakRate
long peakRate -
AVE
- See Also:
-
STD_DEV
- See Also:
-
-
Constructor Details
-
TorrentSpeedTestMonitorThread
-
-
Method Details
-
run
public void run() -
updateTestProgress
Calculate the test progression as a value between 0-100.- Parameters:
currTime
- - current time as long.stats
- - Download stats
-
calculate
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:
- Map<String,Double> with values "ave" and "stddev" set
-
convertSumToDeltas
Convert a list of sums into a list of download rates per second.- Parameters:
sumHistory
- - Listwith 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:
- Map<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
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.
-