CPU: use raw counter

This commit is contained in:
cohcho 2020-10-10 13:28:14 +00:00
parent 87a54766eb
commit 4a74ce3242
3 changed files with 25 additions and 13 deletions

View file

@ -160,6 +160,29 @@ void xmrig::Workers<T>::tick(uint64_t)
}
template<>
void xmrig::Workers<xmrig::CpuLaunchData>::tick(uint64_t)
{
if (!d_ptr->hashrate) {
return;
}
const uint64_t timestamp = Chrono::steadyMSecs();
uint64_t totalHashCount = 0;
for (Thread<CpuLaunchData> *handle : m_workers) {
if (handle->worker()) {
const uint64_t hashCount = handle->worker()->rawHashes();
d_ptr->hashrate->add(handle->id() + 1, hashCount, timestamp);
totalHashCount += hashCount;
}
}
if (totalHashCount > 0) {
d_ptr->hashrate->add(0, totalHashCount, timestamp);
}
}
template<class T>
xmrig::IWorker *xmrig::Workers<T>::create(Thread<T> *)
{

View file

@ -88,6 +88,8 @@ void xmrig::Workers<T>::jobEarlyNotification(const Job& job)
template<>
IWorker *Workers<CpuLaunchData>::create(Thread<CpuLaunchData> *handle);
template<>
void Workers<CpuLaunchData>::tick(uint64_t);
extern template class Workers<CpuLaunchData>;