Align statistics

Use Yield macro to make it a little more portable between platforms.
This commit is contained in:
Dmitri Smirnov 2016-01-13 14:51:58 -08:00
parent b54d4dd435
commit ac50fd3a71
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)));
};