diff options
author | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-07-19 09:54:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-19 09:54:44 +0200 |
commit | 545290619f3e73b3f8a27d9fdaa089001828429c (patch) | |
tree | fb611880a643eebad957369e124495eae169da9a /minethd.cpp | |
parent | e1ce61416dc9aa8965d7de2498df35ac1fd12841 (diff) | |
parent | 06402d739a522dbaa7093cc5e912c4b8a8abeb29 (diff) | |
download | xmr-stak-545290619f3e73b3f8a27d9fdaa089001828429c.zip xmr-stak-545290619f3e73b3f8a27d9fdaa089001828429c.tar.gz |
Merge pull request #225 from fireice-uk/topic-bug-squashing
Topic bug squashing
Diffstat (limited to 'minethd.cpp')
-rw-r--r-- | minethd.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/minethd.cpp b/minethd.cpp index fd83e82..5c7871d 100644 --- a/minethd.cpp +++ b/minethd.cpp @@ -150,7 +150,7 @@ void telemetry::push_perf_value(size_t iThd, uint64_t iHashCount, uint64_t iTime iBucketTop[iThd] = (iTop + 1) & iBucketMask; } -minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefetch, int affinity) +minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefetch, int64_t affinity) { oWork = pWork; bQuit = 0; @@ -307,15 +307,6 @@ std::vector<minethd*>* minethd::thread_starter(miner_work& pWork) jconf::inst()->GetThreadConfig(i, cfg); minethd* thd = new minethd(pWork, i, cfg.bDoubleMode, cfg.bNoPrefetch, cfg.iCpuAff); - - if(cfg.iCpuAff >= 0) - { -#if defined(__APPLE__) - printer::inst()->print_msg(L1, "WARNING on MacOS thread affinity is only advisory."); -#endif - thd_setaffinity(thd->oWorkThd.native_handle(), cfg.iCpuAff); - } - pvThreads->push_back(thd); if(cfg.iCpuAff >= 0) @@ -370,11 +361,22 @@ minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch) return func_table[digit.to_ulong()]; } -void minethd::work_main() +void minethd::pin_thd_affinity() { // pin memory to NUMA node bindMemoryToNUMANode(affinity); +#if defined(__APPLE__) + printer::inst()->print_msg(L1, "WARNING on MacOS thread affinity is only advisory."); +#endif + thd_setaffinity(oWorkThd.native_handle(), affinity); +} + +void minethd::work_main() +{ + if(affinity >= 0) //-1 means no affinity + pin_thd_affinity(); + cn_hash_fun hash_fun; cryptonight_ctx* ctx; uint64_t iCount = 0; @@ -462,8 +464,8 @@ minethd::cn_hash_fun_dbl minethd::func_dbl_selector(bool bHaveAes, bool bNoPrefe void minethd::double_work_main() { - // pin memory to NUMA node - bindMemoryToNUMANode(affinity); + if(affinity >= 0) //-1 means no affinity + pin_thd_affinity(); cn_hash_fun_dbl hash_fun; cryptonight_ctx* ctx0; |