db_bench: sanity check on compression ratio

Summary: as requested by mark

Test Plan: make release

Reviewers: sdong, haobo

Reviewed By: haobo

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D19221
main
Lei Jin 11 years ago
parent 403636842a
commit a1b5650a75
  1. 12
      db/db_bench.cc

@ -837,6 +837,15 @@ class Benchmark {
int64_t writes_; int64_t writes_;
int64_t readwrites_; int64_t readwrites_;
int64_t merge_keys_; int64_t merge_keys_;
bool SanityCheck() {
if (FLAGS_compression_ratio > 1) {
fprintf(stderr, "compression_ratio should be between 0 and 1\n");
return false;
}
return true;
}
void PrintHeader() { void PrintHeader() {
PrintEnvironment(); PrintEnvironment();
fprintf(stdout, "Keys: %d bytes each\n", FLAGS_key_size); fprintf(stdout, "Keys: %d bytes each\n", FLAGS_key_size);
@ -1116,6 +1125,9 @@ class Benchmark {
} }
void Run() { void Run() {
if (!SanityCheck()) {
exit(1);
}
PrintHeader(); PrintHeader();
Open(); Open();
const char* benchmarks = FLAGS_benchmarks.c_str(); const char* benchmarks = FLAGS_benchmarks.c_str();

Loading…
Cancel
Save