From 3db32f67b517093e742cf0952c1e5cb7e2eddfba Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 21 Oct 2014 21:45:35 +0000 Subject: [PATCH] remove option TORRENT_DISABLE_FULL_STATS --- Jamfile | 3 --- docs/gen_reference_doc.py | 2 +- docs/tuning.rst | 9 ------- include/libtorrent/stat.hpp | 51 +++++-------------------------------- src/alert.cpp | 8 ------ src/session_impl.cpp | 8 ------ src/tracker_manager.cpp | 1 - 7 files changed, 7 insertions(+), 75 deletions(-) diff --git a/Jamfile b/Jamfile index eb65223bc..e2ee14091 100755 --- a/Jamfile +++ b/Jamfile @@ -341,9 +341,6 @@ feature.compose off : TORRENT_USE_ICONV=0 ; feature valgrind : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_USE_VALGRIND=1 ; -feature full-stats : on off : composite propagated link-incompatible ; -feature.compose off : TORRENT_DISABLE_FULL_STATS ; - feature memory-optimization : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_OPTIMIZE_MEMORY_USAGE ; diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py index 1f7892201..dc83c4ad4 100644 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -484,7 +484,7 @@ def consume_ifdef(lno, lines, warn_on_ifdefs = False): if verbose: print 'prep %s' % l - if warn_on_ifdefs and ('TORRENT_DEBUG' in l or 'TORRENT_DISABLE_FULL_STATS' in l): + if warn_on_ifdefs and ('TORRENT_DEBUG' in l): while l.endswith('\\'): lno += 1 l += lines[lno].strip() diff --git a/docs/tuning.rst b/docs/tuning.rst index 498aaf03e..b8d6e4493 100644 --- a/docs/tuning.rst +++ b/docs/tuning.rst @@ -185,15 +185,6 @@ For all available options, see the `building libtorrent`_ secion. .. _`building libtorrent`: building.html -reduce statistics ------------------ - -You can save some memory for each connection and each torrent by reducing the -number of separate rates kept track of by libtorrent. If you build with ``full-stats=off`` -(or ``-DTORRENT_DISABLE_FULL_STATS``) you will save a few hundred bytes for each -connection and torrent. It might make a difference if you have a very large number -of peers or torrents. - play nice with the disk ======================= diff --git a/include/libtorrent/stat.hpp b/include/libtorrent/stat.hpp index 82e42cf79..48fb9396c 100644 --- a/include/libtorrent/stat.hpp +++ b/include/libtorrent/stat.hpp @@ -121,23 +121,14 @@ namespace libtorrent void sent_syn(bool ipv6) { -#ifndef TORRENT_DISABLE_FULL_STATS m_stat[upload_ip_protocol].add(ipv6 ? 60 : 40); -#else - m_stat[upload_protocol].add(ipv6 ? 60 : 40); -#endif } void received_synack(bool ipv6) { -#ifndef TORRENT_DISABLE_FULL_STATS // we received SYN-ACK and also sent ACK back m_stat[download_ip_protocol].add(ipv6 ? 60 : 40); m_stat[upload_ip_protocol].add(ipv6 ? 60 : 40); -#else - m_stat[download_protocol].add(ipv6 ? 60 : 40); - m_stat[upload_protocol].add(ipv6 ? 60 : 40); -#endif } void received_bytes(int bytes_payload, int bytes_protocol) @@ -170,22 +161,12 @@ namespace libtorrent const int mtu = 1500; const int packet_size = mtu - header; const int overhead = (std::max)(1, (bytes_transferred + packet_size - 1) / packet_size) * header; -#ifndef TORRENT_DISABLE_FULL_STATS m_stat[download_ip_protocol].add(overhead); m_stat[upload_ip_protocol].add(overhead); -#else - m_stat[download_protocol].add(overhead); - m_stat[upload_protocol].add(overhead); -#endif } -#ifndef TORRENT_DISABLE_FULL_STATS int upload_ip_overhead() const { return m_stat[upload_ip_protocol].counter(); } int download_ip_overhead() const { return m_stat[download_ip_protocol].counter(); } -#else - int upload_ip_overhead() const { return 0; } - int download_ip_overhead() const { return 0; } -#endif // should be called once every second void second_tick(int tick_interval_ms) @@ -198,60 +179,42 @@ namespace libtorrent { return m_stat[upload_payload].low_pass_rate() + m_stat[upload_protocol].low_pass_rate() -#ifndef TORRENT_DISABLE_FULL_STATS - + m_stat[upload_ip_protocol].low_pass_rate() -#endif - ; + + m_stat[upload_ip_protocol].low_pass_rate(); } int low_pass_download_rate() const { return m_stat[download_payload].low_pass_rate() + m_stat[download_protocol].low_pass_rate() -#ifndef TORRENT_DISABLE_FULL_STATS - + m_stat[download_ip_protocol].low_pass_rate() -#endif - ; + + m_stat[download_ip_protocol].low_pass_rate(); } int upload_rate() const { return m_stat[upload_payload].rate() + m_stat[upload_protocol].rate() -#ifndef TORRENT_DISABLE_FULL_STATS - + m_stat[upload_ip_protocol].rate() -#endif - ; + + m_stat[upload_ip_protocol].rate(); } int download_rate() const { return m_stat[download_payload].rate() + m_stat[download_protocol].rate() -#ifndef TORRENT_DISABLE_FULL_STATS - + m_stat[download_ip_protocol].rate() -#endif - ; + + m_stat[download_ip_protocol].rate(); } size_type total_upload() const { return m_stat[upload_payload].total() + m_stat[upload_protocol].total() -#ifndef TORRENT_DISABLE_FULL_STATS - + m_stat[upload_ip_protocol].total() -#endif - ; + + m_stat[upload_ip_protocol].total(); } size_type total_download() const { return m_stat[download_payload].total() + m_stat[download_protocol].total() -#ifndef TORRENT_DISABLE_FULL_STATS - + m_stat[download_ip_protocol].total() -#endif - ; + + m_stat[download_ip_protocol].total(); } int upload_payload_rate() const @@ -299,10 +262,8 @@ namespace libtorrent upload_protocol, download_payload, download_protocol, -#ifndef TORRENT_DISABLE_FULL_STATS upload_ip_protocol, download_ip_protocol, -#endif num_channels }; diff --git a/src/alert.cpp b/src/alert.cpp index 359e87624..f3e27fad8 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -394,16 +394,8 @@ namespace libtorrent { : torrent_alert(h) , interval(in) { -#ifndef TORRENT_DISABLE_FULL_STATS for (int i = 0; i < num_channels; ++i) transferred[i] = s[i].counter(); -#else - const int len = download_protocol + 1; - for (int i = 0; i < download_protocol + 1; ++i) - transferred[i] = s[i].counter(); - for (int i = len; i < num_channels; ++i) - transferred[i] = 0; -#endif } std::string stats_alert::message() const diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 08f945c3e..a23cd2b7f 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -5389,19 +5389,11 @@ retry: s.payload_upload_rate = m_stat.transfer_rate(stat::upload_payload); s.total_payload_upload = m_stat.total_transfer(stat::upload_payload); -#ifndef TORRENT_DISABLE_FULL_STATS // IP-overhead s.ip_overhead_download_rate = m_stat.transfer_rate(stat::download_ip_protocol); s.total_ip_overhead_download = m_stat.total_transfer(stat::download_ip_protocol); s.ip_overhead_upload_rate = m_stat.transfer_rate(stat::upload_ip_protocol); s.total_ip_overhead_upload = m_stat.total_transfer(stat::upload_ip_protocol); -#else - // IP-overhead - s.ip_overhead_download_rate = 0; - s.total_ip_overhead_download = 0; - s.ip_overhead_upload_rate = 0; - s.total_ip_overhead_upload = 0; -#endif // tracker s.total_tracker_download = m_stats_counters[counters::recv_tracker_bytes]; diff --git a/src/tracker_manager.cpp b/src/tracker_manager.cpp index 43ce0f592..51d7690fc 100644 --- a/src/tracker_manager.cpp +++ b/src/tracker_manager.cpp @@ -177,7 +177,6 @@ namespace libtorrent close(); } - // TODO: 3 replace this with performance counters. remove depedency on session_impl void tracker_connection::sent_bytes(int bytes) { m_man.sent_bytes(bytes);