Class DownloadManagerStatsImpl
- All Implemented Interfaces:
DownloadManagerStats
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AllTrackersManager.AllTrackersprivate intprivate final DownloadManagerImplprivate int[]private long[][]private intprivate static final intprivate intprivate static final intprivate booleanprivate static final intprivate booleanprivate intprivate intprivate intprivate longprivate longprivate longprivate longprivate longprivate longprivate longprivate longprivate longprivate longprivate longprivate intprivate intprivate longprivate longprivate intprivate intprivate longprivate long(package private) static int(package private) FrequencyLimitedDispatcher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprotected voidgenerateEvidence(IndentWriter writer) floatlonglongintFind out percentage done of current statelonglonglongprivate DiskManagerintgetDownloadCompleted(boolean bLive) Retrieve the level of download completion, *including* DND files.longGet the number of bytes of the download that we currently have.intGet the max download rate allowed for this download.longgetETA()*deprecated - use getSmoothedETA as the unstability of getETA is pretty badint[]longlonglonglongintlonglongint[][]Get any recent history.longReturns the bytes remaining.longlonglonglonglongintGives the share ratio of the torrent in 1000ths (i.e.longprivate longlonglonglongintgetTimeSinceLastDataReceivedInSeconds(boolean this_session) intgetTimeSinceLastDataSentInSeconds(boolean this_session) longprivate longgetTimeStarted(boolean mono) longprivate longgetTimeStartedSeeding(boolean mono) longSwarm speedlongAverage for a peer in the swarmlongGet the total number of bytes ever downloaded.longGet the total number of bytes ever uploaded.longdata bytes received minus discards and hashfailslonglongprotected long[]intGet the max upload rate allowed for this download.private voidvoidvoidresetTotalBytesSentReceived(long new_sent, long new_received) Resets the total bytes sent/received - will stop and start the download if it is runningvoidrestoreSessionTotals(long _saved_data_bytes_downloaded, long _saved_data_bytes_uploaded, long _saved_discarded, long _saved_hashfails, long _saved_SecondsDownloading, long _saved_SecondsOnlySeeding) protected voidprivate voidvoidsetCompleted(int _completed) voidsetDownloadCompletedBytes(long completedBytes) voidsetDownloadRateLimitBytesPerSecond(int max_rate_bps) Set the max download rate allowed for this download.protected voidsetFilePriorityStats(int[] stats) voidsetRecentHistoryRetention(boolean required) In general history isn't available, however if this method is called it will start retention for a certain period of timeprotected voidsetSavedDownloadedUploaded(long d, long u) voidsetShareRatio(int ratio) voidsetSkippedFileStats(long skipped_file_set_size, long skipped_but_downloaded) voidsetUploadRateLimitBytesPerSecond(int max_rate_bps) Set the max upload rate allowed for this download.protected voidtimerTick(int tick_count) protected voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:
getDataReceiveRatein interfaceDownloadManagerStats
-
getProtocolReceiveRate
public long getProtocolReceiveRate()- Specified by:
getProtocolReceiveRatein interfaceDownloadManagerStats
-
getDataSendRate
public long getDataSendRate()- Specified by:
getDataSendRatein interfaceDownloadManagerStats
-
getProtocolSendRate
public long getProtocolSendRate()- Specified by:
getProtocolSendRatein interfaceDownloadManagerStats
-
getPeakDataReceiveRate
public long getPeakDataReceiveRate()- Specified by:
getPeakDataReceiveRatein interfaceDownloadManagerStats
-
getPeakDataSendRate
public long getPeakDataSendRate()- Specified by:
getPeakDataSendRatein interfaceDownloadManagerStats
-
getSmoothedDataReceiveRate
public long getSmoothedDataReceiveRate()- Specified by:
getSmoothedDataReceiveRatein interfaceDownloadManagerStats
-
getSmoothedDataSendRate
public long getSmoothedDataSendRate()- Specified by:
getSmoothedDataSendRatein interfaceDownloadManagerStats
-
getETA
public long getETA()Description copied from interface:DownloadManagerStats*deprecated - use getSmoothedETA as the unstability of getETA is pretty bad- Specified by:
getETAin interfaceDownloadManagerStats- Returns:
-
getSmoothedETA
public long getSmoothedETA()- Specified by:
getSmoothedETAin interfaceDownloadManagerStats
-
getCompleted
public int getCompleted()Description copied from interface:DownloadManagerStatsFind out percentage done of current stateUse getDownloadCompleted() if you wish to find out a torrents download completion level
- Specified by:
getCompletedin 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:
setCompletedin interfaceDownloadManagerStats
-
getDownloadCompleted
public int getDownloadCompleted(boolean bLive) Description copied from interface:DownloadManagerStatsRetrieve 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:
getDownloadCompletedin 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:
setDownloadCompletedBytesin interfaceDownloadManagerStats
-
recalcDownloadCompleteBytes
public void recalcDownloadCompleteBytes()- Specified by:
recalcDownloadCompleteBytesin interfaceDownloadManagerStats
-
getDownloadCompletedBytes
public long getDownloadCompletedBytes()Description copied from interface:DownloadManagerStatsGet the number of bytes of the download that we currently have.Includes bytes downloaded for files marked as DND/Skipped
- Specified by:
getDownloadCompletedBytesin interfaceDownloadManagerStats
-
getElapsedTime
- Specified by:
getElapsedTimein interfaceDownloadManagerStats
-
getTimeStarted
public long getTimeStarted()- Specified by:
getTimeStartedin interfaceDownloadManagerStats
-
getTimeStarted
private long getTimeStarted(boolean mono) -
getTimeStartedSeeding
public long getTimeStartedSeeding()- Specified by:
getTimeStartedSeedingin interfaceDownloadManagerStats
-
getTimeStartedSeeding
private long getTimeStartedSeeding(boolean mono) -
getTotalDataBytesReceived
public long getTotalDataBytesReceived()Description copied from interface:DownloadManagerStatsGet the total number of bytes ever downloaded.- Specified by:
getTotalDataBytesReceivedin interfaceDownloadManagerStats- Returns:
- total bytes downloaded
-
getSessionDataBytesReceived
public long getSessionDataBytesReceived()- Specified by:
getSessionDataBytesReceivedin interfaceDownloadManagerStats
-
getTotalGoodDataBytesReceived
public long getTotalGoodDataBytesReceived()Description copied from interface:DownloadManagerStatsdata bytes received minus discards and hashfails- Specified by:
getTotalGoodDataBytesReceivedin interfaceDownloadManagerStats- Returns:
-
getTotalProtocolBytesReceived
public long getTotalProtocolBytesReceived()- Specified by:
getTotalProtocolBytesReceivedin interfaceDownloadManagerStats
-
resetTotalBytesSentReceived
public void resetTotalBytesSentReceived(long new_sent, long new_received) Description copied from interface:DownloadManagerStatsResets the total bytes sent/received - will stop and start the download if it is running- Specified by:
resetTotalBytesSentReceivedin interfaceDownloadManagerStats
-
getTotalDataBytesSent
public long getTotalDataBytesSent()Description copied from interface:DownloadManagerStatsGet the total number of bytes ever uploaded.- Specified by:
getTotalDataBytesSentin interfaceDownloadManagerStats- Returns:
- total bytes uploaded
-
getTotalProtocolBytesSent
public long getTotalProtocolBytesSent()- Specified by:
getTotalProtocolBytesSentin interfaceDownloadManagerStats
-
getSessionDataBytesSent
public long getSessionDataBytesSent()- Specified by:
getSessionDataBytesSentin interfaceDownloadManagerStats
-
setRecentHistoryRetention
public void setRecentHistoryRetention(boolean required) Description copied from interface:DownloadManagerStatsIn general history isn't available, however if this method is called it will start retention for a certain period of time- Specified by:
setRecentHistoryRetentionin interfaceDownloadManagerStats
-
getRecentHistory
public int[][] getRecentHistory()Description copied from interface:DownloadManagerStatsGet any recent history. Returned values are send rate, receive rate, peer-swarm average and eta- Specified by:
getRecentHistoryin interfaceDownloadManagerStats- Returns:
-
timerTick
protected void timerTick(int tick_count) -
getRemaining
public long getRemaining()Description copied from interface:DownloadManagerStatsReturns the bytes remaining. *Includes* DND files- Specified by:
getRemainingin interfaceDownloadManagerStats
-
getDiskManagerIfNotTransient
-
getDiscarded
public long getDiscarded()- Specified by:
getDiscardedin interfaceDownloadManagerStats
-
getHashFailCount
public long getHashFailCount()- Specified by:
getHashFailCountin interfaceDownloadManagerStats
-
getHashFailBytes
public long getHashFailBytes()- Specified by:
getHashFailBytesin interfaceDownloadManagerStats
-
getTotalAverage
public long getTotalAverage()Description copied from interface:DownloadManagerStatsSwarm speed- Specified by:
getTotalAveragein interfaceDownloadManagerStats- Returns:
-
getTotalAveragePerPeer
public long getTotalAveragePerPeer()Description copied from interface:DownloadManagerStatsAverage for a peer in the swarm- Specified by:
getTotalAveragePerPeerin interfaceDownloadManagerStats- Returns:
-
getSecondsDownloading
public long getSecondsDownloading()- Specified by:
getSecondsDownloadingin interfaceDownloadManagerStats
-
getSecondsOnlySeeding
public long getSecondsOnlySeeding()- Specified by:
getSecondsOnlySeedingin interfaceDownloadManagerStats
-
getAvailability
public float getAvailability()- Specified by:
getAvailabilityin interfaceDownloadManagerStats
-
getUploadRateLimitBytesPerSecond
public int getUploadRateLimitBytesPerSecond()Description copied from interface:DownloadManagerStatsGet the max upload rate allowed for this download.- Specified by:
getUploadRateLimitBytesPerSecondin 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:DownloadManagerStatsSet the max upload rate allowed for this download.- Specified by:
setUploadRateLimitBytesPerSecondin 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:DownloadManagerStatsGet the max download rate allowed for this download.- Specified by:
getDownloadRateLimitBytesPerSecondin 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:DownloadManagerStatsSet the max download rate allowed for this download.- Specified by:
setDownloadRateLimitBytesPerSecondin 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:
getTimeSinceLastDataReceivedInSecondsin interfaceDownloadManagerStats
-
getTimeSinceLastDataSentInSeconds
public int getTimeSinceLastDataSentInSeconds(boolean this_session) - Specified by:
getTimeSinceLastDataSentInSecondsin interfaceDownloadManagerStats
-
getAvailWentBadTime
public long getAvailWentBadTime()- Specified by:
getAvailWentBadTimein 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:
restoreSessionTotalsin 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:
getFilePriorityStatsin interfaceDownloadManagerStats
-
getRemainingExcludingDND
public long getRemainingExcludingDND()- Specified by:
getRemainingExcludingDNDin interfaceDownloadManagerStats
-
getSizeExcludingDND
public long getSizeExcludingDND()- Specified by:
getSizeExcludingDNDin interfaceDownloadManagerStats
-
getPercentDoneExcludingDND
public int getPercentDoneExcludingDND()- Specified by:
getPercentDoneExcludingDNDin interfaceDownloadManagerStats
-
generateEvidence
-