diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 91083022a..ad97beb2f 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -933,6 +933,8 @@ namespace libtorrent int m_num_banned_peers; int m_banned_for_hash_failure; vm_statistics_data_t m_last_vm_stat; + sliding_average<5> m_read_ops; + sliding_average<5> m_write_ops;; #endif // each second tick the timer takes a little diff --git a/parse_session_stats.py b/parse_session_stats.py index ff60b62d4..804ca7715 100755 --- a/parse_session_stats.py +++ b/parse_session_stats.py @@ -120,7 +120,7 @@ reports = [ ('disk_cache', 'blocks (16kiB)', '', 'disk cache size and usage', ['read disk cache size', 'disk cache size', 'disk buffer allocations', 'cache size']), ('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']), + ('disk_iops', 'operations/s', '', 'number of disk operations per second', ['read ops/s', 'write ops/s', 'smooth read ops/s', 'smooth write ops/s']), ('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']), ('system memory', '', '', 'virtual memory page count', ['active resident pages', 'inactive resident pages', 'pinned resident pages', 'free pages']), diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 8aaa81597..034e357f3 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -981,6 +981,8 @@ namespace aux { ":pageins" ":pageouts" ":page faults" + ":smooth read ops/s" + ":smooth write ops/s" "\n\n", m_stats_logger); } #endif @@ -3271,6 +3273,9 @@ namespace aux { { cache_status cs = m_disk_thread.status(); + m_read_ops.add_sample((cs.reads - m_last_cache_status.reads) * 1000.0 / float(tick_interval_ms)); + m_write_ops.add_sample((cs.writes - m_last_cache_status.writes) * 1000.0 / float(tick_interval_ms)); + int total_job_time = cs.cumulative_job_time == 0 ? 1 : cs.cumulative_job_time; #define STAT_LOG(type, val) fprintf(m_stats_logger, "%" #type "\t", val) @@ -3396,6 +3401,9 @@ namespace aux { STAT_LOG(d, int(vm_stat.pageouts - m_last_vm_stat.pageouts)); STAT_LOG(d, int(vm_stat.faults - m_last_vm_stat.faults)); + STAT_LOG(d, m_read_ops.mean()); + STAT_LOG(d, m_write_ops.mean()); + fprintf(m_stats_logger, "\n"); #undef STAT_LOG