Print Fast CRC32 support information in DB LOG

Summary: Print whether fast CRC32 is supported in DB info LOG

Test Plan: Run db_bench and see it prints out correctly.

Reviewers: yhchiang, anthony, kradhakrishnan, igor

Reviewed By: igor

Subscribers: MarkCallaghan, yoshinorim, leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D41733
main
sdong 9 years ago
parent a6e38fd170
commit 5fd11853cb
  1. 7
      db/db_impl.cc
  2. 8
      util/crc32c.cc
  3. 2
      util/crc32c.h

@ -70,6 +70,7 @@
#include "util/build_version.h" #include "util/build_version.h"
#include "util/coding.h" #include "util/coding.h"
#include "util/compression.h" #include "util/compression.h"
#include "util/crc32c.h"
#include "util/db_info_dumper.h" #include "util/db_info_dumper.h"
#include "util/file_util.h" #include "util/file_util.h"
#include "util/hash_skiplist_rep.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, "Compression algorithms supported:");
Log(InfoLogLevel::INFO_LEVEL, logger, "\tSnappy supported: %d", Log(InfoLogLevel::INFO_LEVEL, logger, "\tSnappy supported: %d",
Snappy_Supported()); Snappy_Supported());
@ -203,6 +204,8 @@ void DumpCompressionInfo(Logger* logger) {
Log(InfoLogLevel::INFO_LEVEL, logger, "\tBzip supported: %d", Log(InfoLogLevel::INFO_LEVEL, logger, "\tBzip supported: %d",
BZip2_Supported()); BZip2_Supported());
Log(InfoLogLevel::INFO_LEVEL, logger, "\tLZ4 supported: %d", LZ4_Supported()); Log(InfoLogLevel::INFO_LEVEL, logger, "\tLZ4 supported: %d", LZ4_Supported());
Log(InfoLogLevel::INFO_LEVEL, logger, "Fast CRC32 supported: %d",
crc32c::IsFastCrc32Supported());
} }
} // namespace } // namespace
@ -265,7 +268,7 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname)
DumpRocksDBBuildVersion(db_options_.info_log.get()); DumpRocksDBBuildVersion(db_options_.info_log.get());
DumpDBFileSummary(db_options_, dbname_); DumpDBFileSummary(db_options_, dbname_);
db_options_.Dump(db_options_.info_log.get()); 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); LogFlush(db_options_.info_log);
} }

@ -383,6 +383,14 @@ static inline Function Choose_Extend() {
return isSSE42() ? ExtendImpl<Fast_CRC32> : ExtendImpl<Slow_CRC32>; return isSSE42() ? ExtendImpl<Fast_CRC32> : ExtendImpl<Slow_CRC32>;
} }
bool IsFastCrc32Supported() {
#ifdef __SSE4_2__
return isSSE42();
#else
return false;
#endif
}
Function ChosenExtend = Choose_Extend(); Function ChosenExtend = Choose_Extend();
uint32_t Extend(uint32_t crc, const char* buf, size_t size) { uint32_t Extend(uint32_t crc, const char* buf, size_t size) {

@ -14,6 +14,8 @@
namespace rocksdb { namespace rocksdb {
namespace crc32c { namespace crc32c {
extern bool IsFastCrc32Supported();
// Return the crc32c of concat(A, data[0,n-1]) where init_crc is the // 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 some string A. Extend() is often used to maintain the
// crc32c of a stream of data. // crc32c of a stream of data.

Loading…
Cancel
Save