diff --git a/db/db_impl.cc b/db/db_impl.cc index 36afa1c..6b28260 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1235,17 +1235,17 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* updates) { w.sync = options.sync; w.done = false; - uint64_t start_ = env_->NowMicros(); + // uint64_t start_ = env_->NowMicros(); MutexLock l(&mutex_); - count ++; + // count ++; writers_.push_back(&w); while (!w.done && &w != writers_.front()) { w.cv.Wait(); } if (w.done) { - Waiting_elapsed += env_->NowMicros() - start_; - waited_count ++; - Total_elapsed += env_->NowMicros() - start_; + // Waiting_elapsed += env_->NowMicros() - start_; + // waited_count ++; + // Total_elapsed += env_->NowMicros() - start_; // dumpStatistics(); return w.status; } @@ -1265,7 +1265,7 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* updates) { // into mem_. { mutex_.Unlock(); - uint64_t start_write = env_->NowMicros(); + // uint64_t start_write = env_->NowMicros(); status = log_->AddRecord(WriteBatchInternal::Contents(write_batch)); bool sync_error = false; if (status.ok() && options.sync) { @@ -1277,8 +1277,8 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* updates) { if (status.ok()) { status = WriteBatchInternal::InsertInto(write_batch, mem_); } - BatchSize += write_batch->ApproximateSize(); - write_elapsed += env_->NowMicros() - start_write; + // BatchSize += write_batch->ApproximateSize(); + // write_elapsed += env_->NowMicros() - start_write; mutex_.Lock(); if (sync_error) { // The state of the log file is indeterminate: the log record we @@ -1307,9 +1307,9 @@ Status DBImpl::Write(const WriteOptions& options, WriteBatch* updates) { if (!writers_.empty()) { writers_.front()->cv.Signal(); } - Total_elapsed += env_->NowMicros() - start_; - NoWaiting_elapsed += env_->NowMicros() - start_; - Nowaited_count ++; + // Total_elapsed += env_->NowMicros() - start_; + // NoWaiting_elapsed += env_->NowMicros() - start_; + // Nowaited_count ++; // dumpStatistics(); return status; } diff --git a/db/db_impl.h b/db/db_impl.h index 0d77e55..241125e 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -214,32 +214,32 @@ class DBImpl : public DB { CompactionStats stats_[config::kNumLevels] GUARDED_BY(mutex_); - int count = 0; - int waited_count = 0; - int Nowaited_count = 0; - uint64_t Total_elapsed = 0; - uint64_t Waiting_elapsed = 0; - uint64_t NoWaiting_elapsed = 0; - uint64_t write_elapsed = 0; - uint64_t BatchSize = 0; - const double MB = 1024 * 1024; - const double KB = 1024; - inline void dumpStatistics() { - if(count && count % 500000 == 0) { - printf("==================================\n"); - printf("Count: Total:%d Waited:%d Nowaited:%d\n",count,waited_count,Nowaited_count); - printf("%ld %ld %ld\n",Total_elapsed,Waiting_elapsed,NoWaiting_elapsed); - printf("Average Total elapsed: %lf ms\n",Total_elapsed * 1.0 / count); - printf("Average Waiting elapsed: %lf ms\n",Waiting_elapsed * 1.0 / count); - printf("For waiting request: %lf ms\n",Waiting_elapsed * 1.0 / waited_count); - printf("For Nowait request: %lf ms\n",NoWaiting_elapsed * 1.0 / Nowaited_count); - printf("Write elapsed: %lf ms\n",write_elapsed * 1.0 / Nowaited_count); - printf("Average BatchSize: %lfKB\n",BatchSize / KB / count); - printf("Average BatchSize per write:%lfKB\n",BatchSize / KB / Nowaited_count); - printf("==================================\n"); - std::fflush(stdout); - } - } + // int count = 0; + // int waited_count = 0; + // int Nowaited_count = 0; + // uint64_t Total_elapsed = 0; + // uint64_t Waiting_elapsed = 0; + // uint64_t NoWaiting_elapsed = 0; + // uint64_t write_elapsed = 0; + // uint64_t BatchSize = 0; + // const double MB = 1024 * 1024; + // const double KB = 1024; + // inline void dumpStatistics() { + // if(count && count % 500000 == 0) { + // printf("==================================\n"); + // printf("Count: Total:%d Waited:%d Nowaited:%d\n",count,waited_count,Nowaited_count); + // printf("%ld %ld %ld\n",Total_elapsed,Waiting_elapsed,NoWaiting_elapsed); + // printf("Average Total elapsed: %lf ms\n",Total_elapsed * 1.0 / count); + // printf("Average Waiting elapsed: %lf ms\n",Waiting_elapsed * 1.0 / count); + // printf("For waiting request: %lf ms\n",Waiting_elapsed * 1.0 / waited_count); + // printf("For Nowait request: %lf ms\n",NoWaiting_elapsed * 1.0 / Nowaited_count); + // printf("Write elapsed: %lf ms\n",write_elapsed * 1.0 / Nowaited_count); + // printf("Average BatchSize: %lfKB\n",BatchSize / KB / count); + // printf("Average BatchSize per write:%lfKB\n",BatchSize / KB / Nowaited_count); + // printf("==================================\n"); + // std::fflush(stdout); + // } + // } }; // Sanitize db options. The caller should delete result.info_log if