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
This commit is contained in:
Dhruba Borthakur 2012-09-13 09:23:18 -07:00
parent 407727b75f
commit 7ecc5d4ad5

View File

@ -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;