Procházet zdrojové kódy

Merge pull request #1036 from chjj:benchmark-compression

PiperOrigin-RevId: 461612590
main
Victor Costan před 2 roky
rodič
revize
0a9b7b8e95
1 změnil soubory, kde provedl 8 přidání a 0 odebrání
  1. +8
    -0
      benchmarks/db_bench.cc

+ 8
- 0
benchmarks/db_bench.cc Zobrazit soubor

@ -118,6 +118,9 @@ static bool FLAGS_use_existing_db = false;
// If true, reuse existing log/MANIFEST files when re-opening a database. // If true, reuse existing log/MANIFEST files when re-opening a database.
static bool FLAGS_reuse_logs = false; static bool FLAGS_reuse_logs = false;
// If true, use compression.
static bool FLAGS_compression = true;
// Use the db with the following name. // Use the db with the following name.
static const char* FLAGS_db = nullptr; static const char* FLAGS_db = nullptr;
@ -771,6 +774,8 @@ class Benchmark {
options.max_open_files = FLAGS_open_files; options.max_open_files = FLAGS_open_files;
options.filter_policy = filter_policy_; options.filter_policy = filter_policy_;
options.reuse_logs = FLAGS_reuse_logs; options.reuse_logs = FLAGS_reuse_logs;
options.compression =
FLAGS_compression ? kSnappyCompression : kNoCompression;
Status s = DB::Open(options, FLAGS_db, &db_); Status s = DB::Open(options, FLAGS_db, &db_);
if (!s.ok()) { if (!s.ok()) {
std::fprintf(stderr, "open error: %s\n", s.ToString().c_str()); std::fprintf(stderr, "open error: %s\n", s.ToString().c_str());
@ -1045,6 +1050,9 @@ int main(int argc, char** argv) {
} else if (sscanf(argv[i], "--reuse_logs=%d%c", &n, &junk) == 1 && } else if (sscanf(argv[i], "--reuse_logs=%d%c", &n, &junk) == 1 &&
(n == 0 || n == 1)) { (n == 0 || n == 1)) {
FLAGS_reuse_logs = n; FLAGS_reuse_logs = n;
} else if (sscanf(argv[i], "--compression=%d%c", &n, &junk) == 1 &&
(n == 0 || n == 1)) {
FLAGS_compression = n;
} else if (sscanf(argv[i], "--num=%d%c", &n, &junk) == 1) { } else if (sscanf(argv[i], "--num=%d%c", &n, &junk) == 1) {
FLAGS_num = n; FLAGS_num = n;
} else if (sscanf(argv[i], "--reads=%d%c", &n, &junk) == 1) { } else if (sscanf(argv[i], "--reads=%d%c", &n, &junk) == 1) {

Načítá se…
Zrušit
Uložit