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>;

View file

@ -211,25 +211,12 @@ void xmrig::CpuWorker<N>::start()
consumeJob();
}
uint64_t storeStatsMask = 7;
# ifdef XMRIG_ALGO_RANDOMX
bool first = true;
alignas(16) uint64_t tempHash[8] = {};
// RandomX is faster, we don't need to store stats so often
# ifndef XMRIG_ARM
if (m_job.currentJob().algorithm().family() == Algorithm::RANDOM_X) {
storeStatsMask = 63;
}
# endif
# endif
while (!Nonce::isOutdated(Nonce::CPU, m_job.sequence())) {
if ((m_count & storeStatsMask) == 0) {
storeStats();
}
const Job &job = m_job.currentJob();
if (job.algorithm().l3() != m_algorithm.l3()) {