mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-10 21:04:37 +00:00
Added config only boolean option "hw-aes".
This commit is contained in:
parent
f0158ae505
commit
f8bf48a522
3 changed files with 30 additions and 30 deletions
|
@ -67,53 +67,49 @@ bool xmrig::Config::reload(const char *json)
|
||||||
|
|
||||||
void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
||||||
{
|
{
|
||||||
|
using namespace rapidjson;
|
||||||
|
|
||||||
doc.SetObject();
|
doc.SetObject();
|
||||||
|
|
||||||
auto &allocator = doc.GetAllocator();
|
auto &allocator = doc.GetAllocator();
|
||||||
|
|
||||||
doc.AddMember("algo", rapidjson::StringRef(algoName()), allocator);
|
doc.AddMember("algo", StringRef(algoName()), allocator);
|
||||||
|
|
||||||
rapidjson::Value api(rapidjson::kObjectType);
|
Value api(kObjectType);
|
||||||
api.AddMember("port", apiPort(), allocator);
|
api.AddMember("port", apiPort(), allocator);
|
||||||
api.AddMember("access-token", apiToken() ? rapidjson::Value(rapidjson::StringRef(apiToken())).Move() : rapidjson::Value(rapidjson::kNullType).Move(), allocator);
|
api.AddMember("access-token", apiToken() ? Value(StringRef(apiToken())).Move() : Value(kNullType).Move(), allocator);
|
||||||
api.AddMember("worker-id", apiWorkerId() ? rapidjson::Value(rapidjson::StringRef(apiWorkerId())).Move() : rapidjson::Value(rapidjson::kNullType).Move(), allocator);
|
api.AddMember("worker-id", apiWorkerId() ? Value(StringRef(apiWorkerId())).Move() : Value(kNullType).Move(), allocator);
|
||||||
api.AddMember("ipv6", isApiIPv6(), allocator);
|
api.AddMember("ipv6", isApiIPv6(), allocator);
|
||||||
api.AddMember("restricted", isApiRestricted(), allocator);
|
api.AddMember("restricted", isApiRestricted(), allocator);
|
||||||
doc.AddMember("api", api, allocator);
|
doc.AddMember("api", api, allocator);
|
||||||
|
|
||||||
doc.AddMember("av", algoVariant(), allocator);
|
doc.AddMember("av", algoVariant(), allocator);
|
||||||
doc.AddMember("background", isBackground(), allocator);
|
doc.AddMember("background", isBackground(), allocator);
|
||||||
|
doc.AddMember("colors", isColors(), allocator);
|
||||||
doc.AddMember("colors", isColors(), allocator);
|
|
||||||
|
|
||||||
if (affinity() != -1L) {
|
if (affinity() != -1L) {
|
||||||
snprintf(affinity_tmp, sizeof(affinity_tmp) - 1, "0x%" PRIX64, affinity());
|
snprintf(affinity_tmp, sizeof(affinity_tmp) - 1, "0x%" PRIX64, affinity());
|
||||||
doc.AddMember("cpu-affinity", rapidjson::StringRef(affinity_tmp), allocator);
|
doc.AddMember("cpu-affinity", StringRef(affinity_tmp), allocator);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doc.AddMember("cpu-affinity", rapidjson::kNullType, allocator);
|
doc.AddMember("cpu-affinity", kNullType, allocator);
|
||||||
}
|
|
||||||
|
|
||||||
if (priority() != -1) {
|
|
||||||
doc.AddMember("cpu-priority", priority(), allocator);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
doc.AddMember("cpu-priority", rapidjson::kNullType, allocator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doc.AddMember("cpu-priority", priority() != -1 ? Value(priority()) : Value(kNullType), allocator);
|
||||||
doc.AddMember("donate-level", donateLevel(), allocator);
|
doc.AddMember("donate-level", donateLevel(), allocator);
|
||||||
doc.AddMember("huge-pages", isHugePages(), allocator);
|
doc.AddMember("huge-pages", isHugePages(), allocator);
|
||||||
doc.AddMember("log-file", logFile() ? rapidjson::Value(rapidjson::StringRef(logFile())).Move() : rapidjson::Value(rapidjson::kNullType).Move(), allocator);
|
doc.AddMember("hw-aes", m_aesMode == AES_AUTO ? Value(kNullType) : Value(m_aesMode == AES_HW), allocator);
|
||||||
|
doc.AddMember("log-file", logFile() ? Value(StringRef(logFile())).Move() : Value(kNullType).Move(), allocator);
|
||||||
doc.AddMember("max-cpu-usage", m_maxCpuUsage, allocator);
|
doc.AddMember("max-cpu-usage", m_maxCpuUsage, allocator);
|
||||||
|
|
||||||
rapidjson::Value pools(rapidjson::kArrayType);
|
Value pools(kArrayType);
|
||||||
|
|
||||||
for (const Pool &pool : m_pools) {
|
for (const Pool &pool : m_pools) {
|
||||||
rapidjson::Value obj(rapidjson::kObjectType);
|
Value obj(kObjectType);
|
||||||
|
|
||||||
obj.AddMember("url", rapidjson::StringRef(pool.url()), allocator);
|
obj.AddMember("url", StringRef(pool.url()), allocator);
|
||||||
obj.AddMember("user", rapidjson::StringRef(pool.user()), allocator);
|
obj.AddMember("user", StringRef(pool.user()), allocator);
|
||||||
obj.AddMember("pass", rapidjson::StringRef(pool.password()), allocator);
|
obj.AddMember("pass", StringRef(pool.password()), allocator);
|
||||||
|
|
||||||
if (pool.keepAlive() == 0 || pool.keepAlive() == Pool::kKeepAliveTimeout) {
|
if (pool.keepAlive() == 0 || pool.keepAlive() == Pool::kKeepAliveTimeout) {
|
||||||
obj.AddMember("keepalive", pool.keepAlive() > 0, allocator);
|
obj.AddMember("keepalive", pool.keepAlive() > 0, allocator);
|
||||||
|
@ -134,7 +130,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
||||||
doc.AddMember("retry-pause", retryPause(), allocator);
|
doc.AddMember("retry-pause", retryPause(), allocator);
|
||||||
doc.AddMember("safe", m_safe, allocator);
|
doc.AddMember("safe", m_safe, allocator);
|
||||||
doc.AddMember("threads", threadsCount(), allocator);
|
doc.AddMember("threads", threadsCount(), allocator);
|
||||||
doc.AddMember("user-agent", userAgent() ? rapidjson::Value(rapidjson::StringRef(userAgent())).Move() : rapidjson::Value(rapidjson::kNullType).Move(), allocator);
|
doc.AddMember("user-agent", userAgent() ? Value(StringRef(userAgent())).Move() : Value(kNullType).Move(), allocator);
|
||||||
|
|
||||||
# ifdef HAVE_SYSLOG_H
|
# ifdef HAVE_SYSLOG_H
|
||||||
doc.AddMember("syslog", isSyslog(), allocator);
|
doc.AddMember("syslog", isSyslog(), allocator);
|
||||||
|
@ -156,13 +152,11 @@ bool xmrig::Config::adjust()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_aesMode == AES_AUTO) {
|
|
||||||
m_aesMode = Cpu::hasAES() ? AES_HW : AES_SOFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_threads.cpu.empty()) {
|
if (!m_threads.cpu.empty()) {
|
||||||
|
const bool softAES = (m_aesMode == AES_AUTO ? (Cpu::hasAES() ? AES_HW : AES_SOFT) : m_aesMode) == AES_SOFT;
|
||||||
|
|
||||||
for (size_t i = 0; i < m_threads.cpu.size(); ++i) {
|
for (size_t i = 0; i < m_threads.cpu.size(); ++i) {
|
||||||
m_threads.list.push_back(CpuThread::createFromData(i, m_algorithm, m_threads.cpu[i], m_priority, m_aesMode == AES_SOFT));
|
m_threads.list.push_back(CpuThread::createFromData(i, m_algorithm, m_threads.cpu[i], m_priority, softAES));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -198,18 +192,22 @@ bool xmrig::Config::parseBoolean(int key, bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case xmrig::IConfig::SafeKey: /* --safe */
|
case IConfig::SafeKey: /* --safe */
|
||||||
m_safe = enable;
|
m_safe = enable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xmrig::IConfig::HugePagesKey: /* --no-huge-pages */
|
case IConfig::HugePagesKey: /* --no-huge-pages */
|
||||||
m_hugePages = enable;
|
m_hugePages = enable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case xmrig::IConfig::DryRunKey: /* --dry-run */
|
case IConfig::DryRunKey: /* --dry-run */
|
||||||
m_dryRun = enable;
|
m_dryRun = enable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IConfig::HardwareAESKey: /* hw-aes config only */
|
||||||
|
m_aesMode = enable ? AES_HW : AES_SOFT;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,7 @@ static struct option const config_options[] = {
|
||||||
{ "syslog", 0, nullptr, xmrig::IConfig::SyslogKey },
|
{ "syslog", 0, nullptr, xmrig::IConfig::SyslogKey },
|
||||||
{ "threads", 1, nullptr, xmrig::IConfig::ThreadsKey },
|
{ "threads", 1, nullptr, xmrig::IConfig::ThreadsKey },
|
||||||
{ "user-agent", 1, nullptr, xmrig::IConfig::UserAgentKey },
|
{ "user-agent", 1, nullptr, xmrig::IConfig::UserAgentKey },
|
||||||
|
{ "hw-aes", 0, nullptr, xmrig::IConfig::HardwareAESKey },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
MaxCPUUsageKey = 1004,
|
MaxCPUUsageKey = 1004,
|
||||||
SafeKey = 1005,
|
SafeKey = 1005,
|
||||||
ThreadsKey = 't',
|
ThreadsKey = 't',
|
||||||
|
HardwareAESKey = 1011,
|
||||||
|
|
||||||
// xmrig-proxy
|
// xmrig-proxy
|
||||||
AccessLogFileKey = 'A',
|
AccessLogFileKey = 'A',
|
||||||
|
|
Loading…
Reference in a new issue