[RocksDB] make SetPerfLevel affect only the current thread

Summary: as title, make it easy to turn on/off profiling at per thread level.

Test Plan: make check

Reviewers: sdong, ljin

Reviewed By: ljin

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17469
main
Haobo Xu 11 years ago
parent f76e4027ca
commit 2fa5d41ba3
  1. 2
      util/perf_context.cc
  2. 2
      util/perf_context_imp.h

@ -10,7 +10,7 @@
namespace rocksdb { namespace rocksdb {
// by default, enable counts only // by default, enable counts only
PerfLevel perf_level = kEnableCount; __thread PerfLevel perf_level = kEnableCount;
void SetPerfLevel(PerfLevel level) { perf_level = level; } void SetPerfLevel(PerfLevel level) { perf_level = level; }

@ -9,7 +9,7 @@
namespace rocksdb { namespace rocksdb {
extern enum PerfLevel perf_level; extern __thread PerfLevel perf_level;
inline void StartPerfTimer(StopWatchNano* timer) { inline void StartPerfTimer(StopWatchNano* timer) {
if (perf_level >= PerfLevel::kEnableTime) { if (perf_level >= PerfLevel::kEnableTime) {

Loading…
Cancel
Save