#include <ratecalc.h>

Public Member Functions | |
| RateCalculator (unsigned AveragingTime=-1) | |
| Creates the sliding average rate calculator. | |
| void | ReportNewAbsoluteDone (ULONGLONG Done) |
| void | ReportNewRelativeDone (ULONGLONG Done) |
| void | SetAveragingTime (unsigned NewTime) |
| void | Reset (ULONGLONG InitialValue=0) |
| TimeSpan | GetExpectedRemainingTime (ULONGLONG TotalDownloadSize) |
| unsigned | GetBytesPerSecond () |
Static Public Member Functions | |
| static String | FormatByteCount (ULONGLONG value) |
| static String | FormatTimeSpan (const TimeSpan &span) |
Protected Member Functions | |
| void | UpdateAverage () |
Private Types | |
| enum | { EstimatedTimeRateFilteringCoef = 100 } |
Private Attributes | |
| unsigned | m_AveragingTime |
| ULONGLONG | m_Downloaded |
| unsigned | m_CachedValue |
| DateTime | m_StartTime |
| AtomicOperationLock | m_Lock |
| ExponentialFilterI32 | m_RateFilter |
The RateCalculator class can be used for realtime transfer rate calculation. It requires the number of bytes transferred at a certain point of time. All time evaluation and calculation is done automatically.
| BazisLib::Network::RateCalculator::RateCalculator | ( | unsigned | AveragingTime = -1 |
) |
Creates the sliding average rate calculator.
| AveragingTime | Specifies the averaging time in milliseconds -1 stands for overall rate calculation. |
| static String BazisLib::Network::RateCalculator::FormatByteCount | ( | ULONGLONG | value | ) | [inline, static] |
| static String BazisLib::Network::RateCalculator::FormatTimeSpan | ( | const TimeSpan & | span | ) | [inline, static] |

| unsigned BazisLib::Network::RateCalculator::GetBytesPerSecond | ( | ) |
| TimeSpan BazisLib::Network::RateCalculator::GetExpectedRemainingTime | ( | ULONGLONG | TotalDownloadSize | ) |
| void BazisLib::Network::RateCalculator::ReportNewAbsoluteDone | ( | ULONGLONG | Done | ) |
| void BazisLib::Network::RateCalculator::ReportNewRelativeDone | ( | ULONGLONG | Done | ) |
| void BazisLib::Network::RateCalculator::Reset | ( | ULONGLONG | InitialValue = 0 |
) | [inline] |

| void BazisLib::Network::RateCalculator::SetAveragingTime | ( | unsigned | NewTime | ) | [inline] |
| void BazisLib::Network::RateCalculator::UpdateAverage | ( | ) | [protected] |
unsigned BazisLib::Network::RateCalculator::m_AveragingTime [private] |
unsigned BazisLib::Network::RateCalculator::m_CachedValue [private] |