mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
Pass threadno up the food chain
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user