Align statistics

Use Yield macro to make it a little more portable between platforms.
main
Dmitri Smirnov 9 years ago
parent b54d4dd435
commit ac50fd3a71
  1. 2
      port/port_posix.h
  2. 2
      port/win/port_win.h
  3. 8
      util/statistics.h

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

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

@ -61,7 +61,13 @@ class StatisticsImpl : public Statistics {
char padding[64 - sizeof(std::atomic_uint_fast64_t)]; 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] HistogramImpl histograms_[INTERNAL_HISTOGRAM_ENUM_MAX]
__attribute__((aligned(64))); __attribute__((aligned(64)));
}; };

Loading…
Cancel
Save