35 #define CACHE_LINE_SIZE         64 
   41 template <
typename Type, 
int N>
 
   51 #ifdef HAVE_SCHED_GETCPU 
   55 template <
typename Type, 
int N>
 
   60         size_t get_rnd_index() const UNIV_NOTHROW {
 
   62                 size_t  cpu = sched_getcpu();
 
   73 template <
typename Type, 
int N>
 
   86 template <
typename Type, 
int N=1>
 
   97         size_t get_rnd_index() const UNIV_NOTHROW {
 
  113         ib_counter_t() { memset(m_counter, 0x0, 
sizeof(m_counter)); }
 
  120         bool validate() UNIV_NOTHROW {
 
  125                 for (
size_t i = 0; 
i < UT_ARR_SIZE(m_counter); 
i += 
n) {
 
  126                         for (
size_t j = 1; j < n - 1; ++j) {
 
  127                                 ut_ad(m_counter[
i + j] == 0);
 
  139         void add(Type 
n) UNIV_NOTHROW {
 
  140                 size_t  i = m_policy.offset(m_policy.get_rnd_index());
 
  142                 ut_ad(i < UT_ARR_SIZE(m_counter));
 
  152                 size_t  i = m_policy.offset(
index);
 
  154                 ut_ad(i < UT_ARR_SIZE(m_counter));
 
  164         void sub(Type 
n) UNIV_NOTHROW {
 
  165                 size_t  i = m_policy.offset(m_policy.get_rnd_index());
 
  167                 ut_ad(i < UT_ARR_SIZE(m_counter));
 
  177                 size_t  i = m_policy.offset(
index);
 
  179                 ut_ad(i < UT_ARR_SIZE(m_counter));
 
  185         operator Type() const UNIV_NOTHROW {
 
  188                 for (
size_t i = 0; 
i < N; ++
i) {
 
  189                         total += m_counter[m_policy.offset(
i)];
 
  197         Indexer<Type, N>m_policy;