added redundant and failed byte counters to session
This commit is contained in:
parent
680dab5a67
commit
96ca475652
|
@ -688,6 +688,9 @@ struct session_status
|
|||
size_type total_download;
|
||||
size_type total_upload;
|
||||
|
||||
size_type total_redundant_bytes;
|
||||
size_type total_failed_bytes;
|
||||
|
||||
size_type total_payload_download;
|
||||
size_type total_payload_upload;
|
||||
|
||||
|
@ -710,6 +713,12 @@ versions is the payload download only.</p>
|
|||
<p><tt class="docutils literal"><span class="pre">total_download</span></tt> and <tt class="docutils literal"><span class="pre">total_upload</span></tt> are the total number of bytes downloaded and
|
||||
uploaded to and from all torrents. <tt class="docutils literal"><span class="pre">total_payload_download</span></tt> and <tt class="docutils literal"><span class="pre">total_payload_upload</span></tt>
|
||||
are the same thing but where only the payload is considered.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">total_redundant_bytes</span></tt> is the number of bytes that has been received more than once.
|
||||
This can happen if a request from a peer times out and is requested from a different
|
||||
peer, and then received again from the first one. To make this lower, increase the
|
||||
<tt class="docutils literal"><span class="pre">request_timeout</span></tt> and the <tt class="docutils literal"><span class="pre">piece_timeout</span></tt> in the session settings.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">total_failed_bytes</span></tt> is the number of bytes that was downloaded which later failed
|
||||
the hash-check.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">num_peers</span></tt> is the total number of peer connections this session has. This includes
|
||||
incoming connections that still hasn't sent their handshake or outgoing connections
|
||||
that still hasn't completed the TCP connection. This number may be slightly higher
|
||||
|
|
|
@ -503,6 +503,9 @@ struct has the following members::
|
|||
size_type total_download;
|
||||
size_type total_upload;
|
||||
|
||||
size_type total_redundant_bytes;
|
||||
size_type total_failed_bytes;
|
||||
|
||||
size_type total_payload_download;
|
||||
size_type total_payload_upload;
|
||||
|
||||
|
@ -528,6 +531,14 @@ versions is the payload download only.
|
|||
uploaded to and from all torrents. ``total_payload_download`` and ``total_payload_upload``
|
||||
are the same thing but where only the payload is considered.
|
||||
|
||||
``total_redundant_bytes`` is the number of bytes that has been received more than once.
|
||||
This can happen if a request from a peer times out and is requested from a different
|
||||
peer, and then received again from the first one. To make this lower, increase the
|
||||
``request_timeout`` and the ``piece_timeout`` in the session settings.
|
||||
|
||||
``total_failed_bytes`` is the number of bytes that was downloaded which later failed
|
||||
the hash-check.
|
||||
|
||||
``num_peers`` is the total number of peer connections this session has. This includes
|
||||
incoming connections that still hasn't sent their handshake or outgoing connections
|
||||
that still hasn't completed the TCP connection. This number may be slightly higher
|
||||
|
|
|
@ -1319,7 +1319,9 @@ int main(int ac, char* av[])
|
|||
<< " (" << esc("32") << add_suffix(sess_stat.total_download) << esc("0") << ") "
|
||||
" up: " << esc("31") << add_suffix(sess_stat.upload_rate) << "/s " << esc("0")
|
||||
<< " (" << esc("31") << add_suffix(sess_stat.total_upload) << esc("0") << ")"
|
||||
" unchoked: " << sess_stat.num_unchoked << " / " << sess_stat.allowed_upload_slots
|
||||
" waste: " << add_suffix(sess_stat.total_redundant_bytes)
|
||||
<< " fail: " << add_suffix(sess_stat.total_failed_bytes)
|
||||
<< " unchoked: " << sess_stat.num_unchoked << " / " << sess_stat.allowed_upload_slots
|
||||
<< " bw queues: (" << sess_stat.up_bandwidth_queue
|
||||
<< " | " << sess_stat.down_bandwidth_queue << ") "
|
||||
" write cache hits: " << ((cs.blocks_written - cs.writes) * 100 / cs.blocks_written) << "% "
|
||||
|
|
|
@ -319,6 +319,18 @@ namespace libtorrent
|
|||
|
||||
int next_port();
|
||||
|
||||
void add_redundant_bytes(size_type b)
|
||||
{
|
||||
TORRENT_ASSERT(b > 0);
|
||||
m_total_redundant_bytes += b;
|
||||
}
|
||||
|
||||
void add_failed_bytes(size_type b)
|
||||
{
|
||||
TORRENT_ASSERT(b > 0);
|
||||
m_total_failed_bytes += b;
|
||||
}
|
||||
|
||||
// handles delayed alerts
|
||||
alert_manager m_alerts;
|
||||
|
||||
|
@ -608,6 +620,10 @@ namespace libtorrent
|
|||
std::map<int, int> m_as_peak;
|
||||
#endif
|
||||
|
||||
// total redundant and failed bytes
|
||||
size_type m_total_failed_bytes;
|
||||
size_type m_total_redundant_bytes;
|
||||
|
||||
// the main working thread
|
||||
boost::scoped_ptr<boost::thread> m_thread;
|
||||
};
|
||||
|
|
|
@ -53,6 +53,9 @@ namespace libtorrent
|
|||
size_type total_payload_download;
|
||||
size_type total_payload_upload;
|
||||
|
||||
size_type total_redundant_bytes;
|
||||
size_type total_failed_bytes;
|
||||
|
||||
int num_peers;
|
||||
int num_unchoked;
|
||||
int allowed_upload_slots;
|
||||
|
|
|
@ -524,8 +524,8 @@ namespace libtorrent
|
|||
// this is done when a piece fails
|
||||
void restore_piece_state(int index);
|
||||
|
||||
void received_redundant_data(int num_bytes)
|
||||
{ TORRENT_ASSERT(num_bytes > 0); m_total_redundant_bytes += num_bytes; }
|
||||
void add_redundant_bytes(int b);
|
||||
void add_failed_bytes(int b);
|
||||
|
||||
// this is true if we have all the pieces
|
||||
bool is_seed() const
|
||||
|
|
|
@ -1509,7 +1509,7 @@ namespace libtorrent
|
|||
// just ignore it
|
||||
if (t->is_seed())
|
||||
{
|
||||
t->received_redundant_data(p.length);
|
||||
t->add_redundant_bytes(p.length);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1541,7 +1541,7 @@ namespace libtorrent
|
|||
(*m_logger) << " *** The block we just got was not in the "
|
||||
"request queue ***\n";
|
||||
#endif
|
||||
t->received_redundant_data(p.length);
|
||||
t->add_redundant_bytes(p.length);
|
||||
request_a_block(*t, *this);
|
||||
send_block_requests();
|
||||
return;
|
||||
|
@ -1578,7 +1578,7 @@ namespace libtorrent
|
|||
// if the block we got is already finished, then ignore it
|
||||
if (picker.is_downloaded(block_finished))
|
||||
{
|
||||
t->received_redundant_data(p.length);
|
||||
t->add_redundant_bytes(p.length);
|
||||
|
||||
m_download_queue.erase(b);
|
||||
m_timeout_extend = 0;
|
||||
|
|
|
@ -185,6 +185,8 @@ namespace aux {
|
|||
, m_asnum_db(0)
|
||||
, m_country_db(0)
|
||||
#endif
|
||||
, m_total_failed_bytes(0)
|
||||
, m_total_redundant_bytes(0)
|
||||
{
|
||||
m_tcp_mapping[0] = -1;
|
||||
m_tcp_mapping[1] = -1;
|
||||
|
@ -2017,6 +2019,9 @@ namespace aux {
|
|||
s.num_unchoked = m_num_unchoked;
|
||||
s.allowed_upload_slots = m_allowed_upload_slots;
|
||||
|
||||
s.total_redundant_bytes = m_total_redundant_bytes;
|
||||
s.total_failed_bytes = m_total_failed_bytes;
|
||||
|
||||
s.up_bandwidth_queue = m_upload_channel.queue_size();
|
||||
s.down_bandwidth_queue = m_download_channel.queue_size();
|
||||
|
||||
|
|
|
@ -1363,7 +1363,7 @@ namespace libtorrent
|
|||
m_ses.m_alerts.post_alert(hash_failed_alert(get_handle(), index));
|
||||
|
||||
// increase the total amount of failed bytes
|
||||
m_total_failed_bytes += m_torrent_file->piece_size(index);
|
||||
add_failed_bytes(m_torrent_file->piece_size(index));
|
||||
|
||||
std::vector<void*> downloaders;
|
||||
m_picker->get_downloaders(downloaders, index);
|
||||
|
@ -4208,6 +4208,20 @@ namespace libtorrent
|
|||
return st;
|
||||
}
|
||||
|
||||
void torrent::add_redundant_bytes(int b)
|
||||
{
|
||||
TORRENT_ASSERT(b > 0);
|
||||
m_total_redundant_bytes += b;
|
||||
m_ses.add_redundant_bytes(b);
|
||||
}
|
||||
|
||||
void torrent::add_failed_bytes(int b)
|
||||
{
|
||||
TORRENT_ASSERT(b > 0);
|
||||
m_total_failed_bytes += b;
|
||||
m_ses.add_failed_bytes(b);
|
||||
}
|
||||
|
||||
int torrent::num_seeds() const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
|
Loading…
Reference in New Issue