log end-game mode stats with stats logging
This commit is contained in:
@@ -870,6 +870,11 @@ namespace libtorrent
|
|||||||
int m_disconnected_peers;
|
int m_disconnected_peers;
|
||||||
int m_eof_peers;
|
int m_eof_peers;
|
||||||
int m_connreset_peers;
|
int m_connreset_peers;
|
||||||
|
// the number of times the piece picker fell through
|
||||||
|
// to the end-game mode
|
||||||
|
int m_end_game_piece_picks;
|
||||||
|
int m_strict_end_game_piece_picks;
|
||||||
|
int m_valid_strict_end_game_piece_picks;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// each second tick the timer takes a little
|
// each second tick the timer takes a little
|
||||||
|
@@ -300,6 +300,11 @@ namespace libtorrent
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TORRENT_STATS
|
||||||
|
aux::session_impl& ses = t.session();
|
||||||
|
++ses.m_end_game_piece_picks;
|
||||||
|
#endif
|
||||||
|
|
||||||
// if the number of pieces we have + the number of pieces
|
// if the number of pieces we have + the number of pieces
|
||||||
// we're requesting from is less than the number of pieces
|
// we're requesting from is less than the number of pieces
|
||||||
// in the torrent, there are still some unrequested pieces
|
// in the torrent, there are still some unrequested pieces
|
||||||
@@ -309,6 +314,10 @@ namespace libtorrent
|
|||||||
< t.torrent_file().num_pieces())
|
< t.torrent_file().num_pieces())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef TORRENT_STATS
|
||||||
|
++ses.m_strict_end_game_piece_picks;
|
||||||
|
#endif
|
||||||
|
|
||||||
// if all blocks has the same number of peers on them
|
// if all blocks has the same number of peers on them
|
||||||
// we want to pick a random block
|
// we want to pick a random block
|
||||||
std::random_shuffle(busy_pieces.begin(), busy_pieces.end());
|
std::random_shuffle(busy_pieces.begin(), busy_pieces.end());
|
||||||
@@ -334,6 +343,10 @@ namespace libtorrent
|
|||||||
if (now - last_request < seconds(5))
|
if (now - last_request < seconds(5))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef TORRENT_STATS
|
||||||
|
++ses.m_valid_strict_end_game_piece_picks;
|
||||||
|
#endif
|
||||||
|
|
||||||
c.add_request(*i, peer_connection::req_busy);
|
c.add_request(*i, peer_connection::req_busy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -801,12 +801,21 @@ namespace aux {
|
|||||||
":peers up 100-:error peers"
|
":peers up 100-:error peers"
|
||||||
":peers down interesting:peers down unchoked:peers down requests"
|
":peers down interesting:peers down unchoked:peers down requests"
|
||||||
":peers up interested:peers up unchoked:peers up requests"
|
":peers up interested:peers up unchoked:peers up requests"
|
||||||
":peer disconnects:peers eof:peers connection reset:\n\n";
|
":peer disconnects:peers eof:peers connection reset"
|
||||||
|
":outstanding requests:outstanding end-game requests"
|
||||||
|
":outstanding writing blocks"
|
||||||
|
":end game piece picks"
|
||||||
|
":strict end game piece picks"
|
||||||
|
":valid strict end game piece picks"
|
||||||
|
"\n\n";
|
||||||
m_second_counter = 0;
|
m_second_counter = 0;
|
||||||
m_error_peers = 0;
|
m_error_peers = 0;
|
||||||
m_disconnected_peers = 0;
|
m_disconnected_peers = 0;
|
||||||
m_eof_peers = 0;
|
m_eof_peers = 0;
|
||||||
m_connreset_peers = 0;
|
m_connreset_peers = 0;
|
||||||
|
m_end_game_piece_picks = 0;
|
||||||
|
m_strict_end_game_piece_picks = 0;
|
||||||
|
m_valid_strict_end_game_piece_picks = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_DISK_STATS
|
#ifdef TORRENT_DISK_STATS
|
||||||
m_buffer_usage_logger.open("buffer_stats.log", std::ios::trunc);
|
m_buffer_usage_logger.open("buffer_stats.log", std::ios::trunc);
|
||||||
@@ -2532,11 +2541,16 @@ namespace aux {
|
|||||||
int peer_ul_rate_buckets[7];
|
int peer_ul_rate_buckets[7];
|
||||||
memset(peer_dl_rate_buckets, 0, sizeof(peer_dl_rate_buckets));
|
memset(peer_dl_rate_buckets, 0, sizeof(peer_dl_rate_buckets));
|
||||||
memset(peer_ul_rate_buckets, 0, sizeof(peer_ul_rate_buckets));
|
memset(peer_ul_rate_buckets, 0, sizeof(peer_ul_rate_buckets));
|
||||||
|
int outstanding_requests = 0;
|
||||||
|
int outstanding_end_game_requests = 0;
|
||||||
|
int outstanding_write_blocks = 0;
|
||||||
|
|
||||||
int peers_up_interested = 0;
|
int peers_up_interested = 0;
|
||||||
int peers_down_interesting = 0;
|
int peers_down_interesting = 0;
|
||||||
int peers_up_requests = 0;
|
int peers_up_requests = 0;
|
||||||
int peers_down_requests = 0;
|
int peers_down_requests = 0;
|
||||||
|
|
||||||
|
std::vector<partial_piece_info> dq;
|
||||||
for (torrent_map::iterator i = m_torrents.begin()
|
for (torrent_map::iterator i = m_torrents.begin()
|
||||||
, end(m_torrents.end()); i != end; ++i)
|
, end(m_torrents.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
@@ -2550,6 +2564,24 @@ namespace aux {
|
|||||||
++checking_torrents;
|
++checking_torrents;
|
||||||
if (i->second->is_paused())
|
if (i->second->is_paused())
|
||||||
++stopped_torrents;
|
++stopped_torrents;
|
||||||
|
|
||||||
|
dq.clear();
|
||||||
|
i->second->get_download_queue(dq);
|
||||||
|
for (std::vector<partial_piece_info>::iterator j = dq.begin()
|
||||||
|
, end(dq.end()); j != end; ++j)
|
||||||
|
{
|
||||||
|
for (int k = 0; k < j->blocks_in_piece; ++k)
|
||||||
|
{
|
||||||
|
block_info& bi = j->blocks[k];
|
||||||
|
if (bi.state == block_info::requested)
|
||||||
|
{
|
||||||
|
++outstanding_requests;
|
||||||
|
if (bi.num_peers > 1) ++outstanding_end_game_requests;
|
||||||
|
}
|
||||||
|
else if (bi.state == block_info::writing)
|
||||||
|
++outstanding_write_blocks;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int num_complete_connections = 0;
|
int num_complete_connections = 0;
|
||||||
int num_half_open = 0;
|
int num_half_open = 0;
|
||||||
@@ -2642,11 +2674,20 @@ namespace aux {
|
|||||||
<< m_disconnected_peers << "\t"
|
<< m_disconnected_peers << "\t"
|
||||||
<< m_eof_peers << "\t"
|
<< m_eof_peers << "\t"
|
||||||
<< m_connreset_peers << "\t"
|
<< m_connreset_peers << "\t"
|
||||||
|
<< outstanding_requests << "\t"
|
||||||
|
<< outstanding_end_game_requests << "\t"
|
||||||
|
<< outstanding_write_blocks << "\t"
|
||||||
|
<< m_end_game_piece_picks << "\t"
|
||||||
|
<< m_strict_end_game_piece_picks << "\t"
|
||||||
|
<< m_valid_strict_end_game_piece_picks << "\t"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
m_error_peers = 0;
|
m_error_peers = 0;
|
||||||
m_disconnected_peers = 0;
|
m_disconnected_peers = 0;
|
||||||
m_eof_peers = 0;
|
m_eof_peers = 0;
|
||||||
m_connreset_peers = 0;
|
m_connreset_peers = 0;
|
||||||
|
m_end_game_piece_picks = 0;
|
||||||
|
m_strict_end_game_piece_picks = 0;
|
||||||
|
m_valid_strict_end_game_piece_picks = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user