8 //#define TUPLE_PREFETCH
9 #define BTREE_NODE_PREFETCH
10 //#define DIE_ON_ABORT
11 //#define TRAP_LARGE_ALLOOCATIONS
12 #define USE_BUILTIN_MEMFUNCS
13 //#define CHECK_INVARIANTS
14 //#define TUPLE_CHECK_KEY
15 #define USE_SMALL_CONTAINER_OPT
16 #define BTREE_NODE_ALLOC_CACHE_ALIGNED
17 #define TXN_BTREE_DUMP_PURGE_STATS
18 //#define ENABLE_EVENT_COUNTERS
19 //#define ENABLE_BENCH_TXN_COUNTERS
20 #define USE_VARINT_ENCODING
21 //#define DISABLE_FIELD_SELECTION
22 //#define PARANOID_CHECKING
23 //#define BTREE_LOCK_OWNERSHIP_CHECKING
24 //#define TUPLE_LOCK_OWNERSHIP_CHECKING
25 //#define MEMCHECK_MAGIC 0xFF
27 //#define PROTO2_CAN_DISABLE_GC
28 //#define PROTO2_CAN_DISABLE_SNAPSHOTS
29 //#define USE_PERF_CTRS
32 #error "no CONFIG_H set"
38 * some non-sensical options, which only make sense for performance debugging
39 * experiments. these should ALL be DISABLED when doing actual benchmarking
41 //#define LOGGER_UNSAFE_FAKE_COMPRESSION
42 //#define LOGGER_UNSAFE_REDUCE_BUFFER_SIZE
43 //#define LOGGER_STRIDE_OVER_BUFFER
45 #define CACHELINE_SIZE 64 // XXX: don't assume x86
46 #define LG_CACHELINE_SIZE __builtin_ctz(CACHELINE_SIZE)
48 // global maximum on the number of unique threads allowed
50 #define NMAXCOREBITS 9
51 #define NMAXCORES (1 << NMAXCOREBITS)
53 // some helpers for cacheline alignment
54 #define CACHE_ALIGNED __attribute__((aligned(CACHELINE_SIZE)))
56 #define __XCONCAT2(a, b) a ## b
57 #define __XCONCAT(a, b) __XCONCAT2(a, b)
58 #define CACHE_PADOUT \
59 char __XCONCAT(__padout, __COUNTER__)[0] __attribute__((aligned(CACHELINE_SIZE)))
60 #define PACKED __attribute__((packed))
62 #define NEVER_INLINE __attribute__((noinline))
63 #define ALWAYS_INLINE __attribute__((always_inline))
64 #define UNUSED __attribute__((unused))
66 #define likely(x) __builtin_expect(!!(x), 1)
67 #define unlikely(x) __builtin_expect(!!(x), 0)
69 #define COMPILER_MEMORY_FENCE asm volatile("" ::: "memory")
72 #define ALWAYS_ASSERT(expr) (likely((expr)) ? (void)0 : abort())
74 #define ALWAYS_ASSERT(expr) assert((expr))
77 #define ARRAY_NELEMS(a) (sizeof(a)/sizeof((a)[0]))
79 #define VERBOSE(expr) ((void)0)
80 //#define VERBOSE(expr) (expr)
82 #ifdef CHECK_INVARIANTS
83 #define INVARIANT(expr) ALWAYS_ASSERT(expr)
85 #define INVARIANT(expr) ((void)0)
86 #endif /* CHECK_INVARIANTS */
88 // XXX: would be nice if we checked these during single threaded execution
89 #define SINGLE_THREADED_INVARIANT(expr) ((void)0)
92 #define SMALL_SIZE_VEC 128
93 #define SMALL_SIZE_MAP 64
94 #define EXTRA_SMALL_SIZE_MAP 8
96 //#define BACKOFF_SPINS_FACTOR 1000
97 //#define BACKOFF_SPINS_FACTOR 100
98 #define BACKOFF_SPINS_FACTOR 10
100 // throw exception after the assert(), so that GCC knows
101 // we'll never return
102 #define NDB_UNIMPLEMENTED(what) \
104 ALWAYS_ASSERT(false); \
105 throw ::std::runtime_error(what); \
108 #ifdef USE_BUILTIN_MEMFUNCS
109 #define NDB_MEMCPY __builtin_memcpy
110 #define NDB_MEMSET __builtin_memset
112 #define NDB_MEMCPY memcpy
113 #define NDB_MEMSET memset
116 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
117 #define GCC_AT_LEAST_47 1
119 #define GCC_AT_LEAST_47 0
122 // g++-4.6 does not support override
124 #define OVERRIDE override
129 // number of nanoseconds in 1 second (1e9)
130 #define ONE_SECOND_NS 1000000000
132 #endif /* _MACROS_H_ */