aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_parser_executor.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-02-04 15:41:58 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-02-23 12:22:32 +0000
commit8298f42e9d9c4d81792d7ab344efbe424e9b9ba2 (patch)
tree9305abebceb9b334347a6288906f25c972bb15ae /src/daemon/command_parser_executor.cpp
parentMerge pull request #4988 (diff)
downloadmonero-8298f42e9d9c4d81792d7ab344efbe424e9b9ba2.tar.xz
miner: it can now autodetect the optimal number of threads
Diffstat (limited to '')
-rw-r--r--src/daemon/command_parser_executor.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 73f33a674..00d004970 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -302,7 +302,7 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
{
if(!args.size())
{
- std::cout << "Please specify a wallet address to mine for: start_mining <addr> [<threads>]" << std::endl;
+ std::cout << "Please specify a wallet address to mine for: start_mining <addr> [<threads>|auto]" << std::endl;
return true;
}
@@ -388,8 +388,15 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
if(args.size() >= 2)
{
- bool ok = epee::string_tools::get_xtype_from_string(threads_count, args[1]);
- threads_count = (ok && 0 < threads_count) ? threads_count : 1;
+ if (args[1] == "auto" || args[1] == "autodetect")
+ {
+ threads_count = 0;
+ }
+ else
+ {
+ bool ok = epee::string_tools::get_xtype_from_string(threads_count, args[1]);
+ threads_count = (ok && 0 < threads_count) ? threads_count : 1;
+ }
}
m_executor.start_mining(info.address, threads_count, nettype, do_background_mining, ignore_battery);