diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-03-04 21:27:16 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-03-04 21:27:16 +0200 |
commit | 42adc50766e644132245dc33eb3cae5fea8e268f (patch) | |
tree | 27f9e294778df6a42d846153c7aa74ed3b3b9a7b /src/daemon | |
parent | Merge pull request #5117 (diff) | |
parent | miner: it can now autodetect the optimal number of threads (diff) | |
download | monero-42adc50766e644132245dc33eb3cae5fea8e268f.tar.xz |
Merge pull request #5125
8298f42e miner: it can now autodetect the optimal number of threads (moneromooo-monero)
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/command_parser_executor.cpp | 13 | ||||
-rw-r--r-- | src/daemon/command_server.cpp | 4 |
2 files changed, 12 insertions, 5 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); diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp index 96dea76b6..3e19bb42f 100644 --- a/src/daemon/command_server.cpp +++ b/src/daemon/command_server.cpp @@ -104,8 +104,8 @@ t_command_server::t_command_server( m_command_lookup.set_handler( "start_mining" , std::bind(&t_command_parser_executor::start_mining, &m_parser, p::_1) - , "start_mining <addr> [<threads>] [do_background_mining] [ignore_battery]" - , "Start mining for specified address. Defaults to 1 thread and no background mining." + , "start_mining <addr> [<threads>|auto] [do_background_mining] [ignore_battery]" + , "Start mining for specified address. Defaults to 1 thread and no background mining. Use \"auto\" to autodetect optimal number of threads." ); m_command_lookup.set_handler( "stop_mining" |