From 867478b983a6a8b8bbd853e5a9f14cc8c447cfe3 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 12 Apr 2019 18:30:08 +0700 Subject: [PATCH] Added command line option --daemon and --daemon-poll-interval --- src/base/kernel/config/BaseTransform.cpp | 8 ++ src/base/kernel/interfaces/IConfig.h | 2 + src/core/config/Config_platform.h | 2 + src/core/config/usage.h | 101 +++++++++++++---------- 4 files changed, 71 insertions(+), 42 deletions(-) diff --git a/src/base/kernel/config/BaseTransform.cpp b/src/base/kernel/config/BaseTransform.cpp index 3b6b6d82f..e4165a4c1 100644 --- a/src/base/kernel/config/BaseTransform.cpp +++ b/src/base/kernel/config/BaseTransform.cpp @@ -161,6 +161,7 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch case IConfig::PrintTimeKey: /* --print-time */ case IConfig::HttpPort: /* --http-port */ case IConfig::DonateLevelKey: /* --donate-level */ + case IConfig::DaemonPollKey: /* --daemon-poll-interval */ # ifdef XMRIG_DEPRECATED case IConfig::ApiPort: /* --api-port */ # endif @@ -173,6 +174,7 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch case IConfig::TlsKey: /* --tls */ case IConfig::DryRunKey: /* --dry-run */ case IConfig::HttpEnabledKey: /* --http-enabled */ + case IConfig::DaemonKey: /* --daemon */ return transformBoolean(doc, key, true); case IConfig::ColorKey: /* --no-color */ @@ -204,6 +206,9 @@ void xmrig::BaseTransform::transformBoolean(rapidjson::Document &doc, int key, b case IConfig::TlsKey: /* --tls */ return add(doc, kPools, "tls", enable); + case IConfig::DaemonKey: /* --daemon */ + return add(doc, kPools, "daemon", enable); + # ifndef XMRIG_PROXY_PROJECT case IConfig::NicehashKey: /* --nicehash */ return add(doc, kPools, "nicehash", enable); @@ -265,6 +270,9 @@ void xmrig::BaseTransform::transformUint64(rapidjson::Document &doc, int key, ui case IConfig::PrintTimeKey: /* --print-time */ return set(doc, "print-time", arg); + case IConfig::DaemonPollKey: /* --daemon-poll-interval */ + return add(doc, kPools, "daemon-poll-interval", arg); + default: break; } diff --git a/src/base/kernel/interfaces/IConfig.h b/src/base/kernel/interfaces/IConfig.h index d592c4cbe..07849e35b 100644 --- a/src/base/kernel/interfaces/IConfig.h +++ b/src/base/kernel/interfaces/IConfig.h @@ -70,6 +70,8 @@ public: TlsKey = 1013, FingerprintKey = 1014, ProxyDonateKey = 1017, + DaemonKey = 1018, + DaemonPollKey = 1019, # ifdef XMRIG_DEPRECATED ApiPort = 4000, diff --git a/src/core/config/Config_platform.h b/src/core/config/Config_platform.h index 8ece4105b..ca06a7035 100644 --- a/src/core/config/Config_platform.h +++ b/src/core/config/Config_platform.h @@ -82,6 +82,8 @@ static const option options[] = { { "tls", 0, nullptr, IConfig::TlsKey }, { "tls-fingerprint", 1, nullptr, IConfig::FingerprintKey }, { "asm", 1, nullptr, IConfig::AssemblyKey }, + { "daemon", 0, nullptr, IConfig::DaemonKey }, + { "daemon-poll-interval", 1, nullptr, IConfig::DaemonPollKey }, # ifdef XMRIG_DEPRECATED { "api-port", 1, nullptr, IConfig::ApiPort }, diff --git a/src/core/config/usage.h b/src/core/config/usage.h index 430a60c7c..ce1727780 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -35,59 +35,76 @@ namespace xmrig { static char const usage[] = "\ Usage: " APP_ID " [OPTIONS]\n\ Options:\n\ - -a, --algo=ALGO specify the algorithm to use\n\ - cryptonight\n" + -a, --algo=ALGO specify the algorithm to use\n\ + cryptonight\n" #ifndef XMRIG_NO_AEON "\ - cryptonight-lite\n" + cryptonight-lite\n" #endif #ifndef XMRIG_NO_SUMO "\ - cryptonight-heavy\n" + cryptonight-heavy\n" +#endif +#ifndef XMRIG_NO_CN_PICO +"\ + cryptonight-pico\n" #endif "\ - -o, --url=URL URL of mining server\n\ - -O, --userpass=U:P username:password pair for mining server\n\ - -u, --user=USERNAME username for mining server\n\ - -p, --pass=PASSWORD password for mining server\n\ - --rig-id=ID rig identifier for pool-side statistics (needs pool support)\n\ - -t, --threads=N number of miner threads\n\ - -v, --av=N algorithm variation, 0 auto select\n\ - -k, --keepalive send keepalived packet for prevent timeout (needs pool support)\n\ - --nicehash enable nicehash.com support\n\ - --tls enable SSL/TLS support (needs pool support)\n\ - --tls-fingerprint=F pool TLS certificate fingerprint, if set enable strict certificate pinning\n\ - -r, --retries=N number of times to retry before switch to backup server (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-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\ - --variant algorithm PoW variant\n\ - --donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\ - --user-agent set custom user-agent string for pool\n\ - -B, --background run the miner in the background\n\ - -c, --config=FILE load a JSON-format configuration file\n\ - -l, --log-file=FILE log all output to a file\n" + -o, --url=URL URL of mining server\n\ + -O, --userpass=U:P username:password pair for mining server\n\ + -u, --user=USERNAME username for mining server\n\ + -p, --pass=PASSWORD password for mining server\n\ + --rig-id=ID rig identifier for pool-side statistics (needs pool support)\n\ + -t, --threads=N number of miner threads\n\ + -v, --av=N algorithm variation, 0 auto select\n\ + -k, --keepalive send keepalived packet for prevent timeout (needs pool support)\n\ + --nicehash enable nicehash.com support\n" +#ifdef XMRIG_FEATURE_TLS +"\ + --tls enable SSL/TLS support (needs pool support)\n\ + --tls-fingerprint=F pool TLS certificate fingerprint, if set enable strict certificate pinning\n" +#endif +#ifdef XMRIG_FEATURE_HTTP +"\ + --daemon use daemon RPC instead of pool for solo mining\n\ + --daemon-poll-interval=N daemon poll interval in milliseconds (default: 1000)\n" +#endif +"\ + -r, --retries=N number of times to retry before switch to backup server (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-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\ + --variant algorithm PoW variant\n\ + --donate-level=N donate level, default 5%% (5 minutes in 100 minutes)\n\ + --user-agent set custom user-agent string for pool\n\ + -B, --background run the miner in the background\n\ + -c, --config=FILE load a JSON-format configuration file\n\ + -l, --log-file=FILE log all output to a file\n" # ifdef HAVE_SYSLOG_H "\ - -S, --syslog use system log for output messages\n" + -S, --syslog use system log for output messages\n" # endif "\ - --max-cpu-usage=N maximum CPU usage for automatic threads mode (default 75)\n\ - --safe safe adjust threads and av settings for current CPU\n\ - --asm=ASM ASM code for cn/2, possible values: auto, none, intel, ryzen, bulldozer.\n\ - --print-time=N print hashrate report every N seconds\n\ - --api-worker-id=ID custom worker-id for API\n\ - --api-id=ID custom instance ID for API\n\ - --http-enabled enable HTTP API\n\ - --http-host=HOST bind host for HTTP API (by default 127.0.0.1)\n\ - --http-port=N bind port for HTTP API\n\ - --http-access-token=T access token for HTTP API\n\ - --http-no-restricted enable full remote access to HTTP API (only if access token set)\n\ - --dry-run test configuration and exit\n\ - -h, --help display this help and exit\n\ - -V, --version output version information and exit\n\ + --max-cpu-usage=N maximum CPU usage for automatic threads mode (default: 100)\n\ + --safe safe adjust threads and av settings for current CPU\n\ + --asm=ASM ASM optimizations, possible values: auto, none, intel, ryzen, bulldozer.\n\ + --print-time=N print hashrate report every N seconds\n" +#ifdef XMRIG_FEATURE_HTTP +"\ + --api-worker-id=ID custom worker-id for API\n\ + --api-id=ID custom instance ID for API\n\ + --http-enabled enable HTTP API\n\ + --http-host=HOST bind host for HTTP API (default: 127.0.0.1)\n\ + --http-port=N bind port for HTTP API\n\ + --http-access-token=T access token for HTTP API\n\ + --http-no-restricted enable full remote access to HTTP API (only if access token set)\n" +#endif +"\ + --dry-run test configuration and exit\n\ + -h, --help display this help and exit\n\ + -V, --version output version information and exit\n\ ";