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