summaryrefslogtreecommitdiffstats
path: root/xmrstak
diff options
context:
space:
mode:
authorUnknown <fireice2@o2.pl>2017-11-14 16:42:12 +0000
committerUnknown <fireice2@o2.pl>2017-11-14 16:42:12 +0000
commit608139ccde751eb053b54e8d41899aec9208017d (patch)
tree7e0cbccce341c24016aee17e5d4fcf2e872dfb17 /xmrstak
parent8f9eb8ef2e10872344ecf4281c9a0a0946b00e4c (diff)
downloadxmr-stak-608139ccde751eb053b54e8d41899aec9208017d.zip
xmr-stak-608139ccde751eb053b54e8d41899aec9208017d.tar.gz
Pass threadno up the food chain
Diffstat (limited to 'xmrstak')
-rw-r--r--xmrstak/backend/amd/minethd.cpp2
-rw-r--r--xmrstak/backend/cpu/minethd.cpp8
-rw-r--r--xmrstak/backend/nvidia/minethd.cpp2
-rw-r--r--xmrstak/misc/executor.cpp5
-rw-r--r--xmrstak/net/jpsock.cpp2
-rw-r--r--xmrstak/net/msgstruct.hpp3
6 files changed, 12 insertions, 10 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp
index 912587b..ce62565 100644
--- a/xmrstak/backend/amd/minethd.cpp
+++ b/xmrstak/backend/amd/minethd.cpp
@@ -237,7 +237,7 @@ void minethd::work_main()
hash_fun(bWorkBlob, oWork.iWorkSize, bResult, cpu_ctx);
if ( (*((uint64_t*)(bResult + 24))) < oWork.iTarget)
- executor::inst()->push_event(ex_event(job_result(oWork.sJobID, results[i], bResult), oWork.iPoolId));
+ executor::inst()->push_event(ex_event(job_result(oWork.sJobID, results[i], bResult, iThreadNo), oWork.iPoolId));
else
executor::inst()->log_result_error("AMD Invalid Result");
}
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index 8b913cf..8b0eec1 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -354,7 +354,8 @@ void minethd::work_main()
piHashVal = (uint64_t*)(result.bResult + 24);
piNonce = (uint32_t*)(oWork.bWorkBlob + 39);
globalStates::inst().inst().iConsumeCnt++;
-
+ result.iThreadId = iThreadNo;
+
while (bQuit == 0)
{
if (oWork.bStall)
@@ -535,17 +536,16 @@ void minethd::double_work_main()
globalStates::inst().calc_start_nonce(iNonce, oWork.bNiceHash, nonce_chunk);
}
-
*piNonce0 = ++iNonce;
*piNonce1 = ++iNonce;
hash_fun(bDoubleWorkBlob, oWork.iWorkSize, bDoubleHashOut, ctx0, ctx1);
if (*piHashVal0 < oWork.iTarget)
- executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce-1, bDoubleHashOut), oWork.iPoolId));
+ executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce-1, bDoubleHashOut, iThreadNo), oWork.iPoolId));
if (*piHashVal1 < oWork.iTarget)
- executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce, bDoubleHashOut + 32), oWork.iPoolId));
+ executor::inst()->push_event(ex_event(job_result(oWork.sJobID, iNonce, bDoubleHashOut + 32, iThreadNo), oWork.iPoolId));
std::this_thread::yield();
}
diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp
index a1cafa7..e15fc56 100644
--- a/xmrstak/backend/nvidia/minethd.cpp
+++ b/xmrstak/backend/nvidia/minethd.cpp
@@ -279,7 +279,7 @@ void minethd::work_main()
hash_fun(bWorkBlob, oWork.iWorkSize, bResult, cpu_ctx);
if ( (*((uint64_t*)(bResult + 24))) < oWork.iTarget)
- executor::inst()->push_event(ex_event(job_result(oWork.sJobID, foundNonce[i], bResult), oWork.iPoolId));
+ executor::inst()->push_event(ex_event(job_result(oWork.sJobID, foundNonce[i], bResult, iThreadNo), oWork.iPoolId));
else
executor::inst()->log_result_error("NVIDIA Invalid Result");
}
diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp
index 07ab759..507d0de 100644
--- a/xmrstak/misc/executor.cpp
+++ b/xmrstak/misc/executor.cpp
@@ -400,12 +400,13 @@ void executor::on_pool_have_job(size_t pool_id, pool_job& oPoolJob)
void executor::on_miner_result(size_t pool_id, job_result& oResult)
{
jpsock* pool = pick_pool_by_id(pool_id);
+ bool is_monero = jconf::inst()->IsCurrencyMonero();
if(pool->is_dev_pool())
{
//Ignore errors silently
if(pool->is_running() && pool->is_logged_in())
- pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult);
+ pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult, pvThreads->at(oResult.iThreadId), is_monero);
return;
}
@@ -418,7 +419,7 @@ void executor::on_miner_result(size_t pool_id, job_result& oResult)
using namespace std::chrono;
size_t t_start = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
- bool bResult = pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult);
+ bool bResult = pool->cmd_submit(oResult.sJobID, oResult.iNonce, oResult.bResult, pvThreads->at(oResult.iThreadId), is_monero);
size_t t_len = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count() - t_start;
if(t_len > 0xFFFF)
diff --git a/xmrstak/net/jpsock.cpp b/xmrstak/net/jpsock.cpp
index cc88aa8..381cbce 100644
--- a/xmrstak/net/jpsock.cpp
+++ b/xmrstak/net/jpsock.cpp
@@ -599,7 +599,7 @@ bool jpsock::cmd_submit(const char* sJobId, uint32_t iNonce, const uint8_t* bRes
char sHashcount[64] = {0};
if(ext_backend)
- snprintf(sBackend, sizeof(sBackend), ",\"backend\":\"%s\"", "");
+ snprintf(sBackend, sizeof(sBackend), ",\"backend\":\"%s\"", xmrstak::iBackend::getName(bend->backendType));
if(ext_hashcount)
snprintf(sHashcount, sizeof(sHashcount), ",\"hashcount\":\"%llu\"", int_port(bend->iHashCount.load(std::memory_order_relaxed)));
diff --git a/xmrstak/net/msgstruct.hpp b/xmrstak/net/msgstruct.hpp
index 01aa76c..305f40b 100644
--- a/xmrstak/net/msgstruct.hpp
+++ b/xmrstak/net/msgstruct.hpp
@@ -30,9 +30,10 @@ struct job_result
uint8_t bResult[32];
char sJobID[64];
uint32_t iNonce;
+ uint32_t iThreadId;
job_result() {}
- job_result(const char* sJobID, uint32_t iNonce, const uint8_t* bResult) : iNonce(iNonce)
+ job_result(const char* sJobID, uint32_t iNonce, const uint8_t* bResult, uint32_t iThreadId) : iNonce(iNonce), iThreadId(iThreadId)
{
memcpy(this->sJobID, sJobID, sizeof(job_result::sJobID));
memcpy(this->bResult, bResult, sizeof(job_result::bResult));
OpenPOWER on IntegriCloud