Merge pull request #1887 from SChernykh/dev

Fixed total hashrate update
This commit is contained in:
xmrig 2020-10-10 22:07:37 +07:00 committed by GitHub
commit f85efd163c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -143,6 +143,7 @@ void xmrig::Workers<T>::tick(uint64_t)
return;
}
bool totalAvailable = true;
uint64_t totalHashCount = 0;
for (Thread<T> *handle : m_workers) {
@ -150,11 +151,16 @@ void xmrig::Workers<T>::tick(uint64_t)
uint64_t hashCount, timeStamp;
handle->worker()->getHashrateData(hashCount, timeStamp);
d_ptr->hashrate->add(handle->id() + 1, hashCount, timeStamp);
totalHashCount += handle->worker()->rawHashes();
const uint64_t n = handle->worker()->rawHashes();
if (n == 0) {
totalAvailable = false;
}
totalHashCount += n;
}
}
if (totalHashCount > 0) {
if (totalAvailable) {
d_ptr->hashrate->add(0, totalHashCount, Chrono::steadyMSecs());
}
}