Merge pull request #947 from yuslepukhin/align_and_yield

Align statistics
This commit is contained in:
Siying Dong 2016-01-14 10:28:40 -08:00
commit addd9545f8
3 changed files with 10 additions and 2 deletions

View File

@ -16,6 +16,8 @@
// in fact, we could use that one
#define ROCKSDB_PRIszt "zu"
#define __declspec(S)
#define ROCKSDB_NOEXCEPT noexcept
#undef PLATFORM_IS_LITTLE_ENDIAN

View File

@ -245,7 +245,7 @@ extern void InitOnce(OnceType* once, void (*initializer)());
static inline void AsmVolatilePause() {
#if defined(_M_IX86) || defined(_M_X64)
::_mm_pause();
YieldProcessor();
#endif
// it would be nice to get "wfe" on ARM here
}

View File

@ -61,7 +61,13 @@ class StatisticsImpl : public Statistics {
char padding[64 - sizeof(std::atomic_uint_fast64_t)];
};
Ticker tickers_[INTERNAL_TICKER_ENUM_MAX] __attribute__((aligned(64)));
static_assert(sizeof(Ticker) == 64, "Expecting to fit into 64 bytes");
// Attributes expand to nothing depending on the platform
__declspec(align(64))
Ticker tickers_[INTERNAL_TICKER_ENUM_MAX]
__attribute__((aligned(64)));
__declspec(align(64))
HistogramImpl histograms_[INTERNAL_HISTOGRAM_ENUM_MAX]
__attribute__((aligned(64)));
};