fork of https://github.com/oxigraph/rocksdb and https://github.com/facebook/rocksdb for nextgraph and oxigraph
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
677 B
33 lines
677 B
#ifndef PERF_CONTEXT_IMP_H
|
|
#define PERF_CONTEXT_IMP_H
|
|
|
|
#include "rocksdb/perf_context.h"
|
|
#include "util/stop_watch.h"
|
|
|
|
namespace leveldb {
|
|
|
|
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
|
|
|