Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. C/C++
  4. Comms
  5. pw_transfer
  6. pw::transfer::RateEstimate Class Reference
Loading...
Searching...
No Matches
pw::transfer::RateEstimate Class Reference

Overview

Estimates the data transfer rate in bytes per second over elapsed wall time.

Public Member Functions

constexpr RateEstimate ()
 Constructs an unstarted RateEstimate.
 
void Reset ()
 Resets the start time to the current time and clears the byte counter.
 
constexpr void Update (size_t new_bytes)
 
size_t GetRateBytesPerSecond () const
 

Member Function Documentation

◆ GetRateBytesPerSecond()

size_t pw::transfer::RateEstimate::GetRateBytesPerSecond ( ) const

Calculates the average transfer rate since Reset() was called.

Returns
The estimated transfer rate in bytes per second, or 0 if Reset() has not been called or less than 1 millisecond has elapsed.

◆ Update()

constexpr void pw::transfer::RateEstimate::Update ( size_t  new_bytes)
inlineconstexpr

Records additional transferred bytes.

Parameters
[in]new_bytesNumber of newly transferred bytes to add.

The documentation for this class was generated from the following file: