diff options
author | Sanjay Ghemawat <sanjay@google.com> | 2014-12-11 08:08:57 -0800 |
---|---|---|
committer | Chris Mumford <cmumford@chromium.org> | 2014-12-11 08:08:57 -0800 |
commit | 77948e7eec0613fb5cbecb7e320b9498607030b5 (patch) | |
tree | 53341f0c9918711514a90f86f028bab9de3c4ed7 | |
parent | 34ad72e3e964131475c714cb2f41492d053a6b2e (diff) | |
download | leveldb-77948e7eec0613fb5cbecb7e320b9498607030b5.tar.gz |
Add benchmark that measures cost of repeatedly opening the database.
-rw-r--r-- | db/db_bench.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/db/db_bench.cc b/db/db_bench.cc index 705a170..e5975bd 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -33,6 +33,7 @@ // readmissing -- read N missing keys in random order // readhot -- read N times in random order from 1% section of DB // seekrandom -- N random seeks +// open -- cost of opening a DB // crc32c -- repeated crc32c of 4K of data // acquireload -- load N*1000 times // Meta operations: @@ -442,7 +443,11 @@ class Benchmark { bool fresh_db = false; int num_threads = FLAGS_threads; - if (name == Slice("fillseq")) { + if (name == Slice("open")) { + method = &Benchmark::OpenBench; + num_ /= 10000; + if (num_ < 1) num_ = 1; + } else if (name == Slice("fillseq")) { fresh_db = true; method = &Benchmark::WriteSeq; } else if (name == Slice("fillbatch")) { @@ -702,6 +707,14 @@ class Benchmark { } } + void OpenBench(ThreadState* thread) { + for (int i = 0; i < num_; i++) { + delete db_; + Open(); + thread->stats.FinishedSingleOp(); + } + } + void WriteSeq(ThreadState* thread) { DoWrite(thread, true); } |