add some more stats logging

This commit is contained in:
Arvid Norberg 2012-03-06 10:34:18 +00:00
parent 57eb57ac78
commit 02b0e0ead3
2 changed files with 25 additions and 1 deletions

View File

@ -125,9 +125,11 @@ def gen_html(reports, generations):
reports = [
('torrents', 'num', '', 'number of torrents in different torrent states', ['downloading torrents', 'seeding torrents', 'checking torrents', 'stopped torrents', 'upload-only torrents', 'error torrents']),
('torrents_want_peers', 'num', '', 'number of torrents that want more peers', ['torrents want more peers']),
('peers', 'num', '', 'num connected peers', ['peers', 'connecting peers', 'connection attempts', 'banned peers', 'total peers']),
('peers_max', 'num', '', 'num connected peers', ['peers', 'connecting peers', 'connection attempts', 'banned peers', 'max connections', 'total peers']),
('peer_churn', 'num', '', 'connecting and disconnecting peers', ['connecting peers', 'connection attempts']),
('peer_limits', 'num', '', 'number of connections per limit', ['average peers per limit']),
('connect_candidates', 'num', '', 'number of peers we know of that we can connect to', ['connect candidates']),
('peers_list_size', 'num', '', 'number of known peers (not necessarily connected)', ['num list peers']),
('overall_rates', 'rate', 'B/s', 'download and upload rates', ['uploaded bytes', 'downloaded bytes', 'upload rate', 'download rate', 'smooth upload rate', 'smooth download rate']),
@ -137,7 +139,7 @@ reports = [
('peer_errors', 'num', '', 'number of peers by error that disconnected them', ['error peers', 'peer disconnects', 'peers eof', 'peers connection reset', 'connect timeouts', 'uninteresting peers disconnect', 'banned for hash failure', 'no memory peer errors', 'too many peers', 'transport timeout peers', 'connection refused peers', 'connection aborted peers', 'permission denied peers', 'no buffer peers', 'host unreachable peers', 'broken pipe peers', 'address in use peers', 'access denied peers', 'invalid argument peers', 'operation aborted peers']),
('peer_errors_incoming', 'num', '', 'number of peers by incoming or outgoing connection', ['error incoming peers', 'error outgoing peers']),
('peer_errors_transport', 'num', '', 'number of peers by transport protocol', ['error tcp peers', 'error utp peers']),
('peer_errors_encryption', 'num', '', 'number of peers by encryption level', ['error encrypted peers', 'error rc4 peers', 'error peers']),
('peer_errors_encryption', 'num', '', 'number of peers by encryption level', ['error encrypted peers', 'error rc4 peers', 'peer disconnects']),
('incoming requests', 'num', '', 'incoming 16kiB block requests', ['pending incoming block requests', 'average pending incoming block requests']),
('waste', '% of all downloaded bytes', '%%', 'proportion of all downloaded bytes that were wasted', ['% failed payload bytes', '% wasted payload bytes', '% protocol bytes']),
('waste by source', '% of all wasted bytes', '%%', 'what\' causing the waste', [ 'redundant timed-out', 'redundant cancelled', 'redundant unknown', 'redundant seed', 'redundant end-game', 'redundant closing']),

View File

@ -1262,6 +1262,9 @@ namespace aux {
":total peers"
":pending incoming block requests"
":average pending incoming block requests"
":torrents want more peers"
":average peers per limit"
"\n\n", m_stats_logger);
}
#endif
@ -3591,6 +3594,14 @@ namespace aux {
int peers_up_requests = 0;
int peers_down_requests = 0;
// number of torrents that want more peers
int num_want_more_peers = 0;
// number of peers among torrents with a peer limit
int num_limited_peers = 0;
// sum of limits of all torrents with a peer limit
int total_peers_limit = 0;
std::vector<partial_piece_info> dq;
for (torrent_map::iterator i = m_torrents.begin()
, end(m_torrents.end()); i != end; ++i)
@ -3599,6 +3610,14 @@ namespace aux {
int candidates = i->second->get_policy().num_connect_candidates();
connect_candidates += (std::min)(candidates, connection_slots);
num_peers += i->second->get_policy().num_peers();
if (i->second->want_more_peers()) ++num_want_more_peers;
if (i->second->max_connections() > 0)
{
num_limited_peers += i->second->num_peers();
num_limited_peers += i->second->max_connections();
}
if (i->second->is_seed())
++seeding_torrents;
else
@ -3937,6 +3956,9 @@ namespace aux {
STAT_LOG(d, pending_incoming_reqs);
STAT_LOG(f, num_complete_connections == 0 ? 0.f : (float(pending_incoming_reqs) / num_complete_connections));
STAT_LOG(d, num_want_more_peers);
STAT_LOG(f, total_peers_limit == 0 ? 0 : float(num_limited_peers) / total_peers_limit);
fprintf(m_stats_logger, "\n");
#undef STAT_LOG