From 85db40e2c5b53af87f657d112fdf0244c49b30d5 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 23 Sep 2011 20:57:42 +0000 Subject: [PATCH] log outstanding reading bytes from peers in stats log --- include/libtorrent/peer_connection.hpp | 2 ++ parse_session_stats.py | 1 + src/session_impl.cpp | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 481d9cff0..42ca96f90 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -608,6 +608,8 @@ namespace libtorrent // start downloading payload again void on_disk(); + int num_reading_bytes() const { return m_reading_bytes; } + enum sync_t { read_async, read_sync }; void setup_receive(sync_t sync = read_sync); diff --git a/parse_session_stats.py b/parse_session_stats.py index 23acf512a..a85d4d034 100755 --- a/parse_session_stats.py +++ b/parse_session_stats.py @@ -142,6 +142,7 @@ reports = [ ('disk_readback', '% of written blocks', '%%', 'portion of written blocks that had to be read back for hash verification', ['% read back']), ('disk_queue', 'number of queued disk jobs', '', 'queued disk jobs', ['disk queue size', 'disk read queue size', 'read job queue size limit']), ('disk_iops', 'operations/s', '', 'number of disk operations per second', ['read ops/s', 'write ops/s', 'smooth read ops/s', 'smooth write ops/s']), + ('disk pending reads', 'Bytes', '', 'number of bytes peers are waiting for to be read from the disk', ['pending reading bytes']), ('mixed mode', 'rate', 'B/s', 'rates by transport protocol', ['TCP up rate','TCP down rate','uTP up rate','uTP down rate','TCP up limit','TCP down limit']), ('uTP delay', 'buffering delay', 's', 'network delays measured by uTP', ['uTP peak send delay','uTP avg send delay']), ('uTP delay histogram', 'buffering delay', 's', 'network delays measured by uTP', ['uTP avg send delay'], True), diff --git a/src/session_impl.cpp b/src/session_impl.cpp index c13398cfa..cfd30372d 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1042,6 +1042,7 @@ namespace aux { ":page faults" ":smooth read ops/s" ":smooth write ops/s" + ":pending reading bytes" "\n\n", m_stats_logger); } #endif @@ -3277,6 +3278,7 @@ namespace aux { int peers_down_unchoked = 0; int peers_up_unchoked = 0; int num_end_game_peers = 0; + int reading_bytes = 0; for (connection_map::iterator i = m_connections.begin() , end(m_connections.end()); i != end; ++i) { @@ -3296,6 +3298,7 @@ namespace aux { if (p->send_buffer_size() > 100 || !p->upload_queue().empty()) ++peers_up_requests; if (p->endgame()) ++num_end_game_peers; + reading_bytes += p->num_reading_bytes(); int dl_bucket = 0; int dl_rate = p->statistics().download_payload_rate(); @@ -3488,6 +3491,8 @@ namespace aux { STAT_LOG(d, m_read_ops.mean()); STAT_LOG(d, m_write_ops.mean()); + STAT_LOG(d, reading_bytes); + fprintf(m_stats_logger, "\n"); #undef STAT_LOG