From 0ae1e5f1d41e71bd4d277b95b1284539cf06603e Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 29 Jul 2019 15:06:46 +0700 Subject: [PATCH] Sync changes. --- src/api/Api.cpp | 14 ++++++++------ src/api/Api.h | 2 +- src/crypto/common/Algorithm.cpp | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/api/Api.cpp b/src/api/Api.cpp index 9151aa7ef..4c8e73230 100644 --- a/src/api/Api.cpp +++ b/src/api/Api.cpp @@ -40,7 +40,6 @@ #include "base/tools/Chrono.h" #include "core/config/Config.h" #include "core/Controller.h" -#include "crypto/common/Algorithm.h" #include "crypto/common/keccak.h" #include "version.h" @@ -54,8 +53,8 @@ xmrig::Api::Api(Base *base) : m_base(base), m_id(), m_workerId(), - m_httpd(nullptr), - m_timestamp(Chrono::steadyMSecs()) + m_timestamp(Chrono::currentMSecsSinceEpoch()), + m_httpd(nullptr) { base->addListener(this); @@ -120,7 +119,7 @@ void xmrig::Api::exec(IApiRequest &request) request.accept(); request.reply().AddMember("id", StringRef(m_id), allocator); request.reply().AddMember("worker_id", StringRef(m_workerId), allocator); - request.reply().AddMember("uptime", (Chrono::steadyMSecs() - m_timestamp) / 1000, allocator); + request.reply().AddMember("uptime", (Chrono::currentMSecsSinceEpoch() - m_timestamp) / 1000, allocator); Value features(kArrayType); # ifdef XMRIG_FEATURE_API @@ -135,6 +134,9 @@ void xmrig::Api::exec(IApiRequest &request) # ifdef XMRIG_FEATURE_LIBCPUID features.PushBack("cpuid", allocator); # endif +# ifdef XMRIG_FEATURE_HWLOC + features.PushBack("hwloc", allocator); +# endif # ifdef XMRIG_FEATURE_TLS features.PushBack("tls", allocator); # endif @@ -181,8 +183,8 @@ void xmrig::Api::genId(const String &id) memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize); memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, strlen(APP_KIND)); - xmrig::keccak(input, inSize, hash); - xmrig::Buffer::toHex(hash, 8, m_id); + keccak(input, inSize, hash); + Buffer::toHex(hash, 8, m_id); delete [] input; break; diff --git a/src/api/Api.h b/src/api/Api.h index f2ed39269..334609c95 100644 --- a/src/api/Api.h +++ b/src/api/Api.h @@ -69,9 +69,9 @@ private: Base *m_base; char m_id[32]; char m_workerId[128]; + const uint64_t m_timestamp; Httpd *m_httpd; std::vector m_listeners; - uint64_t m_timestamp; }; diff --git a/src/crypto/common/Algorithm.cpp b/src/crypto/common/Algorithm.cpp index 2c259d321..c7990052a 100644 --- a/src/crypto/common/Algorithm.cpp +++ b/src/crypto/common/Algorithm.cpp @@ -32,7 +32,6 @@ #include "crypto/cn/CnAlgo.h" #include "crypto/common/Algorithm.h" -#include "crypto/rx/RxAlgo.h" #include "rapidjson/document.h" @@ -140,7 +139,19 @@ size_t xmrig::Algorithm::memory() const # ifdef XMRIG_ALGO_RANDOMX if (f == RANDOM_X) { - return RxAlgo::l3(m_id); + constexpr size_t oneMiB = 0x100000; + + switch (m_id) { + case RX_0: + case RX_LOKI: + return oneMiB * 2; + + case RX_WOW: + return oneMiB; + + default: + break; + } } # endif