From 70ce04b44c7e065fcc409682e1cb127b4987dca6 Mon Sep 17 00:00:00 2001 From: MoneroOcean Date: Wed, 18 Jul 2018 16:13:54 +0200 Subject: [PATCH] Added new --calibrate-algo and --save-config command line options --- src/common/config/CommonConfig.cpp | 11 +++++++++++ src/common/config/CommonConfig.h | 5 +++++ src/common/interfaces/IConfig.h | 3 +++ src/core/ConfigLoader_platform.h | 5 +++++ 4 files changed, 24 insertions(+) diff --git a/src/common/config/CommonConfig.cpp b/src/common/config/CommonConfig.cpp index 7e43b39d..c9cbc971 100644 --- a/src/common/config/CommonConfig.cpp +++ b/src/common/config/CommonConfig.cpp @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2016-2018 XMRig , + * Copyright 2018 MoneroOcean , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -183,6 +184,14 @@ bool xmrig::CommonConfig::parseBoolean(int key, bool enable) m_dryRun = enable; break; + case IConfig::CalibrateAlgoKey: /* --calibrate-algo */ + m_calibrateAlgo = enable; + break; + + case IConfig::SaveConfigKey: /* --save-config */ + m_saveConfig = enable; + break; + default: break; } @@ -267,6 +276,8 @@ bool xmrig::CommonConfig::parseString(int key, const char *arg) case NicehashKey: /* --nicehash */ case ApiIPv6Key: /* --api-ipv6 */ case DryRunKey: /* --dry-run */ + case CalibrateAlgoKey: /* --calibrate-algo */ + case SaveConfigKey: /* --save-config */ return parseBoolean(key, true); case ColorKey: /* --no-color */ diff --git a/src/common/config/CommonConfig.h b/src/common/config/CommonConfig.h index ffebb6b2..17bab1d8 100644 --- a/src/common/config/CommonConfig.h +++ b/src/common/config/CommonConfig.h @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2016-2018 XMRig , + * Copyright 2018 MoneroOcean , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,6 +49,8 @@ public: inline bool isBackground() const { return m_background; } inline bool isColors() const { return m_colors; } inline bool isDryRun() const { return m_dryRun; } + inline bool isCalibrateAlgo() const { return m_calibrateAlgo; } + inline bool isSaveConfig() const { return m_saveConfig; } inline bool isSyslog() const { return m_syslog; } inline const char *apiToken() const { return m_apiToken.data(); } inline const char *apiWorkerId() const { return m_apiWorkerId.data(); } @@ -87,6 +90,8 @@ protected: bool m_background; bool m_colors; bool m_dryRun; + bool m_calibrateAlgo; + bool m_saveConfig; bool m_syslog; bool m_watch; int m_apiPort; diff --git a/src/common/interfaces/IConfig.h b/src/common/interfaces/IConfig.h index 62c7ba94..cd24ac90 100644 --- a/src/common/interfaces/IConfig.h +++ b/src/common/interfaces/IConfig.h @@ -5,6 +5,7 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2016-2018 XMRig + * Copyright 2018 MoneroOcean , * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,6 +68,8 @@ public: CPUPriorityKey = 1021, NicehashKey = 1006, PrintTimeKey = 1007, + CalibrateAlgoKey = 10001, + SaveConfigKey = 10002, // xmrig cpu AVKey = 'v', diff --git a/src/core/ConfigLoader_platform.h b/src/core/ConfigLoader_platform.h index bc6657d1..05c4545a 100644 --- a/src/core/ConfigLoader_platform.h +++ b/src/core/ConfigLoader_platform.h @@ -6,6 +6,7 @@ * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , * Copyright 2016-2018 XMRig , + * Copyright 2018 MoneroOcean , * * * This program is free software: you can redistribute it and/or modify @@ -54,6 +55,7 @@ Options:\n\ cryptonight-heavy\n" #endif "\ + --calibrate-algo run benchmarks before mining to measure hashrates of all supported algos\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\ @@ -88,6 +90,7 @@ Options:\n\ --api-worker-id=ID custom worker-id for API\n\ --api-ipv6 enable IPv6 support for API\n\ --api-no-restricted enable full remote access (only if API token set)\n\ + --save-config save config file including generated configuration\n\ -h, --help display this help and exit\n\ -V, --version output version information and exit\n\ "; @@ -110,6 +113,8 @@ static struct option const options[] = { { "cpu-priority", 1, nullptr, xmrig::IConfig::CPUPriorityKey }, { "donate-level", 1, nullptr, xmrig::IConfig::DonateLevelKey }, { "dry-run", 0, nullptr, xmrig::IConfig::DryRunKey }, + { "calibrate-algo", 0, nullptr, xmrig::IConfig::CalibrateAlgoKey }, + { "save-config", 0, nullptr, xmrig::IConfig::SaveConfigKey }, { "help", 0, nullptr, xmrig::IConfig::HelpKey }, { "keepalive", 0, nullptr, xmrig::IConfig::KeepAliveKey }, { "log-file", 1, nullptr, xmrig::IConfig::LogFileKey },