Added online/offline status to dashboard client Id column
* Added external client IP to dashboard client Id column tooltip * Added client info (cpu, cores, cpu features, current configured threads, current hash mode ..) to client id column tooltip
This commit is contained in:
parent
947910f8e6
commit
dfe56bbc21
9 changed files with 332 additions and 60 deletions
|
@ -43,6 +43,16 @@ ClientStatus::ClientStatus()
|
|||
|
||||
}
|
||||
|
||||
ClientStatus::Status ClientStatus::getCurrentStatus() const
|
||||
{
|
||||
return m_currentStatus;
|
||||
}
|
||||
|
||||
void ClientStatus::setCurrentStatus(Status currentStatus)
|
||||
{
|
||||
m_currentStatus = currentStatus;
|
||||
}
|
||||
|
||||
std::string ClientStatus::getClientId() const
|
||||
{
|
||||
return m_clientId;
|
||||
|
@ -73,14 +83,74 @@ std::string ClientStatus::getCurrentAlgoName() const
|
|||
return m_currentAlgoName;
|
||||
}
|
||||
|
||||
ClientStatus::Status ClientStatus::getCurrentStatus() const
|
||||
std::string ClientStatus::getCpuBrand() const
|
||||
{
|
||||
return m_currentStatus;
|
||||
return m_cpuBrand;
|
||||
}
|
||||
|
||||
void ClientStatus::setCurrentStatus(Status currentStatus)
|
||||
void ClientStatus::setCpuBrand(const std::string& cpuBrand)
|
||||
{
|
||||
m_currentStatus = currentStatus;
|
||||
m_cpuBrand = cpuBrand;
|
||||
}
|
||||
|
||||
std::string ClientStatus::getExternalIp() const
|
||||
{
|
||||
return m_externalIp;
|
||||
}
|
||||
|
||||
void ClientStatus::setExternalIp(const std::string& externalIp)
|
||||
{
|
||||
m_externalIp = externalIp;
|
||||
}
|
||||
|
||||
bool ClientStatus::hasHugepages() const
|
||||
{
|
||||
return m_hasHugepages;
|
||||
}
|
||||
|
||||
void ClientStatus::setHugepages(bool hasHugepages)
|
||||
{
|
||||
m_hasHugepages = hasHugepages;
|
||||
}
|
||||
|
||||
bool ClientStatus::isHugepagesEnabled() const
|
||||
{
|
||||
return m_isHugepagesEnabled;
|
||||
}
|
||||
|
||||
void ClientStatus::setHugepagesEnabled(bool hugepagesEnabled)
|
||||
{
|
||||
m_isHugepagesEnabled = hugepagesEnabled;
|
||||
}
|
||||
|
||||
bool ClientStatus::isDoubleHashMode() const
|
||||
{
|
||||
return m_isDoubleHashMode;
|
||||
}
|
||||
|
||||
void ClientStatus::setDoubleHashMode(bool isDoubleHashMode)
|
||||
{
|
||||
m_isDoubleHashMode = isDoubleHashMode;
|
||||
}
|
||||
|
||||
bool ClientStatus::isCpuX64() const
|
||||
{
|
||||
return m_isCpuX64;
|
||||
}
|
||||
|
||||
void ClientStatus::setCpuX64(bool isCpuX64)
|
||||
{
|
||||
m_isCpuX64 = isCpuX64;
|
||||
}
|
||||
|
||||
bool ClientStatus::hasCpuAES() const
|
||||
{
|
||||
return m_hasCpuAES;
|
||||
}
|
||||
|
||||
void ClientStatus::setCpuAES(bool hasCpuAES)
|
||||
{
|
||||
m_hasCpuAES = hasCpuAES;
|
||||
}
|
||||
|
||||
double ClientStatus::getHashrateShort() const
|
||||
|
@ -113,6 +183,56 @@ void ClientStatus::setHashrateLong(double hashrateLong)
|
|||
m_hashrateLong = hashrateLong;
|
||||
}
|
||||
|
||||
void ClientStatus::setHashrateHighest(double hashrateHighest)
|
||||
{
|
||||
m_hashrateHighest = hashrateHighest;
|
||||
}
|
||||
|
||||
double ClientStatus::getHashrateHighest() const
|
||||
{
|
||||
return m_hashrateHighest;
|
||||
}
|
||||
|
||||
int ClientStatus::getCurrentThreads() const
|
||||
{
|
||||
return m_currentThreads;
|
||||
}
|
||||
|
||||
void ClientStatus::setCurrentThreads(int currentThreads)
|
||||
{
|
||||
m_currentThreads = currentThreads;
|
||||
}
|
||||
|
||||
int ClientStatus::getCpuCores() const
|
||||
{
|
||||
return m_cpuCores;
|
||||
}
|
||||
|
||||
void ClientStatus::setCpuCores(int cpuCores)
|
||||
{
|
||||
m_cpuCores = cpuCores;
|
||||
}
|
||||
|
||||
int ClientStatus::getCpuL2() const
|
||||
{
|
||||
return m_cpuL2;
|
||||
}
|
||||
|
||||
void ClientStatus::setCpuL2(int cpuL2)
|
||||
{
|
||||
m_cpuL2 = cpuL2;
|
||||
}
|
||||
|
||||
int ClientStatus::getCpuL3() const
|
||||
{
|
||||
return m_cpuL3;
|
||||
}
|
||||
|
||||
void ClientStatus::setCpuL3(int cpuL3)
|
||||
{
|
||||
m_cpuL3 = cpuL3;
|
||||
}
|
||||
|
||||
uint64_t ClientStatus::getSharesGood() const
|
||||
{
|
||||
return m_sharesGood;
|
||||
|
@ -142,17 +262,6 @@ void ClientStatus::setHashesTotal(uint64_t hashesTotal)
|
|||
{
|
||||
m_hashesTotal = hashesTotal;
|
||||
}
|
||||
|
||||
void ClientStatus::setHashrateHighest(double hashrateHighest)
|
||||
{
|
||||
m_hashrateHighest = hashrateHighest;
|
||||
}
|
||||
|
||||
double ClientStatus::getHashrateHighest() const
|
||||
{
|
||||
return m_hashrateHighest;
|
||||
}
|
||||
|
||||
void ClientStatus::setAvgTime(uint32_t avgTime)
|
||||
{
|
||||
m_avgTime = avgTime;
|
||||
|
@ -176,6 +285,10 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
|
|||
{
|
||||
rapidjson::Value::ConstObject clientStatus = document["client_status"].GetObject();
|
||||
|
||||
if (clientStatus.HasMember("current_status")) {
|
||||
m_currentStatus = toStatus(clientStatus["current_status"].GetString());
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("client_id")) {
|
||||
m_clientId = clientStatus["client_id"].GetString();
|
||||
}
|
||||
|
@ -184,14 +297,38 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
|
|||
m_currentPool = clientStatus["current_pool"].GetString();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("current_status")) {
|
||||
m_currentStatus = toStatus(clientStatus["current_status"].GetString());
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("current_algo_name")) {
|
||||
m_currentAlgoName = clientStatus["current_algo_name"].GetString();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("cpu_brand")) {
|
||||
m_cpuBrand = clientStatus["cpu_brand"].GetString();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("external_ip")) {
|
||||
m_externalIp = clientStatus["external_ip"].GetString();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("hugepages_available")) {
|
||||
m_hasHugepages = clientStatus["hugepages_available"].GetBool();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("hugepages_enabled")) {
|
||||
m_isHugepagesEnabled = clientStatus["hugepages_enabled"].GetBool();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("double_hash_mode")) {
|
||||
m_isDoubleHashMode = clientStatus["double_hash_mode"].GetBool();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("cpu_is_x64")) {
|
||||
m_isCpuX64 = clientStatus["cpu_is_x64"].GetBool();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("cpu_has_aes")) {
|
||||
m_hasCpuAES = clientStatus["cpu_has_aes"].GetBool();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("hashrate_short")) {
|
||||
m_hashrateShort = clientStatus["hashrate_short"].GetDouble();
|
||||
}
|
||||
|
@ -208,8 +345,20 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
|
|||
m_hashrateHighest = clientStatus["hashrate_highest"].GetDouble();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("avg_time")) {
|
||||
m_avgTime = clientStatus["avg_time"].GetUint();
|
||||
if (clientStatus.HasMember("current_threads")) {
|
||||
m_currentThreads = clientStatus["current_threads"].GetInt();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("cpu_cores")) {
|
||||
m_cpuCores = clientStatus["cpu_cores"].GetInt();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("cpu_l2")) {
|
||||
m_cpuL2 = clientStatus["cpu_l2"].GetInt();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("cpu_l3")) {
|
||||
m_cpuL3 = clientStatus["cpu_l3"].GetInt();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("shares_good")) {
|
||||
|
@ -224,6 +373,10 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
|
|||
m_hashesTotal = clientStatus["hashes_total"].GetUint64();
|
||||
}
|
||||
|
||||
if (clientStatus.HasMember("avg_time")) {
|
||||
m_avgTime = clientStatus["avg_time"].GetUint();
|
||||
}
|
||||
|
||||
auto time_point = std::chrono::system_clock::now();
|
||||
m_lastStatusUpdate = std::chrono::system_clock::to_time_t(time_point);
|
||||
|
||||
|
@ -239,21 +392,36 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
|
|||
{
|
||||
rapidjson::Value clientStatus(rapidjson::kObjectType);
|
||||
|
||||
clientStatus.AddMember("current_status", rapidjson::StringRef(toString(m_currentStatus)), allocator);
|
||||
|
||||
clientStatus.AddMember("client_id", rapidjson::StringRef(m_clientId.c_str()), allocator);
|
||||
clientStatus.AddMember("current_pool", rapidjson::StringRef(m_currentPool.c_str()), allocator);
|
||||
clientStatus.AddMember("current_status", rapidjson::StringRef(toString(m_currentStatus)), allocator);
|
||||
clientStatus.AddMember("current_algo_name", rapidjson::StringRef(m_currentAlgoName.c_str()), allocator);
|
||||
clientStatus.AddMember("cpu_brand", rapidjson::StringRef(m_cpuBrand.c_str()), allocator);
|
||||
clientStatus.AddMember("external_ip", rapidjson::StringRef(m_externalIp.c_str()), allocator);
|
||||
|
||||
clientStatus.AddMember("hugepages_available", m_hasHugepages, allocator);
|
||||
clientStatus.AddMember("hugepages_enabled", m_isHugepagesEnabled, allocator);
|
||||
clientStatus.AddMember("double_hash_mode", m_isDoubleHashMode, allocator);
|
||||
clientStatus.AddMember("cpu_is_x64", m_isCpuX64, allocator);
|
||||
clientStatus.AddMember("cpu_has_aes", m_hasCpuAES, allocator);
|
||||
|
||||
clientStatus.AddMember("hashrate_short", m_hashrateShort, allocator);
|
||||
clientStatus.AddMember("hashrate_medium", m_hashrateMedium, allocator);
|
||||
clientStatus.AddMember("hashrate_long", m_hashrateLong, allocator);
|
||||
clientStatus.AddMember("hashrate_highest", m_hashrateHighest, allocator);
|
||||
clientStatus.AddMember("avg_time", m_avgTime, allocator);
|
||||
|
||||
clientStatus.AddMember("current_threads", m_currentThreads, allocator);
|
||||
clientStatus.AddMember("cpu_cores", m_cpuCores, allocator);
|
||||
clientStatus.AddMember("cpu_l2", m_cpuL2, allocator);
|
||||
clientStatus.AddMember("cpu_l3", m_cpuL3, allocator);
|
||||
|
||||
clientStatus.AddMember("shares_good", m_sharesGood, allocator);
|
||||
clientStatus.AddMember("shares_total", m_sharesTotal, allocator);
|
||||
clientStatus.AddMember("hashes_total", m_hashesTotal, allocator);
|
||||
|
||||
clientStatus.AddMember("avg_time", m_avgTime, allocator);
|
||||
|
||||
clientStatus.AddMember("last_status_update", m_lastStatusUpdate, allocator);
|
||||
|
||||
return clientStatus;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue