Browse Source

Merge pull request #14652 from jagannatharjun/speed-plot-view-minor

Minor updates to Speed plot view
adaptive-webui-19844
Chocobo1 4 years ago committed by GitHub
parent
commit
5045fa6dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/gui/properties/speedplotview.cpp

5
src/gui/properties/speedplotview.cpp

@ -110,7 +110,7 @@ SpeedPlotView::Averager::Averager(const milliseconds duration, const millisecond @@ -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.
@ -120,8 +120,7 @@ bool SpeedPlotView::Averager::push(const SampleData &sampleData) @@ -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<int64_t>(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

Loading…
Cancel
Save