Sync changes.

This commit is contained in:
XMRig 2019-07-29 15:06:46 +07:00
parent c13c62bf48
commit 0ae1e5f1d4
3 changed files with 22 additions and 9 deletions

View file

@ -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;

View file

@ -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<IApiListener *> m_listeners;
uint64_t m_timestamp;
};

View file

@ -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