This commit is contained in:
MoneroOcean 2019-07-29 08:51:59 -07:00
commit a88b15d640
6 changed files with 41 additions and 24 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

@ -84,6 +84,15 @@ static inline void findByType(hwloc_obj_t obj, hwloc_obj_type_t type, func lambd
}
static inline std::vector<hwloc_obj_t> findByType(hwloc_obj_t obj, hwloc_obj_type_t type)
{
std::vector<hwloc_obj_t> out;
findByType(obj, type, [&out](hwloc_obj_t found) { out.emplace_back(found); });
return out;
}
static inline size_t countByType(hwloc_topology_t topology, hwloc_obj_type_t type)
{
const int count = hwloc_get_nbobjs_by_type(topology, type);
@ -132,8 +141,7 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo() : BasicCpuInfo(),
}
# endif
std::vector<hwloc_obj_t> packages;
findByType(hwloc_get_root_obj(m_topology), HWLOC_OBJ_PACKAGE, [&packages](hwloc_obj_t found) { packages.emplace_back(found); });
const std::vector<hwloc_obj_t> packages = findByType(hwloc_get_root_obj(m_topology), HWLOC_OBJ_PACKAGE);
if (packages.size()) {
const char *value = hwloc_obj_get_info_by_name(packages[0], "CPUModel");
if (value) {
@ -249,14 +257,9 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
if (cacheHashes >= PUs) {
for (hwloc_obj_t core : cores) {
if (core->arity == 0) {
continue;
}
for (unsigned i = 0; i < core->arity; ++i) {
if (core->children[i]->type == HWLOC_OBJ_PU) {
threads.push_back(CpuThread(1, core->children[i]->os_index));
}
const std::vector<hwloc_obj_t> units = findByType(core, HWLOC_OBJ_PU);
for (hwloc_obj_t pu : units) {
threads.push_back(CpuThread(1, pu->os_index));
}
}
@ -268,7 +271,8 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
bool allocated_pu = false;
for (hwloc_obj_t core : cores) {
if (core->arity <= pu_id || core->children[pu_id]->type != HWLOC_OBJ_PU) {
const std::vector<hwloc_obj_t> units = findByType(core, HWLOC_OBJ_PU);
if (units.size() <= pu_id) {
continue;
}
@ -276,7 +280,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
PUs--;
allocated_pu = true;
threads.push_back(CpuThread(1, core->children[pu_id]->os_index));
threads.push_back(CpuThread(1, units[pu_id]->os_index));
if (cacheHashes == 0) {
break;

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

View file

@ -121,7 +121,7 @@ namespace randomx {
template<bool softAes>
void VmBase<softAes>::generateProgram(void* seed) {
fillAes4Rx4<softAes>(seed, sizeof(program), &program);
fillAes4Rx4<softAes>(seed, 128 + RandomX_CurrentConfig.ProgramSize * 8, &program);
}
template class VmBase<false>;

View file

@ -28,7 +28,7 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "XMRig CPU miner"
#define APP_VERSION "2.99.2-evo-mo1"
#define APP_VERSION "2.99.3-evo-mo1"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
@ -36,7 +36,7 @@
#define APP_VER_MAJOR 2
#define APP_VER_MINOR 99
#define APP_VER_PATCH 2
#define APP_VER_PATCH 3
#ifdef _MSC_VER
# if (_MSC_VER >= 1920)