Added option --no-huge-pages.
This commit is contained in:
parent
27f02d5f9f
commit
8bba0df054
6 changed files with 28 additions and 5 deletions
|
@ -113,7 +113,7 @@ int App::exec()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mem::allocate(m_options->algo(), m_options->threads(), m_options->doubleHash());
|
Mem::allocate(m_options->algo(), m_options->threads(), m_options->doubleHash(), m_options->hugePages());
|
||||||
Summary::print();
|
Summary::print();
|
||||||
|
|
||||||
Workers::start(m_options->affinity(), m_options->priority());
|
Workers::start(m_options->affinity(), m_options->priority());
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
Lock = 4
|
Lock = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool allocate(int algo, int threads, bool doubleHash);
|
static bool allocate(int algo, int threads, bool doubleHash, bool enabled);
|
||||||
static cryptonight_ctx *create(int threadId);
|
static cryptonight_ctx *create(int threadId);
|
||||||
static void *calloc(size_t num, size_t size);
|
static void *calloc(size_t num, size_t size);
|
||||||
static void release();
|
static void release();
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
|
|
||||||
|
|
||||||
bool Mem::allocate(int algo, int threads, bool doubleHash)
|
bool Mem::allocate(int algo, int threads, bool doubleHash, bool enabled)
|
||||||
{
|
{
|
||||||
m_algo = algo;
|
m_algo = algo;
|
||||||
m_threads = threads;
|
m_threads = threads;
|
||||||
|
@ -42,6 +42,11 @@ bool Mem::allocate(int algo, int threads, bool doubleHash)
|
||||||
const int ratio = (doubleHash && algo != Options::ALGO_CRYPTONIGHT_LITE) ? 2 : 1;
|
const int ratio = (doubleHash && algo != Options::ALGO_CRYPTONIGHT_LITE) ? 2 : 1;
|
||||||
const size_t size = MEMORY * (threads * ratio + 1);
|
const size_t size = MEMORY * (threads * ratio + 1);
|
||||||
|
|
||||||
|
if (!enabled) {
|
||||||
|
m_memory = static_cast<uint8_t*>(_mm_malloc(size, 16));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
m_flags |= HugepagesAvailable;
|
m_flags |= HugepagesAvailable;
|
||||||
|
|
||||||
# if defined(__APPLE__)
|
# if defined(__APPLE__)
|
||||||
|
|
|
@ -144,7 +144,7 @@ static BOOL TrySetLockPagesPrivilege() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Mem::allocate(int algo, int threads, bool doubleHash)
|
bool Mem::allocate(int algo, int threads, bool doubleHash, bool enabled)
|
||||||
{
|
{
|
||||||
m_algo = algo;
|
m_algo = algo;
|
||||||
m_threads = threads;
|
m_threads = threads;
|
||||||
|
@ -153,6 +153,11 @@ bool Mem::allocate(int algo, int threads, bool doubleHash)
|
||||||
const int ratio = (doubleHash && algo != Options::ALGO_CRYPTONIGHT_LITE) ? 2 : 1;
|
const int ratio = (doubleHash && algo != Options::ALGO_CRYPTONIGHT_LITE) ? 2 : 1;
|
||||||
const size_t size = MEMORY * (threads * ratio + 1);
|
const size_t size = MEMORY * (threads * ratio + 1);
|
||||||
|
|
||||||
|
if (!enabled) {
|
||||||
|
m_memory = static_cast<uint8_t*>(_mm_malloc(size, 16));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (TrySetLockPagesPrivilege()) {
|
if (TrySetLockPagesPrivilege()) {
|
||||||
m_flags |= HugepagesAvailable;
|
m_flags |= HugepagesAvailable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ Options:\n\
|
||||||
-R, --retry-pause=N time to pause between retries (default: 5)\n\
|
-R, --retry-pause=N time to pause between retries (default: 5)\n\
|
||||||
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n\
|
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n\
|
||||||
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n\
|
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n\
|
||||||
|
--no-huge-pages disable huge pages support\n\
|
||||||
--no-color disable colored output\n\
|
--no-color disable colored output\n\
|
||||||
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\
|
--donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\
|
||||||
--user-agent set custom user-agent string for pool\n\
|
--user-agent set custom user-agent string for pool\n\
|
||||||
|
@ -102,6 +103,7 @@ static struct option const options[] = {
|
||||||
{ "max-cpu-usage", 1, nullptr, 1004 },
|
{ "max-cpu-usage", 1, nullptr, 1004 },
|
||||||
{ "nicehash", 0, nullptr, 1006 },
|
{ "nicehash", 0, nullptr, 1006 },
|
||||||
{ "no-color", 0, nullptr, 1002 },
|
{ "no-color", 0, nullptr, 1002 },
|
||||||
|
{ "no-huge-pages", 0, nullptr, 1009 },
|
||||||
{ "pass", 1, nullptr, 'p' },
|
{ "pass", 1, nullptr, 'p' },
|
||||||
{ "print-time", 1, nullptr, 1007 },
|
{ "print-time", 1, nullptr, 1007 },
|
||||||
{ "retries", 1, nullptr, 'r' },
|
{ "retries", 1, nullptr, 'r' },
|
||||||
|
@ -126,6 +128,7 @@ static struct option const config_options[] = {
|
||||||
{ "cpu-affinity", 1, nullptr, 1020 },
|
{ "cpu-affinity", 1, nullptr, 1020 },
|
||||||
{ "cpu-priority", 1, nullptr, 1021 },
|
{ "cpu-priority", 1, nullptr, 1021 },
|
||||||
{ "donate-level", 1, nullptr, 1003 },
|
{ "donate-level", 1, nullptr, 1003 },
|
||||||
|
{ "huge-pages", 0, nullptr, 1009 },
|
||||||
{ "log-file", 1, nullptr, 'l' },
|
{ "log-file", 1, nullptr, 'l' },
|
||||||
{ "max-cpu-usage", 1, nullptr, 1004 },
|
{ "max-cpu-usage", 1, nullptr, 1004 },
|
||||||
{ "print-time", 1, nullptr, 1007 },
|
{ "print-time", 1, nullptr, 1007 },
|
||||||
|
@ -181,6 +184,7 @@ Options::Options(int argc, char **argv) :
|
||||||
m_background(false),
|
m_background(false),
|
||||||
m_colors(true),
|
m_colors(true),
|
||||||
m_doubleHash(false),
|
m_doubleHash(false),
|
||||||
|
m_hugePages(true),
|
||||||
m_ready(false),
|
m_ready(false),
|
||||||
m_safe(false),
|
m_safe(false),
|
||||||
m_syslog(false),
|
m_syslog(false),
|
||||||
|
@ -311,11 +315,14 @@ bool Options::parseArg(int key, const char *arg)
|
||||||
case 'B': /* --background */
|
case 'B': /* --background */
|
||||||
case 'k': /* --keepalive */
|
case 'k': /* --keepalive */
|
||||||
case 'S': /* --syslog */
|
case 'S': /* --syslog */
|
||||||
case 1002: /* --no-color */
|
|
||||||
case 1005: /* --safe */
|
case 1005: /* --safe */
|
||||||
case 1006: /* --nicehash */
|
case 1006: /* --nicehash */
|
||||||
return parseBoolean(key, true);
|
return parseBoolean(key, true);
|
||||||
|
|
||||||
|
case 1002: /* --no-color */
|
||||||
|
case 1009: /* --no-huge-pages */
|
||||||
|
return parseBoolean(key, false);
|
||||||
|
|
||||||
case 'V': /* --version */
|
case 'V': /* --version */
|
||||||
showVersion();
|
showVersion();
|
||||||
return false;
|
return false;
|
||||||
|
@ -462,6 +469,10 @@ bool Options::parseBoolean(int key, bool enable)
|
||||||
m_pools.back()->setNicehash(enable);
|
m_pools.back()->setNicehash(enable);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1009: /* --no-huge-pages */
|
||||||
|
m_hugePages = enable;
|
||||||
|
break;
|
||||||
|
|
||||||
case 2000: /* colors */
|
case 2000: /* colors */
|
||||||
m_colors = enable;
|
m_colors = enable;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
inline bool background() const { return m_background; }
|
inline bool background() const { return m_background; }
|
||||||
inline bool colors() const { return m_colors; }
|
inline bool colors() const { return m_colors; }
|
||||||
inline bool doubleHash() const { return m_doubleHash; }
|
inline bool doubleHash() const { return m_doubleHash; }
|
||||||
|
inline bool hugePages() const { return m_hugePages; }
|
||||||
inline bool syslog() const { return m_syslog; }
|
inline bool syslog() const { return m_syslog; }
|
||||||
inline const char *logFile() const { return m_logFile; }
|
inline const char *logFile() const { return m_logFile; }
|
||||||
inline const char *userAgent() const { return m_userAgent; }
|
inline const char *userAgent() const { return m_userAgent; }
|
||||||
|
@ -102,6 +103,7 @@ private:
|
||||||
bool m_background;
|
bool m_background;
|
||||||
bool m_colors;
|
bool m_colors;
|
||||||
bool m_doubleHash;
|
bool m_doubleHash;
|
||||||
|
bool m_hugePages;
|
||||||
bool m_ready;
|
bool m_ready;
|
||||||
bool m_safe;
|
bool m_safe;
|
||||||
bool m_syslog;
|
bool m_syslog;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue