Class TorrentStats
java.lang.Object
com.frostwire.jlibtorrent.TorrentStats
To be used in concert with
SessionManager.
The call to SessionManager#postTorrentUpdates() is done approximately
every second. This class holds a time series per metric and a time series for
the sampling time.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongThis is the accumulated download payload byte counters.longThis is the accumulated upload payload byte counter.intThe total transfer rate of payload only, not counting protocol chatter.intThe total rates for all peers for this torrent.booleanReturnstrueif all pieces that have apriority > 0are downloaded.booleanisPaused()set to true if the torrent is paused and false otherwise.booleantrue if all pieces have been downloaded.booleantrue when the torrent is in sequential download mode.longlast(TorrentStats.SeriesMetric metric) intThe number of seeds in our peer list and the total number of peers (including seeds).intThe number of seeds in our peer list and the total number of peers (including seeds).intbooleantrue if this torrent has unsaved changes to its download state and statistics since the last resume data was saved.intReturns the number of peer connections this torrent has, including half-open connections that hasn't completed the bittorrent handshake yet.intnumPeers()The number of peers this torrent currently is connected to.intReturns the number of pieces that has been downloaded so you don't have to count yourself.intnumSeeds()The number of peers that are seeding that this client is currently connected to.floatprogress()A value in the range [0, 1], that represents the progress of the torrent's current task.intprogress parts per million (progress * 1000000) when disabling floating point operations, this is the only option to query progressseries(TorrentStats.SeriesMetric metric) state()The main state the torrent is in.longThe total number of bytes of the file(s) that we have.longThe number of bytes downloaded and uploaded to all peers, accumulated, this session only.longCounts the amount of bytes received this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.longCounts the amount of bytes send this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.longThe number of bytes downloaded and uploaded to all peers, accumulated, this session only.longThe total number of bytes we want to download.longThe number of bytes we have downloaded, only counting the pieces that we actually want to download.voidupdate(TorrentStatus status) intThe total transfer rate of payload only, not counting protocol chatter.intThe total rates for all peers for this torrent.
-
Constructor Details
-
TorrentStats
-
-
Method Details
-
maxSamples
public int maxSamples() -
series
-
last
-
totalDownload
public long totalDownload()The number of bytes downloaded and uploaded to all peers, accumulated, this session only. The session is considered to restart when a torrent is paused and restarted again. When a torrent is paused, these counters are reset to 0. If you want complete, persistent, stats, see allTimeUpload and allTimeDownload. -
totalUpload
public long totalUpload()The number of bytes downloaded and uploaded to all peers, accumulated, this session only. The session is considered to restart when a torrent is paused and restarted again. When a torrent is paused, these counters are reset to 0. If you want complete, persistent, stats, see allTimeUpload and allTimeDownload. -
totalPayloadDownload
public long totalPayloadDownload()Counts the amount of bytes received this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.- Returns:
-
totalPayloadUpload
public long totalPayloadUpload()Counts the amount of bytes send this session, but only the actual payload data (i.e the interesting data), these counters ignore any protocol overhead.- Returns:
-
totalDone
public long totalDone()The total number of bytes of the file(s) that we have. All this does not necessarily has to be downloaded during this session (that's total_payload_download).- Returns:
- the value
-
totalWantedDone
public long totalWantedDone()The number of bytes we have downloaded, only counting the pieces that we actually want to download. i.e. excluding any pieces that we have but have priority 0 (i.e. not wanted). -
totalWanted
public long totalWanted()The total number of bytes we want to download. This may be smaller than the total torrent size in case any pieces are prioritized to 0, i.e. not wanted. -
allTimeUpload
public long allTimeUpload()This is the accumulated upload payload byte counter. They are saved in and restored from resume data to keep totals across sessions. -
allTimeDownload
public long allTimeDownload()This is the accumulated download payload byte counters. They are saved in and restored from resume data to keep totals across sessions. -
progress
public float progress()A value in the range [0, 1], that represents the progress of the torrent's current task. It may be checking files or downloading.- Returns:
- the progress in [0, 1]
-
progressPpm
public int progressPpm()progress parts per million (progress * 1000000) when disabling floating point operations, this is the only option to query progressreflects the same value as ``progress``, but instead in a range [0, 1000000] (ppm = parts per million). When floating point operations are disabled, this is the only alternative to the floating point value in.
- Returns:
- the progress in parts per million (progress * 1000000)
-
downloadRate
public int downloadRate()The total rates for all peers for this torrent. These will usually have better precision than summing the rates from all peers. The rates are given as the number of bytes per second. -
uploadRate
public int uploadRate()The total rates for all peers for this torrent. These will usually have better precision than summing the rates from all peers. The rates are given as the number of bytes per second. -
downloadPayloadRate
public int downloadPayloadRate()The total transfer rate of payload only, not counting protocol chatter. This might be slightly smaller than the other rates, but if projected over a long time (e.g. when calculating ETA:s) the difference may be noticeable. -
uploadPayloadRate
public int uploadPayloadRate()The total transfer rate of payload only, not counting protocol chatter. This might be slightly smaller than the other rates, but if projected over a long time (e.g. when calculating ETA:s) the difference may be noticeable. -
numSeeds
public int numSeeds()The number of peers that are seeding that this client is currently connected to. -
numPeers
public int numPeers()The number of peers this torrent currently is connected to. Peer connections that are in the half-open state (is attempting to connect) or are queued for later connection attempt do not count. Although they are visible in the peer list when you call get_peer_info(). -
listSeeds
public int listSeeds()The number of seeds in our peer list and the total number of peers (including seeds). We are not necessarily connected to all the peers in our peer list. This is the number of peers we know of in total, including banned peers and peers that we have failed to connect to. -
listPeers
public int listPeers()The number of seeds in our peer list and the total number of peers (including seeds). We are not necessarily connected to all the peers in our peer list. This is the number of peers we know of in total, including banned peers and peers that we have failed to connect to. -
numPieces
public int numPieces()Returns the number of pieces that has been downloaded so you don't have to count yourself. This can be used to see if anything has updated since last time if you want to keep a graph of the pieces up to date.- Returns:
- the number of pieces that has been downloaded
-
numConnections
public int numConnections()Returns the number of peer connections this torrent has, including half-open connections that hasn't completed the bittorrent handshake yet.This is always
>= num_peers.- Returns:
- the number of peer connections
-
state
The main state the torrent is in. See torrent_status::state_t.- Returns:
- the state
-
needSaveResume
public boolean needSaveResume()true if this torrent has unsaved changes to its download state and statistics since the last resume data was saved.- Returns:
-
isPaused
public boolean isPaused()set to true if the torrent is paused and false otherwise. It's only true if the torrent itself is paused. If the torrent is not running because the session is paused, this is still false. To know if a torrent is active or not, you need to inspect both ``torrent_status::paused`` and ``session::is_paused()``.- Returns:
-
isSequentialDownload
public boolean isSequentialDownload()true when the torrent is in sequential download mode. In this mode pieces are downloaded in order rather than rarest first.- Returns:
-
isSeeding
public boolean isSeeding()true if all pieces have been downloaded.- Returns:
-
isFinished
public boolean isFinished()Returnstrueif all pieces that have apriority > 0are downloaded. There is only a distinction between finished and seeding if some pieces or files have been set to priority 0, i.e. are not downloaded.- Returns:
trueif all pieces that have apriority > 0are downloaded.
-
update
-