Implemented "asm" option.
This commit is contained in:
parent
ba65a34a01
commit
c2fcf23855
14 changed files with 275 additions and 34 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "common/cpu/Cpu.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/ConfigCreator.h"
|
||||
#include "crypto/Asm.h"
|
||||
#include "crypto/CryptoNight_constants.h"
|
||||
#include "rapidjson/document.h"
|
||||
#include "rapidjson/filewritestream.h"
|
||||
|
@ -43,6 +44,7 @@ static char affinity_tmp[20] = { 0 };
|
|||
xmrig::Config::Config() : xmrig::CommonConfig(),
|
||||
m_aesMode(AES_AUTO),
|
||||
m_algoVariant(AV_AUTO),
|
||||
m_assembly(ASM_AUTO),
|
||||
m_hugePages(true),
|
||||
m_safe(false),
|
||||
m_maxCpuUsage(75),
|
||||
|
@ -51,11 +53,6 @@ xmrig::Config::Config() : xmrig::CommonConfig(),
|
|||
}
|
||||
|
||||
|
||||
xmrig::Config::~Config()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Config::reload(const char *json)
|
||||
{
|
||||
return xmrig::ConfigLoader::reload(this, json);
|
||||
|
@ -178,7 +175,7 @@ bool xmrig::Config::finalize()
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < m_threads.count; ++i) {
|
||||
m_threads.list.push_back(CpuThread::createFromAV(i, m_algorithm.algo(), av, m_threads.mask, m_priority));
|
||||
m_threads.list.push_back(CpuThread::createFromAV(i, m_algorithm.algo(), av, m_threads.mask, m_priority, m_assembly));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -204,6 +201,12 @@ bool xmrig::Config::parseBoolean(int key, bool enable)
|
|||
m_aesMode = enable ? AES_HW : AES_SOFT;
|
||||
break;
|
||||
|
||||
# ifndef XMRIG_NO_ASM
|
||||
case AssemblyKey:
|
||||
m_assembly = Asm::parse(enable);
|
||||
break;
|
||||
# endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -244,6 +247,12 @@ bool xmrig::Config::parseString(int key, const char *arg)
|
|||
return parseUint64(key, p ? strtoull(p, nullptr, 16) : strtoull(arg, nullptr, 10));
|
||||
}
|
||||
|
||||
# ifndef XMRIG_NO_ASM
|
||||
case AssemblyKey: /* --asm */
|
||||
m_assembly = Asm::parse(arg);
|
||||
break;
|
||||
# endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H__
|
||||
#define __CONFIG_H__
|
||||
#ifndef XMRIG_CONFIG_H
|
||||
#define XMRIG_CONFIG_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -69,7 +69,6 @@ public:
|
|||
|
||||
|
||||
Config();
|
||||
~Config();
|
||||
|
||||
bool reload(const char *json);
|
||||
|
||||
|
@ -77,6 +76,7 @@ public:
|
|||
|
||||
inline AesMode aesMode() const { return m_aesMode; }
|
||||
inline AlgoVariant algoVariant() const { return m_algoVariant; }
|
||||
inline Assembly assembly() const { return m_assembly; }
|
||||
inline bool isHugePages() const { return m_hugePages; }
|
||||
inline const std::vector<IThread *> &threads() const { return m_threads.list; }
|
||||
inline int priority() const { return m_priority; }
|
||||
|
@ -116,6 +116,7 @@ private:
|
|||
|
||||
AesMode m_aesMode;
|
||||
AlgoVariant m_algoVariant;
|
||||
Assembly m_assembly;
|
||||
bool m_hugePages;
|
||||
bool m_safe;
|
||||
int m_maxCpuUsage;
|
||||
|
@ -126,4 +127,4 @@ private:
|
|||
|
||||
} /* namespace xmrig */
|
||||
|
||||
#endif /* __CONFIG_H__ */
|
||||
#endif /* XMRIG_CONFIG_H */
|
||||
|
|
|
@ -135,6 +135,7 @@ static struct option const options[] = {
|
|||
{ "tls", 0, nullptr, xmrig::IConfig::TlsKey },
|
||||
{ "tls-fingerprint", 1, nullptr, xmrig::IConfig::FingerprintKey },
|
||||
{ "version", 0, nullptr, xmrig::IConfig::VersionKey },
|
||||
{ "asm", 1, nullptr, xmrig::IConfig::AssemblyKey },
|
||||
{ nullptr, 0, nullptr, 0 }
|
||||
};
|
||||
|
||||
|
@ -159,6 +160,7 @@ static struct option const config_options[] = {
|
|||
{ "threads", 1, nullptr, xmrig::IConfig::ThreadsKey },
|
||||
{ "user-agent", 1, nullptr, xmrig::IConfig::UserAgentKey },
|
||||
{ "hw-aes", 0, nullptr, xmrig::IConfig::HardwareAESKey },
|
||||
{ "asm", 1, nullptr, xmrig::IConfig::AssemblyKey },
|
||||
{ nullptr, 0, nullptr, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
|
|||
cpuid_get_raw_data(&raw);
|
||||
cpu_identify(&raw, &data);
|
||||
|
||||
strncpy(m_brand, data.brand_str, sizeof(m_brand) - 1);
|
||||
strncpy(m_brand, data.brand_str, sizeof(m_brand));
|
||||
|
||||
m_sockets = threads() / data.num_logical_cpus;
|
||||
if (m_sockets == 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue