a143ef9b38
Summary: Change namespace from leveldb to rocksdb. This allows a single application to link in open-source leveldb code as well as rocksdb code into the same process. Test Plan: compile rocksdb Reviewers: emayanke Reviewed By: emayanke CC: leveldb Differential Revision: https://reviews.facebook.net/D13287
34 lines
677 B
C++
34 lines
677 B
C++
#ifndef PERF_CONTEXT_IMP_H
|
|
#define PERF_CONTEXT_IMP_H
|
|
|
|
#include "rocksdb/perf_context.h"
|
|
#include "util/stop_watch.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
extern enum PerfLevel perf_level;
|
|
|
|
inline void StartPerfTimer(StopWatchNano* timer) {
|
|
if (perf_level >= PerfLevel::kEnableTime) {
|
|
timer->Start();
|
|
}
|
|
}
|
|
|
|
inline void BumpPerfCount(uint64_t* count, uint64_t delta = 1) {
|
|
if (perf_level >= PerfLevel::kEnableCount) {
|
|
*count += delta;
|
|
}
|
|
}
|
|
|
|
inline void BumpPerfTime(uint64_t* time,
|
|
StopWatchNano* timer,
|
|
bool reset = true) {
|
|
if (perf_level >= PerfLevel::kEnableTime) {
|
|
*time += timer->ElapsedNanos(reset);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|