提交 5fd11853 编写于 作者: S sdong

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
上级 a6e38fd1
......@@ -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);
}
......
......@@ -383,6 +383,14 @@ static inline Function Choose_Extend() {
return isSSE42() ? ExtendImpl<Fast_CRC32> : ExtendImpl<Slow_CRC32>;
}
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) {
......
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册