同步黄区代码

Signed-off-by: frank-huangran <frank.huangran@huawei.com>
This commit is contained in:
frank-huangran 2024-11-18 15:47:05 +08:00
parent 06c2ffaa86
commit 06e31708d0
3 changed files with 17 additions and 10 deletions

View File

@ -49,20 +49,25 @@ std::map<std::string, std::string> Temperature::ItemData()
std::string temp;
SPUtils::LoadFile(dirType, type);
SPUtils::LoadFile(dirTemp, temp);
for (auto node : collectNodes) {
if (type.find(node) != std::string::npos) {
float t = SPUtilesTye::StringToSometype<float>(temp);
if (node == "gpu") {
result[type] = std::to_string(t);
} else {
result[type] = std::to_string(t / 1e3);
}
}
}
GetTempInfos(result, type, temp);
}
LOGD("Temperature::ItemData map size(%u)", result.size());
return result;
}
void Temperature::GetTempInfos(std::map<std::string, std::string> &result, std::string type, std::string temp)
{
for (auto node : collectNodes) {
if (type.find(node) != std::string::npos) {
float t = SPUtilesTye::StringToSometype<float>(temp);
if (node == "gpu") {
result[type] = std::to_string(t);
} else {
result[type] = std::to_string(t / 1e3);
}
}
}
}
}
}

View File

@ -54,6 +54,7 @@ void Heartbeat::HeartbeatRule()
auto end = std::chrono::steady_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::seconds>(end - updateStart).count();
if (duration > timeout) {
LOGI("Socket disconnected!")
KillSpId();
}
sleep(checkMessageTime);

View File

@ -31,6 +31,7 @@ public:
static Temperature instance;
return instance;
}
void GetTempInfos(std::map<std::string, std::string> &result, std::string type, std::string temp);
private:
Temperature() {};