aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_parser_executor.cpp
diff options
context:
space:
mode:
authorDion Ahmetaj <Dion Ahmetaj>2017-01-14 22:20:54 -0500
committerDion Ahmetaj <Dion Ahmetaj>2017-02-10 18:07:39 -0500
commit345ed4823c686edda33e224316c5ade8a5b838ae (patch)
tree7d113167a22dc88069142584cc32f42202a9ce52 /src/daemon/command_parser_executor.cpp
parentMerge pull request #1698 (diff)
downloadmonero-345ed4823c686edda33e224316c5ade8a5b838ae.tar.xz
Background/smart mining. If a users' computer is plugged into a power
source, and CPU has been idle for some time, then begin mining to some threshold (don't destroy the users' CPU). This patch only supports windows and linux (I've only tested on Win64 and Ubuntu). The variables currently default to pretty conservative values (i.e. 20% CPU mining threshold).
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-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 fd73654ac..8ed529737 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -271,17 +271,24 @@ bool t_command_parser_executor::start_mining(const std::vector<std::string>& arg
if(testnet)
std::cout << "Mining to a testnet address, make sure this is intentional!" << std::endl;
uint64_t threads_count = 1;
- if(args.size() > 2)
+ bool do_background_mining = false;
+ if(args.size() > 3)
{
return false;
}
- else if(args.size() == 2)
+
+ if(args.size() == 3)
+ {
+ do_background_mining = args[2] == "true";
+ }
+
+ 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;
}
- m_executor.start_mining(adr, threads_count, testnet);
+ m_executor.start_mining(adr, threads_count, testnet, do_background_mining);
return true;
}