added upload and download activity timer stats for torrents
This commit is contained in:
parent
079109f657
commit
3310198dae
|
@ -1,3 +1,4 @@
|
|||
* added upload and download activity timer stats for torrents
|
||||
* made the reuse-address flag configurable on the listen socket
|
||||
* moved UDP trackers over to use a single socket
|
||||
* added feature to make asserts log to a file instead of breaking the process
|
||||
|
|
|
@ -3126,6 +3126,9 @@ It contains the following fields::
|
|||
time_t added_time;
|
||||
time_t completed_time;
|
||||
time_t last_seen_complete;
|
||||
|
||||
int time_since_upload;
|
||||
int time_since_download;
|
||||
};
|
||||
|
||||
``progress`` is a value in the range [0, 1], that represents the progress of the
|
||||
|
@ -3358,6 +3361,10 @@ the torrent is not yet finished, this is 0.
|
|||
``last_seen_complete`` is the time when we, or one of our peers, last
|
||||
saw a complete copy of this torrent.
|
||||
|
||||
``time_since_upload`` and ``time_since_download`` are the number of
|
||||
seconds since any peer last uploaded from this torrent and the last
|
||||
time a downloaded piece passed the hash check, respectively.
|
||||
|
||||
peer_info
|
||||
=========
|
||||
|
||||
|
|
|
@ -782,6 +782,8 @@ namespace libtorrent
|
|||
static void print_size(logger& l);
|
||||
#endif
|
||||
|
||||
void update_last_upload() { m_last_upload = 0; }
|
||||
|
||||
private:
|
||||
|
||||
void on_files_deleted(int ret, disk_io_job const& j);
|
||||
|
@ -1196,6 +1198,14 @@ namespace libtorrent
|
|||
// the number of seconds since the last scrape request to
|
||||
// one of the trackers in this torrent
|
||||
boost::uint16_t m_last_scrape;
|
||||
|
||||
// the number of seconds since the last piece passed for
|
||||
// this torrent
|
||||
boost::uint16_t m_last_download;
|
||||
|
||||
// the number of seconds since the last byte was uploaded
|
||||
// from this torrent
|
||||
boost::uint16_t m_last_upload;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ namespace libtorrent
|
|||
, added_time(0)
|
||||
, completed_time(0)
|
||||
, last_seen_complete(0)
|
||||
, time_since_upload(0)
|
||||
, time_since_download(0)
|
||||
{}
|
||||
|
||||
enum state_t
|
||||
|
@ -311,6 +313,10 @@ namespace libtorrent
|
|||
time_t added_time;
|
||||
time_t completed_time;
|
||||
time_t last_seen_complete;
|
||||
|
||||
// number of seconds since last upload or download activity
|
||||
int time_since_upload;
|
||||
int time_since_download;
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT block_info
|
||||
|
|
|
@ -3098,6 +3098,13 @@ namespace libtorrent
|
|||
|
||||
TORRENT_ASSERT(amount_payload <= (int)bytes_transferred);
|
||||
m_statistics.sent_bytes(amount_payload, bytes_transferred - amount_payload);
|
||||
|
||||
if (amount_payload > 0)
|
||||
{
|
||||
boost::shared_ptr<torrent> t = associated_torrent().lock();
|
||||
TORRENT_ASSERT(t);
|
||||
if (t) t->update_last_upload();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
|
|
|
@ -379,6 +379,8 @@ namespace libtorrent
|
|||
, m_auto_managed(p.auto_managed)
|
||||
, m_num_verified(0)
|
||||
, m_last_scrape(0)
|
||||
, m_last_download(0)
|
||||
, m_last_upload(0)
|
||||
{
|
||||
if (m_seed_mode)
|
||||
m_verified.resize(m_torrent_file->num_pieces(), false);
|
||||
|
@ -2308,6 +2310,8 @@ namespace libtorrent
|
|||
// if we just became a seed, picker is now invalid, since it
|
||||
// is deallocated by the torrent once it starts seeding
|
||||
}
|
||||
|
||||
m_last_download = 0;
|
||||
}
|
||||
|
||||
void torrent::piece_failed(int index)
|
||||
|
@ -5681,6 +5685,8 @@ namespace libtorrent
|
|||
if (m_upload_mode) m_upload_mode_time += seconds_since_last_tick;
|
||||
m_last_scrape += seconds_since_last_tick;
|
||||
m_active_time += seconds_since_last_tick;
|
||||
m_last_download += seconds_since_last_tick;
|
||||
m_last_upload += seconds_since_last_tick;
|
||||
|
||||
// ---- TIME CRITICAL PIECES ----
|
||||
|
||||
|
@ -6283,9 +6289,12 @@ namespace libtorrent
|
|||
st.all_time_upload = m_total_uploaded;
|
||||
st.all_time_download = m_total_downloaded;
|
||||
|
||||
// activity time
|
||||
st.active_time = m_active_time;
|
||||
st.active_time = m_active_time;
|
||||
st.seeding_time = m_seeding_time;
|
||||
st.time_since_upload = m_last_upload;
|
||||
st.time_since_download = m_last_download;
|
||||
|
||||
st.storage_mode = (storage_mode_t)m_storage_mode;
|
||||
|
||||
|
|
Loading…
Reference in New Issue