@ -46,9 +46,10 @@ DEFINE_string(benchmarks,
" fillrandom, "
" overwrite, "
" readrandom, "
" readrandom, "
" newiterator, "
" newiteratorwhilewriting, "
" seekrandom, "
" seekrandomwhilewriting, "
" readseq, "
" readreverse, "
" compact, "
@ -104,6 +105,7 @@ DEFINE_string(benchmarks,
" operations. Must be used with merge_operator \n "
" \t newiterator -- repeated iterator creation \n "
" \t seekrandom -- N random seeks \n "
" \t seekrandom -- 1 writer, N threads doing random seeks \n "
" \t crc32c -- repeated crc32c of 4K of data \n "
" \t acquireload -- load N*1000 times \n "
" Meta operations: \n "
@ -1179,6 +1181,9 @@ class Benchmark {
method = & Benchmark : : IteratorCreationWhileWriting ;
} else if ( name = = Slice ( " seekrandom " ) ) {
method = & Benchmark : : SeekRandom ;
} else if ( name = = Slice ( " seekrandomwhilewriting " ) ) {
num_threads + + ; // Add extra thread for writing
method = & Benchmark : : SeekRandomWhileWriting ;
} else if ( name = = Slice ( " readrandomsmall " ) ) {
reads_ / = 1000 ;
method = & Benchmark : : ReadRandom ;
@ -1890,6 +1895,7 @@ class Benchmark {
int64_t found = 0 ;
ReadOptions options ( FLAGS_verify_checksum , true ) ;
options . tailing = FLAGS_use_tailing_iterator ;
options . prefix_seek = ( FLAGS_prefix_size > 0 ) ;
auto * iter = db_ - > NewIterator ( options ) ;
Slice key = AllocateKey ( ) ;
std : : unique_ptr < const char [ ] > key_guard ( key . data ( ) ) ;
@ -1912,6 +1918,14 @@ class Benchmark {
thread - > stats . AddMessage ( msg ) ;
}
void SeekRandomWhileWriting ( ThreadState * thread ) {
if ( thread - > tid > 0 ) {
SeekRandom ( thread ) ;
} else {
BGWriter ( thread ) ;
}
}
void DoDelete ( ThreadState * thread , bool seq ) {
WriteBatch batch ;
Duration duration ( seq ? 0 : FLAGS_duration , num_ ) ;