@ -25,16 +25,6 @@ int FLAGS_min_write_buffer_number_to_merge = 7;
// Path to the database on file system
// Path to the database on file system
const std : : string kDbName = rocksdb : : test : : TmpDir ( ) + " /perf_context_test " ;
const std : : string kDbName = rocksdb : : test : : TmpDir ( ) + " /perf_context_test " ;
void SeekToFirst ( rocksdb : : Iterator * iter ) {
// std::cout << "Press a key to continue:";
// std::string s;
// std::cin >> s;
iter - > SeekToFirst ( ) ;
// std::cout << "Press a key to continue:";
// std::string s2;
// std::cin >> s2;
}
namespace rocksdb {
namespace rocksdb {
std : : shared_ptr < DB > OpenDb ( ) {
std : : shared_ptr < DB > OpenDb ( ) {
@ -100,10 +90,7 @@ TEST(PerfContextTest, SeekIntoDeletion) {
perf_context . Reset ( ) ;
perf_context . Reset ( ) ;
StopWatchNano timer ( Env : : Default ( ) , true ) ;
StopWatchNano timer ( Env : : Default ( ) , true ) ;
//CALLGRIND_ZERO_STATS;
iter - > SeekToFirst ( ) ;
SeekToFirst ( iter . get ( ) ) ;
//iter->SeekToFirst();
//CALLGRIND_DUMP_STATS;
hist_seek_to_first . Add ( perf_context . user_key_comparison_count ) ;
hist_seek_to_first . Add ( perf_context . user_key_comparison_count ) ;
auto elapsed_nanos = timer . ElapsedNanos ( ) ;
auto elapsed_nanos = timer . ElapsedNanos ( ) ;
@ -257,13 +244,29 @@ TEST(PerfContextTest, SeekKeyComparison) {
std : : random_shuffle ( keys . begin ( ) , keys . end ( ) ) ;
std : : random_shuffle ( keys . begin ( ) , keys . end ( ) ) ;
}
}
HistogramImpl hist_put_time ;
HistogramImpl hist_wal_time ;
HistogramImpl hist_time_diff ;
SetPerfLevel ( kEnableTime ) ;
StopWatchNano timer ( Env : : Default ( ) ) ;
for ( const int i : keys ) {
for ( const int i : keys ) {
std : : string key = " k " + std : : to_string ( i ) ;
std : : string key = " k " + std : : to_string ( i ) ;
std : : string value = " v " + std : : to_string ( i ) ;
std : : string value = " v " + std : : to_string ( i ) ;
perf_context . Reset ( ) ;
timer . Start ( ) ;
db - > Put ( write_options , key , value ) ;
db - > Put ( write_options , key , value ) ;
auto put_time = timer . ElapsedNanos ( ) ;
hist_put_time . Add ( put_time ) ;
hist_wal_time . Add ( perf_context . wal_write_time ) ;
hist_time_diff . Add ( put_time - perf_context . wal_write_time ) ;
}
}
std : : cout < < " Put time: \n " < < hist_put_time . ToString ( )
< < " WAL time: \n " < < hist_wal_time . ToString ( )
< < " time diff: \n " < < hist_time_diff . ToString ( ) ;
HistogramImpl hist_seek ;
HistogramImpl hist_seek ;
HistogramImpl hist_next ;
HistogramImpl hist_next ;