MySQL  8.0.20
Source Code Documentation
ib_counter_t< Type, N, Indexer > Class Template Reference

Class for using fuzzy counters. More...

#include <ut0counter.h>

Public Member Functions

 ib_counter_t ()
 
 ~ib_counter_t ()
 
bool validate () 1
 
void inc () 1
 If you can't use a good index id. More...
 
void add (Type n) 1
 If you can't use a good index id. More...
 
void add (size_t index, Type n) 1
 Use this if you can use a unique identifier, saves a call to get_rnd_index(). More...
 
void dec () 1
 If you can't use a good index id. More...
 
void sub (Type n) 1
 If you can't use a good index id. More...
 
void sub (size_t index, Type n) 1
 Use this if you can use a unique identifier, saves a call to get_rnd_index(). More...
 
 operator Type () const 1
 
Type operator[] (size_t index) const 1
 

Static Public Member Functions

static bool is_fast ()
 

Private Attributes

Indexer< Type, N > m_policy
 Indexer into the array. More...
 
Type m_counter [(N+1) *(INNOBASE_CACHE_LINE_SIZE/sizeof(Type))]
 Slot 0 is unused. More...
 

Detailed Description

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
class ib_counter_t< Type, N, Indexer >

Class for using fuzzy counters.

The counter is not protected by any mutex and the results are not guaranteed to be 100% accurate but close enough. Creates an array of counters and separates each element by the INNOBASE_CACHE_LINE_SIZE bytes

Constructor & Destructor Documentation

◆ ib_counter_t()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
ib_counter_t< Type, N, Indexer >::ib_counter_t ( )
inline

◆ ~ib_counter_t()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
ib_counter_t< Type, N, Indexer >::~ib_counter_t ( )
inline

Member Function Documentation

◆ add() [1/2]

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
void ib_counter_t< Type, N, Indexer >::add ( Type  n)
inline

If you can't use a good index id.

Parameters
nis the amount to increment

◆ add() [2/2]

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
void ib_counter_t< Type, N, Indexer >::add ( size_t  index,
Type  n 
)
inline

Use this if you can use a unique identifier, saves a call to get_rnd_index().

Parameters
indexindex into a slot
namount to increment

◆ dec()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
void ib_counter_t< Type, N, Indexer >::dec ( )
inline

If you can't use a good index id.

Decrement by 1.

◆ inc()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
void ib_counter_t< Type, N, Indexer >::inc ( )
inline

If you can't use a good index id.

Increment by 1.

◆ is_fast()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
static bool ib_counter_t< Type, N, Indexer >::is_fast ( )
inlinestatic

◆ operator Type()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
ib_counter_t< Type, N, Indexer >::operator Type ( ) const
inline

◆ operator[]()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
Type ib_counter_t< Type, N, Indexer >::operator[] ( size_t  index) const
inline

◆ sub() [1/2]

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
void ib_counter_t< Type, N, Indexer >::sub ( Type  n)
inline

If you can't use a good index id.

Parameters
nthe amount to decrement

◆ sub() [2/2]

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
void ib_counter_t< Type, N, Indexer >::sub ( size_t  index,
Type  n 
)
inline

Use this if you can use a unique identifier, saves a call to get_rnd_index().

Parameters
indexindex into a slot
namount to decrement

◆ validate()

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
bool ib_counter_t< Type, N, Indexer >::validate ( )
inline

Member Data Documentation

◆ m_counter

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
Type ib_counter_t< Type, N, Indexer >::m_counter[(N+1) *(INNOBASE_CACHE_LINE_SIZE/sizeof(Type))]
private

Slot 0 is unused.

◆ m_policy

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = default_indexer_t>
Indexer<Type, N> ib_counter_t< Type, N, Indexer >::m_policy
private

Indexer into the array.


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