Click
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
FixedEWMAXParameters< STABILITY, SCALE, T, U > Class Template Reference

Parameters for a EWMA with constant scaling factor and stability shift. More...

#include <click/ewma.hh>

Inheritance diagram for FixedEWMAXParameters< STABILITY, SCALE, T, U >:
RateEWMAXParameters< STABILITY, SCALE, T, U >

Public Types

typedef T value_type
 
typedef U signed_value_type
 

Static Public Member Functions

static unsigned stability_shift ()
 Return this EWMA's stability shift.
 
static unsigned scale ()
 Return this EWMA's scaling factor (bits of fraction).
 
static value_type scaled_one ()
 Return this EWMA's scaled value for one.
 
static unsigned compensation ()
 Return this EWMA's compensation.
 

Detailed Description

template<unsigned STABILITY, unsigned SCALE, typename T = unsigned, typename U = int>
class FixedEWMAXParameters< STABILITY, SCALE, T, U >

Parameters for a EWMA with constant scaling factor and stability shift.

The FixedEWMAXParameters template class is used as a template argument to DirectEWMAX. It defines a EWMA with fixed constant scaling factor and stability shift. FixedEWMAXParameters's first template argument is the EWMA's stability shift, its second template argument is the EWMA's scaling factor, its third template argument is the EWMA's value type, and the fourth template argument is the EWMA's signed value type.

Example 1: DirectEWMAX<FixedEWMAXParameters<4, 10, unsigned, int> > defines a EWMA with alpha 1/16 (stability shift 4), scaling factor 10, and value type unsigned. (These are the default parameters available in the DirectEWMA typedef.)

Example 2: DirectEWMAX<FixedEWMAXParameters<3, 10, uint64_t, int64_t> > defines a EWMA with alpha 1/8 (stability shift 3), scaling factor 10, and value type uint64_t.

Member Function Documentation

◆ stability_shift()

template<unsigned STABILITY, unsigned SCALE, typename T = unsigned, typename U = int>
static unsigned FixedEWMAXParameters< STABILITY, SCALE, T, U >::stability_shift ( )
inlinestatic

Return this EWMA's stability shift.

Returns
the 1st template parameter

◆ scale()

template<unsigned STABILITY, unsigned SCALE, typename T = unsigned, typename U = int>
static unsigned FixedEWMAXParameters< STABILITY, SCALE, T, U >::scale ( )
inlinestatic

Return this EWMA's scaling factor (bits of fraction).

Returns
the 2nd template parameter

◆ scaled_one()

template<unsigned STABILITY, unsigned SCALE, typename T = unsigned, typename U = int>
static value_type FixedEWMAXParameters< STABILITY, SCALE, T, U >::scaled_one ( )
inlinestatic

Return this EWMA's scaled value for one.

◆ compensation()

template<unsigned STABILITY, unsigned SCALE, typename T = unsigned, typename U = int>
static unsigned FixedEWMAXParameters< STABILITY, SCALE, T, U >::compensation ( )
inlinestatic

Return this EWMA's compensation.

Returns
1 << (stability_shift() - 1)

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