From bb39a41e9ead31f8a4b1cb923e03fdb893c1414d Mon Sep 17 00:00:00 2001 From: jagannatharjun Date: Sat, 13 Mar 2021 11:39:14 +0530 Subject: [PATCH 1/2] Update comment --- src/gui/properties/speedplotview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index d0ab84d19..c4c3f6645 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -110,7 +110,7 @@ SpeedPlotView::Averager::Averager(const milliseconds duration, const millisecond bool SpeedPlotView::Averager::push(const SampleData &sampleData) { // Accumulator overflow will be hit in worst case on longest used averaging span, - // defined by divider value. Maximum divider is DIVIDER_24HOUR = 144 + // defined by resolution. Maximum resolution is 144 seconds // Using int32 for accumulator we get overflow when transfer speed reaches 2^31/144 ~~ 14.2 MBytes/s. // With quint64 this speed limit is 2^64/144 ~~ 114 PBytes/s. // This speed is inaccessible to an ordinary user. From 435bb3443507dd224b3579dbb4ba5657dc5cc8fa Mon Sep 17 00:00:00 2001 From: jagannatharjun Date: Sun, 28 Mar 2021 19:45:06 +0530 Subject: [PATCH 2/2] Change clamping of update interval of SpeedPlotView::Averager Don't clamp elapsed time of SpeedPlotView::Averager on resolution. Since it may cause minor discrepencies across different Averagers with different resolution for same speed update. --- src/gui/properties/speedplotview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index c4c3f6645..4628c43d6 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -120,8 +120,7 @@ bool SpeedPlotView::Averager::push(const SampleData &sampleData) // system may go to sleep, that can cause very big elapsed interval const milliseconds updateInterval {static_cast(BitTorrent::Session::instance()->refreshInterval() * 1.25)}; - const milliseconds maxElapsed {std::max(updateInterval, m_resolution)}; - const milliseconds elapsed {std::min(milliseconds {m_lastSampleTime.elapsed()}, maxElapsed)}; + const milliseconds elapsed {std::min(milliseconds {m_lastSampleTime.elapsed()}, updateInterval)}; if (elapsed < m_resolution) return false; // still accumulating