|
Click
|
Helper class for token bucket rate limiter. More...
#include <click/tokenbucket.hh>
Public Types | |
| typedef T | token_type |
| The type of tokens. Always unsigned. | |
| typedef click_jiffies_t | time_point_type |
| The type of a time point. Always unsigned. | |
| typedef click_jiffies_difference_t | duration_type |
| The type of a difference between time points. Always signed. | |
Static Public Member Functions | |
| static time_point_type | now () |
| Return the current time point. | |
| static time_point_type | time_point (time_point_type t) |
| static duration_type | time_monotonic_difference (time_point_type a, time_point_type b) |
| Return b - a, assuming that b was measured after a. | |
| static bool | time_less (time_point_type a, time_point_type b) |
| Return true if a happened before b. | |
| static unsigned | frequency () |
| Return the number of time points per period. | |
| static Timestamp | timestamp (time_point_type x) |
| Return the Timestamp representing a given time point. | |
| static Timestamp | timestamp (duration_type x) |
| Return the Timestamp representing a given tick count. | |
Helper class for token bucket rate limiter.
never
Pass this class as the parameter to TokenRateX. TokenBucketJiffyParameters measures ticks in units of jiffies. The template parameter is the type of tokens.
| typedef T TokenBucketJiffyParameters< T >::token_type |
The type of tokens. Always unsigned.
| typedef click_jiffies_t TokenBucketJiffyParameters< T >::time_point_type |
The type of a time point. Always unsigned.
| typedef click_jiffies_difference_t TokenBucketJiffyParameters< T >::duration_type |
The type of a difference between time points. Always signed.
|
inlinestatic |
Return the current time point.
|
inlinestatic |
Return b - a, assuming that b was measured after a.
Some time measurements can, in rare cases, appear to jump backwards, as timestamps do when the user changes the current time. If this happens, and b < a (even though b happened after a), time_monotonic_difference must return 0.
|
inlinestatic |
Return true if a happened before b.
|
inlinestatic |
Return the number of time points per period.
Here, this is the number of jiffies per second.
|
inlinestatic |
Return the Timestamp representing a given time point.
|
inlinestatic |
Return the Timestamp representing a given tick count.