Fixed, benchmark validation on NUMA hardware produced incorrect results in some conditions.
This commit is contained in:
parent
09b68f3cdb
commit
8686e08336
12 changed files with 78 additions and 51 deletions
|
@ -48,12 +48,11 @@ public:
|
|||
uint32_t remaining = 0;
|
||||
uint32_t size;
|
||||
uint64_t doneTime = 0;
|
||||
uint64_t result = 0;
|
||||
uint64_t topDiff = 0;
|
||||
};
|
||||
|
||||
|
||||
static BenchStatePrivate *d_ptr = nullptr;
|
||||
std::atomic<uint64_t> BenchState::m_data{};
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
@ -92,7 +91,7 @@ uint64_t xmrig::BenchState::start(size_t threads, const IBackend *backend)
|
|||
d_ptr->remaining = static_cast<uint32_t>(threads);
|
||||
|
||||
d_ptr->async = std::make_shared<Async>([] {
|
||||
d_ptr->listener->onBenchDone(d_ptr->result, d_ptr->topDiff, d_ptr->doneTime);
|
||||
d_ptr->listener->onBenchDone(m_data, 0, d_ptr->doneTime);
|
||||
|
||||
destroy();
|
||||
});
|
||||
|
@ -111,15 +110,15 @@ void xmrig::BenchState::destroy()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::BenchState::done(uint64_t data, uint64_t diff, uint64_t ts)
|
||||
void xmrig::BenchState::done()
|
||||
{
|
||||
assert(d_ptr != nullptr && d_ptr->async && d_ptr->remaining > 0);
|
||||
|
||||
const uint64_t ts = Chrono::steadyMSecs();
|
||||
|
||||
std::lock_guard<std::mutex> lock(d_ptr->mutex);
|
||||
|
||||
d_ptr->result ^= data;
|
||||
d_ptr->doneTime = std::max(d_ptr->doneTime, ts);
|
||||
d_ptr->topDiff = std::max(d_ptr->topDiff, diff);
|
||||
--d_ptr->remaining;
|
||||
|
||||
if (d_ptr->remaining == 0) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define XMRIG_BENCHSTATE_H
|
||||
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -40,9 +41,15 @@ public:
|
|||
static uint64_t referenceHash(const Algorithm &algo, uint32_t size, uint32_t threads);
|
||||
static uint64_t start(size_t threads, const IBackend *backend);
|
||||
static void destroy();
|
||||
static void done(uint64_t data, uint64_t diff, uint64_t ts);
|
||||
static void done();
|
||||
static void init(IBenchListener *listener, uint32_t size);
|
||||
static void setSize(uint32_t size);
|
||||
|
||||
inline static uint64_t data() { return m_data; }
|
||||
inline static void add(uint64_t value) { m_data.fetch_xor(value, std::memory_order_relaxed); }
|
||||
|
||||
private:
|
||||
static std::atomic<uint64_t> m_data;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue