summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/cpu
diff options
context:
space:
mode:
authorpsychocrypt <psychocrypt@users.noreply.github.com>2017-09-29 22:06:09 +0200
committerpsychocrypt <psychocrypt@users.noreply.github.com>2017-09-30 23:46:08 +0200
commit855af1cf65de1fd3795de3c9a859fd9242625a84 (patch)
tree51368c6f1d6cd401969f4beedcbcccc21d055153 /xmrstak/backend/cpu
parent8babae3156430f5aa6b804f7c352ffb178097963 (diff)
downloadxmr-stak-855af1cf65de1fd3795de3c9a859fd9242625a84.zip
xmr-stak-855af1cf65de1fd3795de3c9a859fd9242625a84.tar.gz
fix compile
Diffstat (limited to 'xmrstak/backend/cpu')
-rw-r--r--xmrstak/backend/cpu/autoAdjust.hpp2
-rw-r--r--xmrstak/backend/cpu/autoAdjustHwloc.hpp2
-rw-r--r--xmrstak/backend/cpu/minethd.cpp41
-rw-r--r--xmrstak/backend/cpu/minethd.hpp21
4 files changed, 26 insertions, 40 deletions
diff --git a/xmrstak/backend/cpu/autoAdjust.hpp b/xmrstak/backend/cpu/autoAdjust.hpp
index f686224..639c27b 100644
--- a/xmrstak/backend/cpu/autoAdjust.hpp
+++ b/xmrstak/backend/cpu/autoAdjust.hpp
@@ -39,7 +39,7 @@ public:
bool printConfig()
{
- ConfigEditor configTpl{};
+ configEditor configTpl{};
// load the template of the backend config into a char variable
const char *tpl =
diff --git a/xmrstak/backend/cpu/autoAdjustHwloc.hpp b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
index 055a7f5..8431956 100644
--- a/xmrstak/backend/cpu/autoAdjustHwloc.hpp
+++ b/xmrstak/backend/cpu/autoAdjustHwloc.hpp
@@ -37,7 +37,7 @@ public:
hwloc_topology_load(topology);
std::string conf;
- ConfigEditor configTpl{};
+ configEditor configTpl{};
// load the template of the backend config into a char variable
const char *tpl =
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index 6037161..d786bee 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -21,23 +21,19 @@
*
*/
-#include <assert.h>
-#include <cmath>
-#include <chrono>
-#include <cstring>
-#include <thread>
-#include <bitset>
+#include "crypto/cryptonight_aesni.h"
+
#include "xmrstak/misc/console.hpp"
#include "xmrstak/backend/iBackend.hpp"
#include "xmrstak/backend//globalStates.hpp"
#include "xmrstak/misc/configEditor.hpp"
#include "xmrstak/params.hpp"
-#include "xmrstak/jconf.hpp"
+#include "jconf.hpp"
#include "xmrstak/misc/executor.hpp"
#include "minethd.hpp"
#include "xmrstak/jconf.hpp"
-#include "xmrstak/backend/crypto/cryptonight_aesni.h"
+
#include "hwlocMemory.hpp"
#include "xmrstak/backend/miner_work.hpp"
@@ -47,6 +43,13 @@
# include "autoAdjust.hpp"
#endif
+#include <assert.h>
+#include <cmath>
+#include <chrono>
+#include <cstring>
+#include <thread>
+#include <bitset>
+
#ifdef _WIN32
#include <windows.h>
@@ -244,11 +247,11 @@ bool minethd::self_test()
return bResult;
}
-std::vector<IBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work& pWork)
+std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work& pWork)
{
- std::vector<IBackend*> pvThreads;
+ std::vector<iBackend*> pvThreads;
- if(!ConfigEditor::file_exist(Params::inst().configFileCPU))
+ if(!configEditor::file_exist(Params::inst().configFileCPU))
{
autoAdjust adjust;
if(!adjust.printConfig())
@@ -286,9 +289,9 @@ std::vector<IBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work
void minethd::consume_work()
{
- memcpy(&oWork, &GlobalStates::inst().inst().oGlobalWork, sizeof(miner_work));
+ memcpy(&oWork, &globalStates::inst().inst().oGlobalWork, sizeof(miner_work));
iJobNo++;
- GlobalStates::inst().inst().iConsumeCnt++;
+ globalStates::inst().inst().iConsumeCnt++;
}
minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch)
@@ -343,7 +346,7 @@ void minethd::work_main()
piHashVal = (uint64_t*)(result.bResult + 24);
piNonce = (uint32_t*)(oWork.bWorkBlob + 39);
- GlobalStates::inst().inst().iConsumeCnt++;
+ globalStates::inst().inst().iConsumeCnt++;
while (bQuit == 0)
{
@@ -353,7 +356,7 @@ void minethd::work_main()
either because of network latency, or a socket problem. Since we are
raison d'etre of this software it us sensible to just wait until we have something*/
- while (GlobalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
+ while (globalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
consume_work();
@@ -368,7 +371,7 @@ void minethd::work_main()
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
memcpy(result.sJobID, oWork.sJobID, sizeof(job_result::sJobID));
- while(GlobalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
+ while(globalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
{
if ((iCount & 0xF) == 0) //Store stats every 16 hashes
{
@@ -441,7 +444,7 @@ void minethd::double_work_main()
piNonce0 = (uint32_t*)(bDoubleWorkBlob + 39);
piNonce1 = nullptr;
- GlobalStates::inst().inst().iConsumeCnt++;
+ globalStates::inst().inst().iConsumeCnt++;
while (bQuit == 0)
{
@@ -451,7 +454,7 @@ void minethd::double_work_main()
either because of network latency, or a socket problem. Since we are
raison d'etre of this software it us sensible to just wait until we have something*/
- while (GlobalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
+ while (globalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
consume_work();
@@ -468,7 +471,7 @@ void minethd::double_work_main()
assert(sizeof(job_result::sJobID) == sizeof(pool_job::sJobID));
- while (GlobalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
+ while (globalStates::inst().inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
{
if ((iCount & 0x7) == 0) //Store stats every 16 hashes
{
diff --git a/xmrstak/backend/cpu/minethd.hpp b/xmrstak/backend/cpu/minethd.hpp
index 1dcca86..a091ee8 100644
--- a/xmrstak/backend/cpu/minethd.hpp
+++ b/xmrstak/backend/cpu/minethd.hpp
@@ -3,7 +3,6 @@
#include "crypto/cryptonight.h"
#include "xmrstak/backend/miner_work.hpp"
#include "xmrstak/backend/iBackend.hpp"
-#include "xmrstak/backend/globalStates.hpp"
#include <iostream>
#include <thread>
@@ -16,10 +15,10 @@ namespace xmrstak
namespace cpu
{
-class minethd : public IBackend
+class minethd : public iBackend
{
public:
- static std::vector<IBackend*> thread_starter(uint32_t threadOffset, miner_work& pWork);
+ static std::vector<iBackend*> thread_starter(uint32_t threadOffset, miner_work& pWork);
static bool self_test();
typedef void (*cn_hash_fun)(const void*, size_t, void*, cryptonight_ctx*);
@@ -36,21 +35,6 @@ private:
minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefetch, int64_t affinity);
- // We use the top 10 bits of the nonce for thread and resume
- // This allows us to resume up to 128 threads 4 times before
- // we get nonce collisions
- // Bottom 22 bits allow for an hour of work at 1000 H/s
- inline uint32_t calc_start_nonce(uint32_t resume)
- {
- return reverseBits<uint32_t>(static_cast<uint32_t>(iThreadNo + GlobalStates::inst().iThreadCount * resume));
- }
-
- // Limited version of the nonce calc above
- inline uint32_t calc_nicehash_nonce(uint32_t start, uint32_t resume)
- {
- return start | ( ( reverseBits<uint32_t>(static_cast<uint32_t>(iThreadNo + GlobalStates::inst().iThreadCount * resume)) >> 4u ) );
- }
-
void work_main();
void double_work_main();
void consume_work();
@@ -65,7 +49,6 @@ private:
std::mutex work_thd_mtx;
std::thread oWorkThd;
- uint8_t iThreadNo;
int64_t affinity;
bool bQuit;
OpenPOWER on IntegriCloud