Class DownloadManagerStatsImpl
- All Implemented Interfaces:
DownloadManagerStats
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AllTrackersManager.AllTrackers
private int
private final DownloadManagerImpl
private int[]
private long[][]
private int
private static final int
private int
private static final int
private boolean
private static final int
private boolean
private int
private int
private int
private long
private long
private long
private long
private long
private long
private long
private long
private long
private long
private long
private int
private int
private long
private long
private int
private int
private long
private long
(package private) static int
(package private) FrequencyLimitedDispatcher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
protected void
generateEvidence
(IndentWriter writer) float
long
long
int
Find out percentage done of current statelong
long
long
private DiskManager
int
getDownloadCompleted
(boolean bLive) Retrieve the level of download completion, *including* DND files.long
Get the number of bytes of the download that we currently have.int
Get the max download rate allowed for this download.long
getETA()
*deprecated - use getSmoothedETA as the unstability of getETA is pretty badint[]
long
long
long
long
int
long
long
int[][]
Get any recent history.long
Returns the bytes remaining.long
long
long
long
long
int
Gives the share ratio of the torrent in 1000ths (i.e.long
private long
long
long
long
int
getTimeSinceLastDataReceivedInSeconds
(boolean this_session) int
getTimeSinceLastDataSentInSeconds
(boolean this_session) long
private long
getTimeStarted
(boolean mono) long
private long
getTimeStartedSeeding
(boolean mono) long
Swarm speedlong
Average for a peer in the swarmlong
Get the total number of bytes ever downloaded.long
Get the total number of bytes ever uploaded.long
data bytes received minus discards and hashfailslong
long
protected long[]
int
Get the max upload rate allowed for this download.private void
void
void
resetTotalBytesSentReceived
(long new_sent, long new_received) Resets the total bytes sent/received - will stop and start the download if it is runningvoid
restoreSessionTotals
(long _saved_data_bytes_downloaded, long _saved_data_bytes_uploaded, long _saved_discarded, long _saved_hashfails, long _saved_SecondsDownloading, long _saved_SecondsOnlySeeding) protected void
private void
void
setCompleted
(int _completed) void
setDownloadCompletedBytes
(long completedBytes) void
setDownloadRateLimitBytesPerSecond
(int max_rate_bps) Set the max download rate allowed for this download.protected void
setFilePriorityStats
(int[] stats) void
setRecentHistoryRetention
(boolean required) In general history isn't available, however if this method is called it will start retention for a certain period of timeprotected void
setSavedDownloadedUploaded
(long d, long u) void
setShareRatio
(int ratio) void
setSkippedFileStats
(long skipped_file_set_size, long skipped_but_downloaded) void
setUploadRateLimitBytesPerSecond
(int max_rate_bps) Set the max upload rate allowed for this download.protected void
timerTick
(int tick_count) protected void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.biglybt.core.download.DownloadManagerStats
getTimeSinceLastDataReceivedInSeconds, getTimeSinceLastDataSentInSeconds
-
Field Details
-
all_trackers
-
download_manager
-
completed
private int completed -
saved_data_bytes_downloaded
private long saved_data_bytes_downloaded -
saved_protocol_bytes_downloaded
private long saved_protocol_bytes_downloaded -
saved_data_bytes_uploaded
private long saved_data_bytes_uploaded -
saved_protocol_bytes_uploaded
private long saved_protocol_bytes_uploaded -
session_start_data_bytes_downloaded
private long session_start_data_bytes_downloaded -
session_start_data_bytes_uploaded
private long session_start_data_bytes_uploaded -
saved_discarded
private long saved_discarded -
saved_hashfails
private long saved_hashfails -
saved_SecondsDownloading
private long saved_SecondsDownloading -
saved_SecondsOnlySeeding
private long saved_SecondsOnlySeeding -
session_SecondsSinceDownload
private int session_SecondsSinceDownload -
session_SecondsSinceUpload
private int session_SecondsSinceUpload -
saved_SecondsSinceDownload
private int saved_SecondsSinceDownload -
saved_SecondsSinceUpload
private int saved_SecondsSinceUpload -
saved_peak_receive_rate
private long saved_peak_receive_rate -
saved_peak_send_rate
private long saved_peak_send_rate -
saved_skipped_file_set_size
private long saved_skipped_file_set_size -
saved_skipped_but_downloaded
private long saved_skipped_but_downloaded -
saved_completed_download_bytes
private long saved_completed_download_bytes -
max_upload_rate_bps
private int max_upload_rate_bps -
max_download_rate_bps
private int max_download_rate_bps -
HISTORY_MAX_SECS
private static final int HISTORY_MAX_SECS- See Also:
-
history_retention_required
private volatile boolean history_retention_required -
history_last_tick
private int history_last_tick -
history
private long[][] history -
history_pos
private int history_pos -
history_wrapped
private boolean history_wrapped -
last_sr_progress
private int last_sr_progress -
file_priority_stats
private int[] file_priority_stats -
HISTORY_RATE_DIV
private static final int HISTORY_RATE_DIV- See Also:
-
HISTORY_TIME_DIV
private static final int HISTORY_TIME_DIV- See Also:
-
tracker_session_stats
-
stats_saver
FrequencyLimitedDispatcher stats_saver
-
-
Constructor Details
-
DownloadManagerStatsImpl
-
-
Method Details
-
getDataReceiveRate
public long getDataReceiveRate()- Specified by:
getDataReceiveRate
in interfaceDownloadManagerStats
-
getProtocolReceiveRate
public long getProtocolReceiveRate()- Specified by:
getProtocolReceiveRate
in interfaceDownloadManagerStats
-
getDataSendRate
public long getDataSendRate()- Specified by:
getDataSendRate
in interfaceDownloadManagerStats
-
getProtocolSendRate
public long getProtocolSendRate()- Specified by:
getProtocolSendRate
in interfaceDownloadManagerStats
-
getPeakDataReceiveRate
public long getPeakDataReceiveRate()- Specified by:
getPeakDataReceiveRate
in interfaceDownloadManagerStats
-
getPeakDataSendRate
public long getPeakDataSendRate()- Specified by:
getPeakDataSendRate
in interfaceDownloadManagerStats
-
getSmoothedDataReceiveRate
public long getSmoothedDataReceiveRate()- Specified by:
getSmoothedDataReceiveRate
in interfaceDownloadManagerStats
-
getSmoothedDataSendRate
public long getSmoothedDataSendRate()- Specified by:
getSmoothedDataSendRate
in interfaceDownloadManagerStats
-
getETA
public long getETA()Description copied from interface:DownloadManagerStats
*deprecated - use getSmoothedETA as the unstability of getETA is pretty bad- Specified by:
getETA
in interfaceDownloadManagerStats
- Returns:
-
getSmoothedETA
public long getSmoothedETA()- Specified by:
getSmoothedETA
in interfaceDownloadManagerStats
-
getCompleted
public int getCompleted()Description copied from interface:DownloadManagerStats
Find out percentage done of current stateUse getDownloadCompleted() if you wish to find out a torrents download completion level
- Specified by:
getCompleted
in interfaceDownloadManagerStats
- Returns:
- 0 to 1000, 0% to 100% respectively When state is Allocating, Checking, or Initializing, this returns the % done of that task Any other state MAY return getDownloadCompleted()
-
setCompleted
public void setCompleted(int _completed) - Specified by:
setCompleted
in interfaceDownloadManagerStats
-
getDownloadCompleted
public int getDownloadCompleted(boolean bLive) Description copied from interface:DownloadManagerStats
Retrieve the level of download completion, *including* DND files.To understand the bLive parameter, you must know a bit about the Torrent activation process:
1) Torrent goes into ST_WAITING
2) Torrent moves to ST_PREPARING
3) Torrent moves to ST_DOWNLOADING or ST_SEEDINGWhile in ST_PREPARING, Completion Level is rebuilt (either via Fast Resume or via piece checking). Quite often, the download completion level before ST_PREPARING and after ST_PREPARING are identical.
Before going into ST_PREPARING, we store the download completion level. If you wish to retrieve this value instead of the live "building" one, pass false for the parameter.
- Specified by:
getDownloadCompleted
in interfaceDownloadManagerStats
- Parameters:
bLive
- true - Always returns the known completion level of the torrentfalse - In the case of ST_PREPARING, return completion level before of the torrent ST_PREPARING started. Otherwise, same as true.
- Returns:
- 0 - 1000
-
setDownloadCompletedBytes
public void setDownloadCompletedBytes(long completedBytes) - Specified by:
setDownloadCompletedBytes
in interfaceDownloadManagerStats
-
recalcDownloadCompleteBytes
public void recalcDownloadCompleteBytes()- Specified by:
recalcDownloadCompleteBytes
in interfaceDownloadManagerStats
-
getDownloadCompletedBytes
public long getDownloadCompletedBytes()Description copied from interface:DownloadManagerStats
Get the number of bytes of the download that we currently have.Includes bytes downloaded for files marked as DND/Skipped
- Specified by:
getDownloadCompletedBytes
in interfaceDownloadManagerStats
-
getElapsedTime
- Specified by:
getElapsedTime
in interfaceDownloadManagerStats
-
getTimeStarted
public long getTimeStarted()- Specified by:
getTimeStarted
in interfaceDownloadManagerStats
-
getTimeStarted
private long getTimeStarted(boolean mono) -
getTimeStartedSeeding
public long getTimeStartedSeeding()- Specified by:
getTimeStartedSeeding
in interfaceDownloadManagerStats
-
getTimeStartedSeeding
private long getTimeStartedSeeding(boolean mono) -
getTotalDataBytesReceived
public long getTotalDataBytesReceived()Description copied from interface:DownloadManagerStats
Get the total number of bytes ever downloaded.- Specified by:
getTotalDataBytesReceived
in interfaceDownloadManagerStats
- Returns:
- total bytes downloaded
-
getSessionDataBytesReceived
public long getSessionDataBytesReceived()- Specified by:
getSessionDataBytesReceived
in interfaceDownloadManagerStats
-
getTotalGoodDataBytesReceived
public long getTotalGoodDataBytesReceived()Description copied from interface:DownloadManagerStats
data bytes received minus discards and hashfails- Specified by:
getTotalGoodDataBytesReceived
in interfaceDownloadManagerStats
- Returns:
-
getTotalProtocolBytesReceived
public long getTotalProtocolBytesReceived()- Specified by:
getTotalProtocolBytesReceived
in interfaceDownloadManagerStats
-
resetTotalBytesSentReceived
public void resetTotalBytesSentReceived(long new_sent, long new_received) Description copied from interface:DownloadManagerStats
Resets the total bytes sent/received - will stop and start the download if it is running- Specified by:
resetTotalBytesSentReceived
in interfaceDownloadManagerStats
-
getTotalDataBytesSent
public long getTotalDataBytesSent()Description copied from interface:DownloadManagerStats
Get the total number of bytes ever uploaded.- Specified by:
getTotalDataBytesSent
in interfaceDownloadManagerStats
- Returns:
- total bytes uploaded
-
getTotalProtocolBytesSent
public long getTotalProtocolBytesSent()- Specified by:
getTotalProtocolBytesSent
in interfaceDownloadManagerStats
-
getSessionDataBytesSent
public long getSessionDataBytesSent()- Specified by:
getSessionDataBytesSent
in interfaceDownloadManagerStats
-
setRecentHistoryRetention
public void setRecentHistoryRetention(boolean required) Description copied from interface:DownloadManagerStats
In general history isn't available, however if this method is called it will start retention for a certain period of time- Specified by:
setRecentHistoryRetention
in interfaceDownloadManagerStats
-
getRecentHistory
public int[][] getRecentHistory()Description copied from interface:DownloadManagerStats
Get any recent history. Returned values are send rate, receive rate, peer-swarm average and eta- Specified by:
getRecentHistory
in interfaceDownloadManagerStats
- Returns:
-
timerTick
protected void timerTick(int tick_count) -
getRemaining
public long getRemaining()Description copied from interface:DownloadManagerStats
Returns the bytes remaining. *Includes* DND files- Specified by:
getRemaining
in interfaceDownloadManagerStats
-
getDiskManagerIfNotTransient
-
getDiscarded
public long getDiscarded()- Specified by:
getDiscarded
in interfaceDownloadManagerStats
-
getHashFailCount
public long getHashFailCount()- Specified by:
getHashFailCount
in interfaceDownloadManagerStats
-
getHashFailBytes
public long getHashFailBytes()- Specified by:
getHashFailBytes
in interfaceDownloadManagerStats
-
getTotalAverage
public long getTotalAverage()Description copied from interface:DownloadManagerStats
Swarm speed- Specified by:
getTotalAverage
in interfaceDownloadManagerStats
- Returns:
-
getTotalAveragePerPeer
public long getTotalAveragePerPeer()Description copied from interface:DownloadManagerStats
Average for a peer in the swarm- Specified by:
getTotalAveragePerPeer
in interfaceDownloadManagerStats
- Returns:
-
getSecondsDownloading
public long getSecondsDownloading()- Specified by:
getSecondsDownloading
in interfaceDownloadManagerStats
-
getSecondsOnlySeeding
public long getSecondsOnlySeeding()- Specified by:
getSecondsOnlySeeding
in interfaceDownloadManagerStats
-
getAvailability
public float getAvailability()- Specified by:
getAvailability
in interfaceDownloadManagerStats
-
getUploadRateLimitBytesPerSecond
public int getUploadRateLimitBytesPerSecond()Description copied from interface:DownloadManagerStats
Get the max upload rate allowed for this download.- Specified by:
getUploadRateLimitBytesPerSecond
in interfaceDownloadManagerStats
- Returns:
- upload rate in bytes per second, 0 for unlimited, -1 for upload disabled
-
setUploadRateLimitBytesPerSecond
public void setUploadRateLimitBytesPerSecond(int max_rate_bps) Description copied from interface:DownloadManagerStats
Set the max upload rate allowed for this download.- Specified by:
setUploadRateLimitBytesPerSecond
in interfaceDownloadManagerStats
- Parameters:
max_rate_bps
- limit in bytes per second, 0 for unlimited, -1 for upload disabled
-
getDownloadRateLimitBytesPerSecond
public int getDownloadRateLimitBytesPerSecond()Description copied from interface:DownloadManagerStats
Get the max download rate allowed for this download.- Specified by:
getDownloadRateLimitBytesPerSecond
in interfaceDownloadManagerStats
- Returns:
- download rate in bytes per second, 0 for unlimited, -1 for download disabled
-
setDownloadRateLimitBytesPerSecond
public void setDownloadRateLimitBytesPerSecond(int max_rate_bps) Description copied from interface:DownloadManagerStats
Set the max download rate allowed for this download.- Specified by:
setDownloadRateLimitBytesPerSecond
in interfaceDownloadManagerStats
- Parameters:
max_rate_bps
- limit in bytes per second, 0 for unlimited, -1 for download disabled
-
getTimeSinceLastDataReceivedInSeconds
public int getTimeSinceLastDataReceivedInSeconds(boolean this_session) - Specified by:
getTimeSinceLastDataReceivedInSeconds
in interfaceDownloadManagerStats
-
getTimeSinceLastDataSentInSeconds
public int getTimeSinceLastDataSentInSeconds(boolean this_session) - Specified by:
getTimeSinceLastDataSentInSeconds
in interfaceDownloadManagerStats
-
getAvailWentBadTime
public long getAvailWentBadTime()- Specified by:
getAvailWentBadTime
in interfaceDownloadManagerStats
- Returns:
- -1: never seen a whole copy; 0: currently good; >0: time availability went from good to bad
-
loadTrackerStats
private void loadTrackerStats() -
saveTrackerStats
private void saveTrackerStats() -
updateTrackerSession
-
getTrackerReportedStats
-
saveSessionTotals
protected void saveSessionTotals() -
setSavedDownloadedUploaded
protected void setSavedDownloadedUploaded(long d, long u) -
restoreSessionTotals
public void restoreSessionTotals(long _saved_data_bytes_downloaded, long _saved_data_bytes_uploaded, long _saved_discarded, long _saved_hashfails, long _saved_SecondsDownloading, long _saved_SecondsOnlySeeding) - Specified by:
restoreSessionTotals
in interfaceDownloadManagerStats
-
setSkippedFileStats
public void setSkippedFileStats(long skipped_file_set_size, long skipped_but_downloaded) -
getSkippedFileSetSize
private long getSkippedFileSetSize() -
setFilePriorityStats
protected void setFilePriorityStats(int[] stats) -
getFilePriorityStats
public int[] getFilePriorityStats()- Specified by:
getFilePriorityStats
in interfaceDownloadManagerStats
-
getRemainingExcludingDND
public long getRemainingExcludingDND()- Specified by:
getRemainingExcludingDND
in interfaceDownloadManagerStats
-
getSizeExcludingDND
public long getSizeExcludingDND()- Specified by:
getSizeExcludingDND
in interfaceDownloadManagerStats
-
getPercentDoneExcludingDND
public int getPercentDoneExcludingDND()- Specified by:
getPercentDoneExcludingDND
in interfaceDownloadManagerStats
-
generateEvidence
-