InnoDB Plugin  1.0
Public Member Functions | Private Attributes
ib_counter_t< Type, N, Indexer > Class Template Reference

#include <ut0counter.h>

Public Member Functions

bool validate () UNIV_NOTHROW
void inc () UNIV_NOTHROW
void add (Type n) UNIV_NOTHROW
void add (size_t index, Type n) UNIV_NOTHROW
void dec () UNIV_NOTHROW
void sub (Type n) UNIV_NOTHROW
void sub (size_t index, Type n) UNIV_NOTHROW
 operator Type () const UNIV_NOTHROW

Private Attributes

Indexer< Type, N > m_policy
Type m_counter [(N+1)*(CACHE_LINE_SIZE/sizeof(Type))]

Detailed Description

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = thread_id_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 CACHE_LINE_SIZE bytes

Member Function Documentation

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

If you can't use a good index id.

Parameters
n- is the amount to increment
template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = thread_id_indexer_t>
void ib_counter_t< Type, N, Indexer >::add ( size_t  index,
Type  n 
)
inline
Use this if you can use a unique indentifier, saves a

call to get_rnd_index().

Parameters
i- index into a slot
n- amount to increment
template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = thread_id_indexer_t>
void ib_counter_t< Type, N, Indexer >::dec ( )
inline

If you can't use a good index id. Decrement by 1.

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

If you can't use a good index id. Increment by 1.

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

If you can't use a good index id.

Parameters
-n is the amount to decrement
template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = thread_id_indexer_t>
void ib_counter_t< Type, N, Indexer >::sub ( size_t  index,
Type  n 
)
inline
Use this if you can use a unique indentifier, saves a

call to get_rnd_index().

Parameters
i- index into a slot
n- amount to decrement

Field Documentation

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

Slot 0 is unused.

template<typename Type, int N = IB_N_SLOTS, template< typename, int > class Indexer = thread_id_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: