Added config option "cpu/max-threads-hint" and command line option "--cpu-max-threads-hint".

This commit is contained in:
XMRig 2019-09-28 02:02:20 +07:00
parent daed23422e
commit 7c463849cc
14 changed files with 97 additions and 57 deletions

View file

@ -27,10 +27,11 @@
#include "backend/cpu/platform/BasicCpuInfo.h"
#include "base/tools/Object.h"
typedef struct hwloc_obj *hwloc_obj_t;
typedef struct hwloc_topology *hwloc_topology_t;
using hwloc_obj_t = struct hwloc_obj *;
using hwloc_topology_t = struct hwloc_topology *;
namespace xmrig {
@ -39,6 +40,9 @@ namespace xmrig {
class HwlocCpuInfo : public BasicCpuInfo
{
public:
XMRIG_DISABLE_COPY_MOVE(HwlocCpuInfo)
enum Feature : uint32_t {
SET_THISTHREAD_MEMBIND = 1
};
@ -51,7 +55,7 @@ public:
static inline const std::vector<uint32_t> &nodeIndexes() { return m_nodeIndexes; }
protected:
CpuThreads threads(const Algorithm &algorithm) const override;
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
inline const char *backend() const override { return m_backend; }
inline size_t cores() const override { return m_cores; }
@ -61,17 +65,17 @@ protected:
inline size_t packages() const override { return m_packages; }
private:
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads) const;
void processTopLevelCache(hwloc_obj_t obj, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const;
static std::vector<uint32_t> m_nodeIndexes;
static uint32_t m_features;
char m_backend[20];
hwloc_topology_t m_topology;
size_t m_cache[5];
size_t m_cores = 0;
size_t m_nodes = 0;
size_t m_packages = 0;
char m_backend[20] = { 0 };
hwloc_topology_t m_topology = nullptr;
size_t m_cache[5] = { 0 };
size_t m_cores = 0;
size_t m_nodes = 0;
size_t m_packages = 0;
};