Performance add exist

This commit is contained in:
KongDong 2024-09-07 09:20:10 +08:00
parent 985934d58e
commit 3992e59b8d
2 changed files with 14 additions and 0 deletions

View File

@ -72,6 +72,17 @@ Performance::Performance() {
Performance::~Performance() {}
bool Performance::exist(const string& key) {
bool ret = false;
for (const auto& item : ms_keys) {
if (item == key) {
ret = true;
break;
}
}
return ret;
}
Performance& Performance::operator=(const Performance& other) {
HKU_IF_RETURN(this == &other, *this);
m_result = other.m_result;

View File

@ -29,6 +29,9 @@ public:
Performance& operator=(const Performance& other);
Performance& operator=(Performance&& other);
/** 是否为合法的统计项 */
static bool exist(const string& key);
/** 复位,清除已计算的结果 */
void reset();