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).
This commit is contained in:
Dion Ahmetaj 2017-01-14 22:20:54 -05:00
parent cb54eeaa31
commit 345ed4823c
8 changed files with 459 additions and 18 deletions

View file

@ -635,7 +635,7 @@ namespace cryptonote
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
if(!m_core.get_miner().start(adr, static_cast<size_t>(req.threads_count), attrs))
if(!m_core.get_miner().start(adr, static_cast<size_t>(req.threads_count), attrs, req.do_background_mining))
{
res.status = "Failed, mining not started";
LOG_PRINT_L0(res.status);