Browse Source

Add benchmark that measures cost of repeatedly opening the database.

main
Sanjay Ghemawat 10 years ago
committed by Chris Mumford
parent
commit
77948e7eec
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      db/db_bench.cc

+ 14
- 1
db/db_bench.cc View File

@ -33,6 +33,7 @@
// readmissing -- read N missing keys in random order // readmissing -- read N missing keys in random order
// readhot -- read N times in random order from 1% section of DB // readhot -- read N times in random order from 1% section of DB
// seekrandom -- N random seeks // seekrandom -- N random seeks
// open -- cost of opening a DB
// crc32c -- repeated crc32c of 4K of data // crc32c -- repeated crc32c of 4K of data
// acquireload -- load N*1000 times // acquireload -- load N*1000 times
// Meta operations: // Meta operations:
@ -442,7 +443,11 @@ class Benchmark {
bool fresh_db = false; bool fresh_db = false;
int num_threads = FLAGS_threads; 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; fresh_db = true;
method = &Benchmark::WriteSeq; method = &Benchmark::WriteSeq;
} else if (name == Slice("fillbatch")) { } 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) { void WriteSeq(ThreadState* thread) {
DoWrite(thread, true); DoWrite(thread, true);
} }

Loading…
Cancel
Save