WIP hugepages in clientinfo popup
This commit is contained in:
parent
566a9f57ec
commit
1b69dfc0e5
7 changed files with 82 additions and 13 deletions
|
@ -30,6 +30,8 @@
|
||||||
bool Mem::m_useHugePages = true;
|
bool Mem::m_useHugePages = true;
|
||||||
size_t Mem::m_hashFactor = 1;
|
size_t Mem::m_hashFactor = 1;
|
||||||
int Mem::m_flags = 0;
|
int Mem::m_flags = 0;
|
||||||
|
int Mem::m_totalPages = 0;
|
||||||
|
int Mem::m_totalHugepages = 0;
|
||||||
Options::Algo Mem::m_algo = Options::ALGO_CRYPTONIGHT;
|
Options::Algo Mem::m_algo = Options::ALGO_CRYPTONIGHT;
|
||||||
Mem::ThreadBitSet Mem::m_multiHashThreadMask = Mem::ThreadBitSet(-1L);
|
Mem::ThreadBitSet Mem::m_multiHashThreadMask = Mem::ThreadBitSet(-1L);
|
||||||
|
|
||||||
|
@ -65,11 +67,17 @@ ScratchPadMem Mem::create(ScratchPad** scratchPads, int threadId)
|
||||||
scratchPads[i] = scratchPad;
|
scratchPads[i] = scratchPad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_totalPages += scratchPadMem.pages;
|
||||||
|
m_totalHugepages += scratchPadMem.hugePages;
|
||||||
|
|
||||||
return scratchPadMem;
|
return scratchPadMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mem::release(ScratchPad** scratchPads, ScratchPadMem& scratchPadMem, int threadId)
|
void Mem::release(ScratchPad** scratchPads, ScratchPadMem& scratchPadMem, int threadId)
|
||||||
{
|
{
|
||||||
|
m_totalPages -= scratchPadMem.pages;
|
||||||
|
m_totalHugepages -= scratchPadMem.hugePages;
|
||||||
|
|
||||||
release(scratchPadMem);
|
release(scratchPadMem);
|
||||||
|
|
||||||
for (size_t i = 0; i < getThreadHashFactor(threadId); ++i) {
|
for (size_t i = 0; i < getThreadHashFactor(threadId); ++i) {
|
||||||
|
|
|
@ -83,6 +83,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isHugepagesAvailable() { return (m_flags & HugepagesAvailable) != 0; }
|
static inline bool isHugepagesAvailable() { return (m_flags & HugepagesAvailable) != 0; }
|
||||||
|
static inline bool isHugepagesEnabled() { return (m_flags & HugepagesEnabled) != 0; }
|
||||||
|
|
||||||
|
static inline int getTotalPages() { return m_totalPages; }
|
||||||
|
static inline int getTotalHugepages() { return m_totalHugepages; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void allocate(ScratchPadMem& scratchPadMem, bool useHugePages);
|
static void allocate(ScratchPadMem& scratchPadMem, bool useHugePages);
|
||||||
|
@ -92,6 +96,8 @@ private:
|
||||||
static bool m_useHugePages;
|
static bool m_useHugePages;
|
||||||
static size_t m_hashFactor;
|
static size_t m_hashFactor;
|
||||||
static int m_flags;
|
static int m_flags;
|
||||||
|
static int m_totalPages;
|
||||||
|
static int m_totalHugepages;
|
||||||
static Options::Algo m_algo;
|
static Options::Algo m_algo;
|
||||||
static ThreadBitSet m_multiHashThreadMask;
|
static ThreadBitSet m_multiHashThreadMask;
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,10 +59,11 @@ void Mem::allocate(ScratchPadMem& scratchPadMem, bool useHugePages)
|
||||||
return allocate(scratchPadMem, false);
|
return allocate(scratchPadMem, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_flags |= HugepagesAvailable;
|
|
||||||
|
|
||||||
scratchPadMem.hugePages = scratchPadMem.pages;
|
scratchPadMem.hugePages = scratchPadMem.pages;
|
||||||
|
|
||||||
|
m_flags |= HugepagesAvailable;
|
||||||
|
m_flags |= HugepagesEnabled;
|
||||||
|
|
||||||
if (madvise(scratchPadMem.memory, scratchPadMem.size, MADV_RANDOM | MADV_WILLNEED) != 0) {
|
if (madvise(scratchPadMem.memory, scratchPadMem.size, MADV_RANDOM | MADV_WILLNEED) != 0) {
|
||||||
LOG_ERR("madvise failed");
|
LOG_ERR("madvise failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,8 @@ void Mem::allocate(ScratchPadMem& scratchPadMem, bool useHugePages)
|
||||||
if (scratchPadMem.memory) {
|
if (scratchPadMem.memory) {
|
||||||
scratchPadMem.hugePages = scratchPadMem.pages;
|
scratchPadMem.hugePages = scratchPadMem.pages;
|
||||||
|
|
||||||
|
m_flags |= HugepagesEnabled;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,7 @@ CCClient::CCClient(Options* options, uv_async_t* async)
|
||||||
m_clientStatus.setCurrentAlgoName(m_options->algoName());
|
m_clientStatus.setCurrentAlgoName(m_options->algoName());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_clientStatus.setHugepages(Mem::isHugepagesAvailable());
|
|
||||||
m_clientStatus.setHashFactor(Mem::hashFactor());
|
m_clientStatus.setHashFactor(Mem::hashFactor());
|
||||||
|
|
||||||
m_clientStatus.setVersion(Version::string());
|
m_clientStatus.setVersion(Version::string());
|
||||||
m_clientStatus.setCpuBrand(Cpu::brand());
|
m_clientStatus.setCpuBrand(Cpu::brand());
|
||||||
m_clientStatus.setCpuAES(Cpu::hasAES());
|
m_clientStatus.setCpuAES(Cpu::hasAES());
|
||||||
|
@ -134,6 +132,11 @@ void CCClient::updateNetworkState(const NetworkState& network)
|
||||||
m_self->m_clientStatus.setSharesTotal(network.accepted + network.rejected);
|
m_self->m_clientStatus.setSharesTotal(network.accepted + network.rejected);
|
||||||
m_self->m_clientStatus.setHashesTotal(network.total);
|
m_self->m_clientStatus.setHashesTotal(network.total);
|
||||||
m_self->m_clientStatus.setAvgTime(network.avgTime());
|
m_self->m_clientStatus.setAvgTime(network.avgTime());
|
||||||
|
|
||||||
|
m_self->m_clientStatus.setHugepagesEnabled(Mem::isHugepagesEnabled());
|
||||||
|
m_self->m_clientStatus.setHugepages(Mem::isHugepagesAvailable());
|
||||||
|
m_self->m_clientStatus.setTotalPages(Mem::getTotalPages());
|
||||||
|
m_self->m_clientStatus.setTotalHugepages(Mem::getTotalHugepages());
|
||||||
m_self->m_clientStatus.setCurrentPowVariantName(getPowVariantName(network.powVariant));
|
m_self->m_clientStatus.setCurrentPowVariantName(getPowVariantName(network.powVariant));
|
||||||
|
|
||||||
uv_mutex_unlock(&m_mutex);
|
uv_mutex_unlock(&m_mutex);
|
||||||
|
|
|
@ -34,13 +34,16 @@
|
||||||
ClientStatus::ClientStatus()
|
ClientStatus::ClientStatus()
|
||||||
: m_currentStatus(Status::PAUSED),
|
: m_currentStatus(Status::PAUSED),
|
||||||
m_hasHugepages(false),
|
m_hasHugepages(false),
|
||||||
|
m_isHugepagesEnabled(false),
|
||||||
m_isCpuX64(false),
|
m_isCpuX64(false),
|
||||||
m_hasCpuAES(false),
|
m_hasCpuAES(false),
|
||||||
m_hashFactor(1),
|
|
||||||
m_hashrateShort(0),
|
m_hashrateShort(0),
|
||||||
m_hashrateMedium(0),
|
m_hashrateMedium(0),
|
||||||
m_hashrateLong(0),
|
m_hashrateLong(0),
|
||||||
m_hashrateHighest(0),
|
m_hashrateHighest(0),
|
||||||
|
m_hashFactor(1),
|
||||||
|
m_totalPages(0),
|
||||||
|
m_totalHugepages(0),
|
||||||
m_currentThreads(0),
|
m_currentThreads(0),
|
||||||
m_cpuSockets(0),
|
m_cpuSockets(0),
|
||||||
m_cpuCores(0),
|
m_cpuCores(0),
|
||||||
|
@ -157,14 +160,14 @@ void ClientStatus::setHugepages(bool hasHugepages)
|
||||||
m_hasHugepages = hasHugepages;
|
m_hasHugepages = hasHugepages;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientStatus::getHashFactor() const
|
bool ClientStatus::isHugepagesEnabled() const
|
||||||
{
|
{
|
||||||
return m_hashFactor;
|
return m_isHugepagesEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientStatus::setHashFactor(int hashFactor)
|
void ClientStatus::setHugepagesEnabled(bool hugepagesEnabled)
|
||||||
{
|
{
|
||||||
m_hashFactor = hashFactor;
|
m_isHugepagesEnabled = hugepagesEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientStatus::isCpuX64() const
|
bool ClientStatus::isCpuX64() const
|
||||||
|
@ -227,6 +230,36 @@ double ClientStatus::getHashrateHighest() const
|
||||||
return m_hashrateHighest;
|
return m_hashrateHighest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ClientStatus::getHashFactor() const
|
||||||
|
{
|
||||||
|
return m_hashFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientStatus::setHashFactor(int hashFactor)
|
||||||
|
{
|
||||||
|
m_hashFactor = hashFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientStatus::getTotalPages() const
|
||||||
|
{
|
||||||
|
return m_totalPages;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientStatus::setTotalPages(int totalPages)
|
||||||
|
{
|
||||||
|
m_totalPages = totalPages;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientStatus::getTotalHugepages() const
|
||||||
|
{
|
||||||
|
return m_totalHugepages;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientStatus::setTotalHugepages(int totalHugepages)
|
||||||
|
{
|
||||||
|
m_totalHugepages = totalHugepages;
|
||||||
|
}
|
||||||
|
|
||||||
int ClientStatus::getCurrentThreads() const
|
int ClientStatus::getCurrentThreads() const
|
||||||
{
|
{
|
||||||
return m_currentThreads;
|
return m_currentThreads;
|
||||||
|
@ -389,6 +422,10 @@ bool ClientStatus::parseFromJson(const rapidjson::Document& document)
|
||||||
m_hasHugepages = clientStatus["hugepages_available"].GetBool();
|
m_hasHugepages = clientStatus["hugepages_available"].GetBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clientStatus.HasMember("hugepages_enabled")) {
|
||||||
|
m_isHugepagesEnabled = clientStatus["hugepages_enabled"].GetBool();
|
||||||
|
}
|
||||||
|
|
||||||
if (clientStatus.HasMember("hash_factor")) {
|
if (clientStatus.HasMember("hash_factor")) {
|
||||||
m_hashFactor = clientStatus["hash_factor"].GetInt();
|
m_hashFactor = clientStatus["hash_factor"].GetInt();
|
||||||
}
|
}
|
||||||
|
@ -487,6 +524,7 @@ rapidjson::Value ClientStatus::toJson(rapidjson::MemoryPoolAllocator<rapidjson::
|
||||||
clientStatus.AddMember("version", rapidjson::StringRef(m_version.c_str()), allocator);
|
clientStatus.AddMember("version", rapidjson::StringRef(m_version.c_str()), allocator);
|
||||||
|
|
||||||
clientStatus.AddMember("hugepages_available", m_hasHugepages, allocator);
|
clientStatus.AddMember("hugepages_available", m_hasHugepages, allocator);
|
||||||
|
clientStatus.AddMember("hugepages_enabled", m_isHugepagesEnabled, allocator);
|
||||||
clientStatus.AddMember("hash_factor", m_hashFactor, allocator);
|
clientStatus.AddMember("hash_factor", m_hashFactor, allocator);
|
||||||
clientStatus.AddMember("cpu_is_x64", m_isCpuX64, allocator);
|
clientStatus.AddMember("cpu_is_x64", m_isCpuX64, allocator);
|
||||||
clientStatus.AddMember("cpu_has_aes", m_hasCpuAES, allocator);
|
clientStatus.AddMember("cpu_has_aes", m_hasCpuAES, allocator);
|
||||||
|
@ -536,4 +574,3 @@ std::string ClientStatus::toJsonString()
|
||||||
|
|
||||||
return strdup(buffer.GetString());
|
return strdup(buffer.GetString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,8 @@ public:
|
||||||
bool hasHugepages() const;
|
bool hasHugepages() const;
|
||||||
void setHugepages(bool hasHugepages);
|
void setHugepages(bool hasHugepages);
|
||||||
|
|
||||||
int getHashFactor() const;
|
bool isHugepagesEnabled() const;
|
||||||
void setHashFactor(int hashFactor);
|
void setHugepagesEnabled(bool hugepagesEnabled);
|
||||||
|
|
||||||
bool isCpuX64() const;
|
bool isCpuX64() const;
|
||||||
void setCpuX64(bool isCpuX64);
|
void setCpuX64(bool isCpuX64);
|
||||||
|
@ -108,6 +108,15 @@ public:
|
||||||
void setHashrateHighest(double hashrateHighest);
|
void setHashrateHighest(double hashrateHighest);
|
||||||
double getHashrateHighest() const;
|
double getHashrateHighest() const;
|
||||||
|
|
||||||
|
int getHashFactor() const;
|
||||||
|
void setHashFactor(int hashFactor);
|
||||||
|
|
||||||
|
int getTotalPages() const;
|
||||||
|
void setTotalPages(int totalPages);
|
||||||
|
|
||||||
|
int getTotalHugepages() const;
|
||||||
|
void setTotalHugepages(int totalHugepages);
|
||||||
|
|
||||||
int getCurrentThreads() const;
|
int getCurrentThreads() const;
|
||||||
void setCurrentThreads(int currentThreads);
|
void setCurrentThreads(int currentThreads);
|
||||||
|
|
||||||
|
@ -167,15 +176,18 @@ private:
|
||||||
std::string m_log;
|
std::string m_log;
|
||||||
|
|
||||||
bool m_hasHugepages;
|
bool m_hasHugepages;
|
||||||
|
bool m_isHugepagesEnabled;
|
||||||
bool m_isCpuX64;
|
bool m_isCpuX64;
|
||||||
bool m_hasCpuAES;
|
bool m_hasCpuAES;
|
||||||
|
|
||||||
int m_hashFactor;
|
|
||||||
double m_hashrateShort;
|
double m_hashrateShort;
|
||||||
double m_hashrateMedium;
|
double m_hashrateMedium;
|
||||||
double m_hashrateLong;
|
double m_hashrateLong;
|
||||||
double m_hashrateHighest;
|
double m_hashrateHighest;
|
||||||
|
|
||||||
|
int m_hashFactor;
|
||||||
|
int m_totalPages;
|
||||||
|
int m_totalHugepages;
|
||||||
int m_currentThreads;
|
int m_currentThreads;
|
||||||
int m_cpuSockets;
|
int m_cpuSockets;
|
||||||
int m_cpuCores;
|
int m_cpuCores;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue