Preparation for #1.4.0 (#30)
- Fixed CPU affinity on Windows for NUMA and CPUs with lot of cores - Implemented per thread configurable Multihash mode (double, triple, quadruple, quintuple) - Rebased from XMRig 2.4.4
This commit is contained in:
parent
990bf8d963
commit
cf868666d4
41 changed files with 2575 additions and 1104 deletions
23
src/Mem.h
23
src/Mem.h
|
@ -5,6 +5,8 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
* Copyright 2018 Sebastian Stolzenberg <https://github.com/sebastianstolzenberg>
|
||||
* Copyright 2018 BenDroid <ben@graef.in>
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -25,8 +27,9 @@
|
|||
#define __MEM_H__
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <bitset>
|
||||
|
||||
#include "align.h"
|
||||
#include "Options.h"
|
||||
|
@ -37,6 +40,7 @@ struct cryptonight_ctx;
|
|||
class Mem
|
||||
{
|
||||
public:
|
||||
typedef std::bitset<64> ThreadBitSet;
|
||||
enum Flags {
|
||||
HugepagesAvailable = 1,
|
||||
HugepagesEnabled = 2,
|
||||
|
@ -47,18 +51,23 @@ public:
|
|||
static cryptonight_ctx *create(int threadId);
|
||||
static void release();
|
||||
|
||||
static inline bool isDoubleHash(int threadId) { return m_doubleHash && (m_doubleHashThreadMask == -1L || ((m_doubleHashThreadMask >> threadId) & 1)); }
|
||||
static inline size_t hashFactor() { return m_hashFactor; }
|
||||
static inline size_t getThreadHashFactor(int threadId)
|
||||
{
|
||||
return (m_multiHashThreadMask.all() ||
|
||||
m_multiHashThreadMask.test(threadId)) ? m_hashFactor : 1;
|
||||
}
|
||||
static inline bool isHugepagesAvailable() { return (m_flags & HugepagesAvailable) != 0; }
|
||||
static inline bool isHugepagesEnabled() { return (m_flags & HugepagesEnabled) != 0; }
|
||||
static inline int flags() { return m_flags; }
|
||||
static inline int threads() { return m_threads; }
|
||||
static inline size_t threads() { return m_threads; }
|
||||
|
||||
private:
|
||||
static bool m_doubleHash;
|
||||
static size_t m_hashFactor;
|
||||
static size_t m_threads;
|
||||
static int m_algo;
|
||||
static int m_flags;
|
||||
static int m_threads;
|
||||
static int64_t m_doubleHashThreadMask;
|
||||
static ThreadBitSet m_multiHashThreadMask;
|
||||
static size_t m_memorySize;
|
||||
VAR_ALIGN(16, static uint8_t *m_memory);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue