mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 12:09:22 +00:00
Submit top benchmark diff.
This commit is contained in:
parent
e2ea11ffeb
commit
a2a0defeef
8 changed files with 17 additions and 17 deletions
|
@ -39,6 +39,7 @@ static std::shared_ptr<Async> async;
|
|||
static uint32_t remaining = 0;
|
||||
static uint64_t doneTime = 0;
|
||||
static uint64_t result = 0;
|
||||
static uint64_t topDiff = 0;
|
||||
|
||||
|
||||
IBenchListener *BenchState::m_listener = nullptr;
|
||||
|
@ -75,7 +76,7 @@ uint64_t xmrig::BenchState::start(size_t threads, const IBackend *backend)
|
|||
remaining = static_cast<uint32_t>(threads);
|
||||
|
||||
async = std::make_shared<Async>([] {
|
||||
m_listener->onBenchDone(result, doneTime);
|
||||
m_listener->onBenchDone(result, topDiff, doneTime);
|
||||
async.reset();
|
||||
xmrig::done = true;
|
||||
});
|
||||
|
@ -94,7 +95,7 @@ void xmrig::BenchState::destroy()
|
|||
}
|
||||
|
||||
|
||||
void xmrig::BenchState::done(uint64_t data, uint64_t ts)
|
||||
void xmrig::BenchState::done(uint64_t data, uint64_t diff, uint64_t ts)
|
||||
{
|
||||
assert(async && remaining > 0);
|
||||
|
||||
|
@ -102,6 +103,7 @@ void xmrig::BenchState::done(uint64_t data, uint64_t ts)
|
|||
|
||||
result ^= data;
|
||||
doneTime = std::max(doneTime, ts);
|
||||
topDiff = std::max(topDiff, diff);
|
||||
--remaining;
|
||||
|
||||
if (remaining == 0) {
|
||||
|
|
|
@ -39,7 +39,7 @@ 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 ts);
|
||||
static void done(uint64_t data, uint64_t diff, uint64_t ts);
|
||||
|
||||
inline static uint32_t size() { return m_size; }
|
||||
inline static void setListener(IBenchListener *listener) { m_listener = listener; }
|
||||
|
|
|
@ -33,6 +33,7 @@ static const std::map<int, std::map<uint32_t, uint64_t> > hashCheck = {
|
|||
{ Algorithm::RX_0, {
|
||||
# ifndef NDEBUG
|
||||
{ 10000U, 0x4A597463865ACF0EULL },
|
||||
{ 20000U, 0xC82B490C757DA738ULL },
|
||||
# endif
|
||||
{ 250000U, 0x7D6054757BB08A63ULL },
|
||||
{ 500000U, 0x96607546DE1F5ECCULL },
|
||||
|
@ -50,6 +51,7 @@ static const std::map<int, std::map<uint32_t, uint64_t> > hashCheck = {
|
|||
{ Algorithm::RX_WOW, {
|
||||
# ifndef NDEBUG
|
||||
{ 10000U, 0x6B0918757100B338ULL },
|
||||
{ 20000U, 0x0B55785C1837F41BULL },
|
||||
# endif
|
||||
{ 250000U, 0xC7F712C9603E2603ULL },
|
||||
{ 500000U, 0x21A0E5AAE6DA7D8DULL },
|
||||
|
@ -71,6 +73,7 @@ static const std::map<int, std::map<uint32_t, uint64_t> > hashCheck1T = {
|
|||
{ Algorithm::RX_0, {
|
||||
# ifndef NDEBUG
|
||||
{ 10000U, 0xADFC3A66F79BFE7FULL },
|
||||
{ 20000U, 0x8ED578A60D55C0DBULL },
|
||||
# endif
|
||||
{ 250000U, 0x90A15B799486F3EBULL },
|
||||
{ 500000U, 0xAA83118FEE570F9AULL },
|
||||
|
@ -88,6 +91,7 @@ static const std::map<int, std::map<uint32_t, uint64_t> > hashCheck1T = {
|
|||
{ Algorithm::RX_WOW, {
|
||||
# ifndef NDEBUG
|
||||
{ 10000U, 0x9EC1B9B8C8C7F082ULL },
|
||||
{ 20000U, 0xF1DA44FA2A20D730ULL },
|
||||
# endif
|
||||
{ 250000U, 0x7B409F096C863207ULL },
|
||||
{ 500000U, 0x70B7B80D15654216ULL },
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
IBenchListener() = default;
|
||||
virtual ~IBenchListener() = default;
|
||||
|
||||
virtual void onBenchDone(uint64_t result, uint64_t ts) = 0;
|
||||
virtual void onBenchDone(uint64_t result, uint64_t diff, uint64_t ts) = 0;
|
||||
virtual void onBenchStart(uint64_t ts, uint32_t threads, const IBackend *backend) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -240,17 +240,8 @@ void xmrig::CpuWorker<N>::start()
|
|||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (m_benchSize) {
|
||||
bool done = true;
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
if (current_job_nonces[i] < m_benchSize) {
|
||||
done = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Stop benchmark when all hashes have been counted
|
||||
if (done) {
|
||||
return BenchState::done(m_benchData, Chrono::steadyMSecs());;
|
||||
if (current_job_nonces[0] >= m_benchSize) {
|
||||
return BenchState::done(m_benchData, m_benchDiff, Chrono::steadyMSecs());;
|
||||
}
|
||||
|
||||
// Make each hash dependent on the previous one in single thread benchmark to prevent cheating with multiple threads
|
||||
|
@ -302,6 +293,7 @@ void xmrig::CpuWorker<N>::start()
|
|||
if (m_benchSize) {
|
||||
if (current_job_nonces[i] < m_benchSize) {
|
||||
m_benchData ^= value;
|
||||
m_benchDiff = std::max(m_benchDiff, Job::toDiff(value));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -94,6 +94,7 @@ private:
|
|||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
uint64_t m_benchData = 0;
|
||||
uint64_t m_benchDiff = 0;
|
||||
# endif
|
||||
};
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ void xmrig::BenchClient::setPool(const Pool &pool)
|
|||
}
|
||||
|
||||
|
||||
void xmrig::BenchClient::onBenchDone(uint64_t result, uint64_t ts)
|
||||
void xmrig::BenchClient::onBenchDone(uint64_t result, uint64_t diff, uint64_t ts)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (!m_token.isEmpty()) {
|
||||
|
@ -120,6 +120,7 @@ void xmrig::BenchClient::onBenchDone(uint64_t result, uint64_t ts)
|
|||
|
||||
doc.AddMember("steady_done_ts", m_doneTime, allocator);
|
||||
doc.AddMember("hash", rapidjson::Value(fmt::format("{:016X}", result).c_str(), allocator), allocator);
|
||||
doc.AddMember("diff", diff, allocator);
|
||||
doc.AddMember("backend", m_backend->toJSON(doc), allocator);
|
||||
|
||||
update(doc);
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
void setPool(const Pool &pool) override;
|
||||
|
||||
protected:
|
||||
void onBenchDone(uint64_t result, uint64_t ts) override;
|
||||
void onBenchDone(uint64_t result, uint64_t diff, uint64_t ts) override;
|
||||
void onBenchStart(uint64_t ts, uint32_t threads, const IBackend *backend) override;
|
||||
void onHttpData(const HttpData &data) override;
|
||||
void onResolved(const Dns &dns, int status) override;
|
||||
|
|
Loading…
Reference in a new issue