miner: it can now autodetect the optimal number of threads

This commit is contained in:
moneromooo-monero 2019-02-04 15:41:58 +00:00
parent 31bdf7bd11
commit 8298f42e9d
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
4 changed files with 96 additions and 9 deletions

View file

@ -103,6 +103,7 @@ namespace cryptonote
bool worker_thread();
bool request_block_template();
void merge_hr();
void update_autodetection();
struct miner_config
{
@ -132,16 +133,20 @@ namespace cryptonote
account_public_address m_mine_address;
epee::math_helper::once_a_time_seconds<5> m_update_block_template_interval;
epee::math_helper::once_a_time_seconds<2> m_update_merge_hr_interval;
epee::math_helper::once_a_time_seconds<1> m_autodetect_interval;
std::vector<blobdata> m_extra_messages;
miner_config m_config;
std::string m_config_folder_path;
std::atomic<uint64_t> m_last_hr_merge_time;
std::atomic<uint64_t> m_hashes;
std::atomic<uint64_t> m_total_hashes;
std::atomic<uint64_t> m_current_hash_rate;
epee::critical_section m_last_hash_rates_lock;
std::list<uint64_t> m_last_hash_rates;
bool m_do_print_hashrate;
bool m_do_mining;
std::vector<std::pair<uint64_t, uint64_t>> m_threads_autodetect;
boost::thread::attributes m_attrs;
// background mining stuffs ..