Click
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
TokenBucketJiffyParameters< T > Class Template Reference

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.
 

Detailed Description

template<typename T>
class TokenBucketJiffyParameters< T >

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.

Member Typedef Documentation

◆ token_type

template<typename T >
typedef T TokenBucketJiffyParameters< T >::token_type

The type of tokens. Always unsigned.

◆ time_point_type

template<typename T >
typedef click_jiffies_t TokenBucketJiffyParameters< T >::time_point_type

The type of a time point. Always unsigned.

◆ duration_type

template<typename T >
typedef click_jiffies_difference_t TokenBucketJiffyParameters< T >::duration_type

The type of a difference between time points. Always signed.

Member Function Documentation

◆ now()

template<typename T >
static time_point_type TokenBucketJiffyParameters< T >::now ( )
inlinestatic

Return the current time point.

Note
TokenBucketJiffyParameters measures time points in jiffies.

◆ time_monotonic_difference()

template<typename T >
static duration_type TokenBucketJiffyParameters< T >::time_monotonic_difference ( time_point_type  a,
time_point_type  b 
)
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.

◆ time_less()

template<typename T >
static bool TokenBucketJiffyParameters< T >::time_less ( time_point_type  a,
time_point_type  b 
)
inlinestatic

Return true if a happened before b.

◆ frequency()

template<typename T >
static unsigned TokenBucketJiffyParameters< T >::frequency ( )
inlinestatic

Return the number of time points per period.

Here, this is the number of jiffies per second.

◆ timestamp() [1/2]

template<typename T >
static Timestamp TokenBucketJiffyParameters< T >::timestamp ( time_point_type  x)
inlinestatic

Return the Timestamp representing a given time point.

◆ timestamp() [2/2]

template<typename T >
static Timestamp TokenBucketJiffyParameters< T >::timestamp ( duration_type  x)
inlinestatic

Return the Timestamp representing a given tick count.


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