|
@ -6,7 +6,10 @@ |
|
|
#define STORAGE_LEVELDB_DB_DB_IMPL_H_ |
|
|
#define STORAGE_LEVELDB_DB_DB_IMPL_H_ |
|
|
|
|
|
|
|
|
#include <atomic> |
|
|
#include <atomic> |
|
|
|
|
|
#include <cstdint> |
|
|
|
|
|
#include <cstdio> |
|
|
#include <deque> |
|
|
#include <deque> |
|
|
|
|
|
#include <ostream> |
|
|
#include <set> |
|
|
#include <set> |
|
|
#include <string> |
|
|
#include <string> |
|
|
|
|
|
|
|
@ -210,6 +213,33 @@ class DBImpl : public DB { |
|
|
Status bg_error_ GUARDED_BY(mutex_); |
|
|
Status bg_error_ GUARDED_BY(mutex_); |
|
|
|
|
|
|
|
|
CompactionStats stats_[config::kNumLevels] GUARDED_BY(mutex_); |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// Sanitize db options. The caller should delete result.info_log if |
|
|
// Sanitize db options. The caller should delete result.info_log if |
|
|