From 7ecc5d4ad5bd027e89725d78293b62772dad1eec Mon Sep 17 00:00:00 2001 From: Dhruba Borthakur Date: Thu, 13 Sep 2012 09:23:18 -0700 Subject: [PATCH] Enable db_bench to specify block size. Summary: Enable db_bench to specify block size. Test Plan: compile and run Reviewers: heyongqiang Reviewed By: heyongqiang Differential Revision: https://reviews.facebook.net/D5373 --- db/db_bench.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/db_bench.cc b/db/db_bench.cc index b99cac32f..7ae2747f3 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -91,6 +91,9 @@ static int FLAGS_write_buffer_size = 0; // Negative means use default settings. static long FLAGS_cache_size = -1; +// Number of bytes in a block. +static int FLAGS_block_size = 0; + // Maximum number of files to keep open at the same time (use default if == 0) static int FLAGS_open_files = 0; @@ -783,6 +786,7 @@ class Benchmark { options.create_if_missing = !FLAGS_use_existing_db; options.block_cache = cache_; options.write_buffer_size = FLAGS_write_buffer_size; + options.block_size = FLAGS_block_size; options.filter_policy = filter_policy_; options.max_open_files = FLAGS_open_files; options.statistics = dbstats; @@ -1108,6 +1112,8 @@ int main(int argc, char** argv) { FLAGS_write_buffer_size = n; } else if (sscanf(argv[i], "--cache_size=%lld%c", &nn, &junk) == 1) { FLAGS_cache_size = nn; + } else if (sscanf(argv[i], "--block_size=%d%c", &n, &junk) == 1) { + FLAGS_block_size = n; } else if (sscanf(argv[i], "--cache_numshardbits=%d%c", &n, &junk) == 1) { if (n < 20) { FLAGS_cache_numshardbits = n; -- GitLab