diff --git a/db/db_impl.cc b/db/db_impl.cc index 1c7f734d850e24afa5f616f451bcc16719ce9b71..32487dcf93e2b2cde393d6763f938364780565d1 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -70,6 +70,7 @@ #include "util/build_version.h" #include "util/coding.h" #include "util/compression.h" +#include "util/crc32c.h" #include "util/db_info_dumper.h" #include "util/file_util.h" #include "util/hash_skiplist_rep.h" @@ -194,7 +195,7 @@ CompressionType GetCompressionFlush(const ImmutableCFOptions& ioptions) { } } -void DumpCompressionInfo(Logger* logger) { +void DumpSupportInfo(Logger* logger) { Log(InfoLogLevel::INFO_LEVEL, logger, "Compression algorithms supported:"); Log(InfoLogLevel::INFO_LEVEL, logger, "\tSnappy supported: %d", Snappy_Supported()); @@ -203,6 +204,8 @@ void DumpCompressionInfo(Logger* logger) { Log(InfoLogLevel::INFO_LEVEL, logger, "\tBzip supported: %d", BZip2_Supported()); Log(InfoLogLevel::INFO_LEVEL, logger, "\tLZ4 supported: %d", LZ4_Supported()); + Log(InfoLogLevel::INFO_LEVEL, logger, "Fast CRC32 supported: %d", + crc32c::IsFastCrc32Supported()); } } // namespace @@ -265,7 +268,7 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname) DumpRocksDBBuildVersion(db_options_.info_log.get()); DumpDBFileSummary(db_options_, dbname_); db_options_.Dump(db_options_.info_log.get()); - DumpCompressionInfo(db_options_.info_log.get()); + DumpSupportInfo(db_options_.info_log.get()); LogFlush(db_options_.info_log); } diff --git a/util/crc32c.cc b/util/crc32c.cc index 8f1a09e17edf18133336ca2d485d6248f4c036f4..b8d281a275e6164fab482228ea1dbdc270f7b67a 100644 --- a/util/crc32c.cc +++ b/util/crc32c.cc @@ -383,6 +383,14 @@ static inline Function Choose_Extend() { return isSSE42() ? ExtendImpl : ExtendImpl; } +bool IsFastCrc32Supported() { +#ifdef __SSE4_2__ + return isSSE42(); +#else + return false; +#endif +} + Function ChosenExtend = Choose_Extend(); uint32_t Extend(uint32_t crc, const char* buf, size_t size) { diff --git a/util/crc32c.h b/util/crc32c.h index e5e6e143e27d98e82897ea7aa20a10f87accfc0c..14167c1a09872c1f738d35f1eb6eedae1e9d5ed9 100644 --- a/util/crc32c.h +++ b/util/crc32c.h @@ -14,6 +14,8 @@ namespace rocksdb { namespace crc32c { +extern bool IsFastCrc32Supported(); + // Return the crc32c of concat(A, data[0,n-1]) where init_crc is the // crc32c of some string A. Extend() is often used to maintain the // crc32c of a stream of data.