Add a function to return current perf level
Summary: Add a function to return the perf level. It is to allow a wrapper of DB to increase the perf level and restore the original perf level after finishing the function call. Test Plan: Add a verification in db_test Reviewers: yhchiang, igor, ljin Reviewed By: ljin Subscribers: xjin, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D19551
This commit is contained in:
parent
30c81e7717
commit
36de0e5359
@ -2355,6 +2355,7 @@ TEST(DBTest, NumImmutableMemTable) {
|
|||||||
std::string big_value(1000000 * 2, 'x');
|
std::string big_value(1000000 * 2, 'x');
|
||||||
std::string num;
|
std::string num;
|
||||||
SetPerfLevel(kEnableTime);;
|
SetPerfLevel(kEnableTime);;
|
||||||
|
ASSERT_TRUE(GetPerfLevel() == kEnableTime);
|
||||||
|
|
||||||
ASSERT_OK(dbfull()->Put(writeOpt, handles_[1], "k1", big_value));
|
ASSERT_OK(dbfull()->Put(writeOpt, handles_[1], "k1", big_value));
|
||||||
ASSERT_TRUE(dbfull()->GetProperty(handles_[1],
|
ASSERT_TRUE(dbfull()->GetProperty(handles_[1],
|
||||||
@ -2417,6 +2418,7 @@ TEST(DBTest, NumImmutableMemTable) {
|
|||||||
// break if we change the default skiplist implementation
|
// break if we change the default skiplist implementation
|
||||||
ASSERT_EQ(num, "200");
|
ASSERT_EQ(num, "200");
|
||||||
SetPerfLevel(kDisable);
|
SetPerfLevel(kDisable);
|
||||||
|
ASSERT_TRUE(GetPerfLevel() == kDisable);
|
||||||
} while (ChangeCompactOptions());
|
} while (ChangeCompactOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@ enum PerfLevel {
|
|||||||
// set the perf stats level
|
// set the perf stats level
|
||||||
void SetPerfLevel(PerfLevel level);
|
void SetPerfLevel(PerfLevel level);
|
||||||
|
|
||||||
|
// get current perf stats level
|
||||||
|
PerfLevel GetPerfLevel();
|
||||||
|
|
||||||
// A thread local context for gathering performance counter efficiently
|
// A thread local context for gathering performance counter efficiently
|
||||||
// and transparently.
|
// and transparently.
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@ void SetPerfLevel(PerfLevel level) {
|
|||||||
perf_level = level;
|
perf_level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PerfLevel GetPerfLevel() {
|
||||||
|
return perf_level;
|
||||||
|
}
|
||||||
|
|
||||||
void PerfContext::Reset() {
|
void PerfContext::Reset() {
|
||||||
#if !defined(NPERF_CONTEXT) && !defined(IOS_CROSS_COMPILE)
|
#if !defined(NPERF_CONTEXT) && !defined(IOS_CROSS_COMPILE)
|
||||||
user_key_comparison_count = 0;
|
user_key_comparison_count = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user