From 7fd2fd473287ce558d9fa52630b724c32e6b34c9 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 28 Oct 2008 06:45:42 +0000 Subject: [PATCH] added performance warnings for when the IP overhead eats up the entire up- or download rate limit --- docs/manual.rst | 2 ++ include/libtorrent/alert_types.hpp | 6 +++++- src/session_impl.cpp | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/manual.rst b/docs/manual.rst index edd8efebe..e7bff4d2f 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -4368,6 +4368,8 @@ upload or download rate performance. { outstanding_disk_buffer_limit_reached, outstanding_request_limit_reached, + upload_limit_too_low, + download_limit_too_low }; performance_warning_t warning_code; diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 1db56e443..3522c9164 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -158,7 +158,9 @@ namespace libtorrent enum performance_warning_t { outstanding_disk_buffer_limit_reached, - outstanding_request_limit_reached + outstanding_request_limit_reached, + upload_limit_too_low, + download_limit_too_low }; performance_alert(torrent_handle const& h @@ -177,6 +179,8 @@ namespace libtorrent { "max outstanding disk writes reached", "max outstanding piece requests reached", + "upload limit too low (download rate will suffer)", + "download limit too low (upload rate will suffer)" }; return torrent_alert::message() + ": performance warning: " diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 261d2cfa0..f67559468 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1104,11 +1104,25 @@ namespace aux { + m_stat.download_dht() + m_stat.download_tracker()); + if (m_stat.download_ip_overhead() >= m_download_channel.throttle() + && m_alerts.should_post()) + { + m_alerts.post_alert(performance_alert(torrent_handle() + , performance_alert::download_limit_too_low)); + } + m_upload_channel.drain( m_stat.upload_ip_overhead() + m_stat.upload_dht() + m_stat.upload_tracker()); + if (m_stat.upload_ip_overhead() >= m_upload_channel.throttle() + && m_alerts.should_post()) + { + m_alerts.post_alert(performance_alert(torrent_handle() + , performance_alert::upload_limit_too_low)); + } + m_stat.second_tick(tick_interval); // --------------------------------------------------------------