Fix hugepage status in popup

This commit is contained in:
Ben Gräf 2018-07-18 21:58:00 +02:00
parent 1b69dfc0e5
commit c04f773222
3 changed files with 21 additions and 6 deletions

View file

@ -426,10 +426,6 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
m_isHugepagesEnabled = clientStatus["hugepages_enabled"].GetBool();
}
if (clientStatus.HasMember("hash_factor")) {
m_hashFactor = clientStatus["hash_factor"].GetInt();
}
if (clientStatus.HasMember("cpu_is_x64")) {
m_isCpuX64 = clientStatus["cpu_is_x64"].GetBool();
}
@ -454,6 +450,18 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
m_hashrateHighest = clientStatus["hashrate_highest"].GetDouble();
}
if (clientStatus.HasMember("hash_factor")) {
m_hashFactor = clientStatus["hash_factor"].GetInt();
}
if (clientStatus.HasMember("total_pages")) {
m_totalPages = clientStatus["total_pages"].GetInt();
}
if (clientStatus.HasMember("total_hugepages")) {
m_totalHugepages = clientStatus["total_hugepages"].GetInt();
}
if (clientStatus.HasMember("current_threads")) {
m_currentThreads = clientStatus["current_threads"].GetInt();
}
@ -525,7 +533,6 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
clientStatus.AddMember("hugepages_available", m_hasHugepages, allocator);
clientStatus.AddMember("hugepages_enabled", m_isHugepagesEnabled, allocator);
clientStatus.AddMember("hash_factor", m_hashFactor, allocator);
clientStatus.AddMember("cpu_is_x64", m_isCpuX64, allocator);
clientStatus.AddMember("cpu_has_aes", m_hasCpuAES, allocator);
@ -534,6 +541,9 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
clientStatus.AddMember("hashrate_long", m_hashrateLong, allocator);
clientStatus.AddMember("hashrate_highest", m_hashrateHighest, allocator);
clientStatus.AddMember("hash_factor", m_hashFactor, allocator);
clientStatus.AddMember("total_pages", m_totalPages, allocator);
clientStatus.AddMember("total_hugepages", m_totalHugepages, allocator);
clientStatus.AddMember("current_threads", m_currentThreads, allocator);
clientStatus.AddMember("cpu_sockets", m_cpuSockets, allocator);
clientStatus.AddMember("cpu_cores", m_cpuCores, allocator);

View file

@ -228,6 +228,10 @@ unsigned Service::setClientStatus(const std::string& clientIp, const std::string
clientStatus.parseFromJson(document);
clientStatus.setExternalIp(clientIp);
if (m_clientStatus.find(clientId) == m_clientStatus.end()) {
m_clientCommand[clientId] = ControlCommand(ControlCommand::RESTART);
}
m_clientStatus[clientId] = clientStatus;
resultCode = getClientCommand(clientId, resp);