Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion storage/innobase/include/sync0types.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Created 9/5/1995 Heikki Tuuri
#include <iostream>

#include "ut0new.h"
#include "ut0counter.h"

#if defined(UNIV_DEBUG) && !defined(UNIV_INNOCHECKSUM)
/** Set when InnoDB has invoked exit(). */
Expand Down
23 changes: 22 additions & 1 deletion storage/innobase/include/ut0counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Created 2012/04/12 by Sunny Bains
#include <my_rdtsc.h>
#include "univ.i"
#include "os0thread.h"
#include "ut0rnd.h"

/** CPU cache line size */
#ifdef __powerpc__
Expand All @@ -53,6 +54,22 @@ struct generic_indexer_t {
}
};

/** Use random numbers to index into the counter array. */
template <typename Type=ulint, int N=1>
struct get_rand_indexer_t : public generic_indexer_t<Type, N> {
/** Default constructor/destructor should be OK. */

enum { fast = 1 };

/* @return result from ut_rnd_gen_ulint(). */
static size_t get_rnd_index() UNIV_NOTHROW {

ulint idx = ut_rnd_gen_ulint();

return(size_t(idx));
}
};

/** Use the result of my_timer_cycles(), which mainly uses RDTSC for cycles,
to index into the counter array. See the comments for my_timer_cycles() */
template <typename Type=ulint, int N=1>
Expand Down Expand Up @@ -106,7 +123,11 @@ struct single_indexer_t {
}
};

#define default_indexer_t counter_indexer_t
#if defined(__aarch64__) && defined(UNIV_LINUX)
# define default_indexer_t get_rand_indexer_t
#else
# define default_indexer_t counter_indexer_t
#endif

/** 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
Expand Down