Added possibility to set variant by proxy (#79)
Added fix for wrong cpu cache detection
This commit is contained in:
parent
6fa0cf7b14
commit
d353d15be4
4 changed files with 35 additions and 1 deletions
|
@ -59,7 +59,13 @@ void CpuImpl::initCommon()
|
|||
m_l2_cache = data.l2_cache * (m_totalCores / 2) * m_sockets;
|
||||
m_l2_exclusive = true;
|
||||
}
|
||||
else {
|
||||
// Workaround for Intel Pentium Dual-Core, Core Duo, Core 2 Duo, Core 2 Quad and their Xeon homologue
|
||||
// These processors have L2 cache shared by 2 cores.
|
||||
else if (data.vendor == VENDOR_INTEL && data.ext_family == 0x06 && (data.ext_model == 0x0E || data.ext_model == 0x0F || data.ext_model == 0x17)) {
|
||||
int l2_count_per_socket = m_totalCores > 1 ? m_totalCores / 2 : 1;
|
||||
m_l2_cache = data.l2_cache > 0 ? data.l2_cache * l2_count_per_socket * m_sockets : 0;
|
||||
}
|
||||
else{
|
||||
m_l2_cache = data.l2_cache > 0 ? data.l2_cache * m_totalCores * m_sockets : 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1005,4 +1005,9 @@ bool Options::parseCCUrl(const char* url)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Options::setForcePowVersion(Options::PowVersion powVersion)
|
||||
{
|
||||
m_forcePowVersion = powVersion;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,6 +112,8 @@ public:
|
|||
|
||||
const char *algoName() const;
|
||||
|
||||
void setForcePowVersion(PowVersion version);
|
||||
|
||||
private:
|
||||
constexpr static uint16_t kDefaultCCPort = 3344;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <string.h>
|
||||
#include <utility>
|
||||
#include <uv.h>
|
||||
#include <Options.h>
|
||||
|
||||
#include "interfaces/IClientListener.h"
|
||||
#include "log/Log.h"
|
||||
|
@ -200,6 +201,26 @@ bool Client::parseJob(const rapidjson::Value ¶ms, int *code)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (params.HasMember("variant")) {
|
||||
int variantFromProxy = params["variant"].GetInt();
|
||||
|
||||
if (Options::i()->forcePowVersion() == Options::POW_AUTODETECT) {
|
||||
switch (variantFromProxy) {
|
||||
case -1:
|
||||
Options::i()->setForcePowVersion(Options::POW_AUTODETECT);
|
||||
break;
|
||||
case 0:
|
||||
Options::i()->setForcePowVersion(Options::POW_V1);
|
||||
break;
|
||||
case 1:
|
||||
Options::i()->setForcePowVersion(Options::POW_V2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_job == job) {
|
||||
if (!m_quiet) {
|
||||
LOG_WARN("[%s:%u] duplicate job received, reconnect", m_url.host(), m_url.port());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue