mirror of
https://github.com/google/leveldb.git
synced 2025-04-25 14:00:27 +08:00
Merge 2908cfb34c
into ac691084fd
This commit is contained in:
commit
5558a767d6
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -88,7 +88,7 @@ jobs:
|
||||
run: ctest -C "${{ env.CMAKE_BUILD_TYPE }}" --verbose
|
||||
|
||||
- name: Run LevelDB Benchmarks
|
||||
run: ${{ env.BINARY_PATH }}db_bench${{ env.BINARY_SUFFIX }}
|
||||
run: ${{ env.BINARY_PATH }}db_bench${{ env.BINARY_SUFFIX }} --print_process=0
|
||||
|
||||
- name: Run SQLite Benchmarks
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
|
@ -22,12 +22,19 @@ if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif(NOT CMAKE_CXX_STANDARD)
|
||||
|
||||
option(USE_SAN "Use sanitizers to check memory leaks" OFF)
|
||||
|
||||
if (WIN32)
|
||||
set(LEVELDB_PLATFORM_NAME LEVELDB_PLATFORM_WINDOWS)
|
||||
# TODO(cmumford): Make UNICODE configurable for Windows.
|
||||
add_definitions(-D_UNICODE -DUNICODE)
|
||||
else (WIN32)
|
||||
set(LEVELDB_PLATFORM_NAME LEVELDB_PLATFORM_POSIX)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if(USE_SAN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
endif ()
|
||||
endif ()
|
||||
endif (WIN32)
|
||||
|
||||
option(LEVELDB_BUILD_TESTS "Build LevelDB's unit tests" ON)
|
||||
|
@ -129,6 +129,11 @@ static const char* FLAGS_db = nullptr;
|
||||
// ZSTD compression level to try out
|
||||
static int FLAGS_zstd_compression_level = 1;
|
||||
|
||||
// If false, disable FinishedSingleOp() printf
|
||||
static bool FLAGS_print_process = true;
|
||||
|
||||
static bool FLAGS_clean_bench_file = false;
|
||||
|
||||
namespace leveldb {
|
||||
|
||||
namespace {
|
||||
@ -292,23 +297,25 @@ class Stats {
|
||||
}
|
||||
|
||||
done_++;
|
||||
if (done_ >= next_report_) {
|
||||
if (next_report_ < 1000)
|
||||
next_report_ += 100;
|
||||
else if (next_report_ < 5000)
|
||||
next_report_ += 500;
|
||||
else if (next_report_ < 10000)
|
||||
next_report_ += 1000;
|
||||
else if (next_report_ < 50000)
|
||||
next_report_ += 5000;
|
||||
else if (next_report_ < 100000)
|
||||
next_report_ += 10000;
|
||||
else if (next_report_ < 500000)
|
||||
next_report_ += 50000;
|
||||
else
|
||||
next_report_ += 100000;
|
||||
std::fprintf(stderr, "... finished %d ops%30s\r", done_, "");
|
||||
std::fflush(stderr);
|
||||
if(FLAGS_print_process) {
|
||||
if (done_ >= next_report_) {
|
||||
if (next_report_ < 1000)
|
||||
next_report_ += 100;
|
||||
else if (next_report_ < 5000)
|
||||
next_report_ += 500;
|
||||
else if (next_report_ < 10000)
|
||||
next_report_ += 1000;
|
||||
else if (next_report_ < 50000)
|
||||
next_report_ += 5000;
|
||||
else if (next_report_ < 100000)
|
||||
next_report_ += 10000;
|
||||
else if (next_report_ < 500000)
|
||||
next_report_ += 50000;
|
||||
else
|
||||
next_report_ += 100000;
|
||||
std::fprintf(stderr, "... finished %d ops%30s\r", done_, "");
|
||||
std::fflush(stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,6 +552,9 @@ class Benchmark {
|
||||
|
||||
~Benchmark() {
|
||||
delete db_;
|
||||
if(FLAGS_clean_bench_file){
|
||||
DestroyDB(FLAGS_db, Options());
|
||||
}
|
||||
delete cache_;
|
||||
delete filter_policy_;
|
||||
}
|
||||
@ -1093,6 +1103,12 @@ int main(int argc, char** argv) {
|
||||
} else if (sscanf(argv[i], "--compression=%d%c", &n, &junk) == 1 &&
|
||||
(n == 0 || n == 1)) {
|
||||
FLAGS_compression = n;
|
||||
}else if (sscanf(argv[i], "--print_process=%d%c", &n, &junk) == 1 &&
|
||||
(n == 0 || n == 1)) {
|
||||
FLAGS_print_process = n;
|
||||
}else if (sscanf(argv[i], "--clean_bench_file=%d%c", &n, &junk) == 1 &&
|
||||
(n == 0 || n == 1)) {
|
||||
FLAGS_clean_bench_file = n;
|
||||
} else if (sscanf(argv[i], "--num=%d%c", &n, &junk) == 1) {
|
||||
FLAGS_num = n;
|
||||
} else if (sscanf(argv[i], "--reads=%d%c", &n, &junk) == 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user