Skip to content

Commit

Permalink
[RocksDB] make SetPerfLevel affect only the current thread
Browse files Browse the repository at this point in the history
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
  • Loading branch information
haoboxu committed Apr 3, 2014
1 parent f76e402 commit 2fa5d41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion util/perf_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace rocksdb {

// by default, enable counts only
PerfLevel perf_level = kEnableCount;
__thread PerfLevel perf_level = kEnableCount;

void SetPerfLevel(PerfLevel level) { perf_level = level; }

Expand Down
2 changes: 1 addition & 1 deletion util/perf_context_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace rocksdb {

extern enum PerfLevel perf_level;
extern __thread PerfLevel perf_level;

inline void StartPerfTimer(StopWatchNano* timer) {
if (perf_level >= PerfLevel::kEnableTime) {
Expand Down

0 comments on commit 2fa5d41

Please sign in to comment.