Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::detail::average_rate_meter Class Reference

Public Member Functions

 average_rate_meter (const microseconds &time_constant=seconds(10))
 
void set_time_constant (const microseconds &time_constant)
 
void update (uint32_t bytes_transferred=0)
 
uint32_t get_average_rate () const
 

Detailed Description

Definition at line 134 of file rate_limiting.cpp.

Constructor & Destructor Documentation

◆ average_rate_meter()

fc::detail::average_rate_meter::average_rate_meter ( const microseconds & time_constant = seconds(10))

Definition at line 149 of file rate_limiting.cpp.

149 :
150 _average_rate(0.),
151 _unaccounted_bytes(0),
152 _last_update_time(time_point_sec::min()),
153 _time_constant(time_constant)
154 {}
static constexpr time_point_sec min()
Definition time.hpp:85

Member Function Documentation

◆ get_average_rate()

uint32_t fc::detail::average_rate_meter::get_average_rate ( ) const

Definition at line 185 of file rate_limiting.cpp.

186 {
187 update_const();
188 return (uint32_t)_average_rate;
189 }
unsigned int uint32_t
Definition stdint.h:126

◆ set_time_constant()

void fc::detail::average_rate_meter::set_time_constant ( const microseconds & time_constant)

Definition at line 155 of file rate_limiting.cpp.

156 {
157 _time_constant = time_constant;
158 }

◆ update()

void fc::detail::average_rate_meter::update ( uint32_t bytes_transferred = 0)

Definition at line 159 of file rate_limiting.cpp.

160 {
161 update_const(bytes_transferred);
162 }
Here is the caller graph for this function:

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