Return the time window approximated by a leaky bucket of given size.
Synopsis
Declared in <balb_leakybucket.h>
static
bsls::TimeInterval
calculateTimeWindow(
bsls::Types::Uint64 drainRate,
bsls::Types::Uint64 capacity);
Description
Return the time interval over which a leaky bucket approximates a moving‐total of submitted units, as the rounded‐down ratio between the specified capacity and the specified drainRate. If the rounded ratio is 0, return a time interval of 1 nanosecond. The behavior is undefined unless drainRate > 0 and capacity / drainRate can be represented with 64‐bit signed integral type.
Return Value
time interval approximating the moving‐total window for the given capacity and drain rate
Parameters
Name |
Description |
drainRate |
rate at which units drain from the bucket |
capacity |
capacity of the leaky bucket in units |
Created with MrDocs