Merge of xmrig v6.5.0
This commit is contained in:
commit
a57d1bbbda
86 changed files with 15293 additions and 490 deletions
|
@ -24,13 +24,13 @@
|
|||
|
||||
|
||||
#include "net/JobResults.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "base/io/Async.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "base/kernel/interfaces/IAsyncListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "net/interfaces/IJobResultListener.h"
|
||||
#include "net/JobResult.h"
|
||||
#include "backend/common/Tags.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
|
@ -57,6 +57,7 @@
|
|||
|
||||
#include <cassert>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <uv.h>
|
||||
|
||||
|
@ -193,7 +194,7 @@ static void getResults(JobBundle &bundle, std::vector<JobResult> &results, uint3
|
|||
#endif
|
||||
|
||||
|
||||
class JobResultsPrivate
|
||||
class JobResultsPrivate : public IAsyncListener
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE_DEFAULT(JobResultsPrivate)
|
||||
|
@ -202,17 +203,11 @@ public:
|
|||
m_hwAES(hwAES),
|
||||
m_listener(listener)
|
||||
{
|
||||
m_async = new uv_async_t;
|
||||
m_async->data = this;
|
||||
|
||||
uv_async_init(uv_default_loop(), m_async, JobResultsPrivate::onResult);
|
||||
m_async = std::make_shared<Async>(this);
|
||||
}
|
||||
|
||||
|
||||
inline ~JobResultsPrivate()
|
||||
{
|
||||
Handle::close(m_async);
|
||||
}
|
||||
~JobResultsPrivate() override = default;
|
||||
|
||||
|
||||
inline void submit(const JobResult &result)
|
||||
|
@ -220,7 +215,7 @@ public:
|
|||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_results.push_back(result);
|
||||
|
||||
uv_async_send(m_async);
|
||||
m_async->send();
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,15 +225,16 @@ public:
|
|||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_bundles.emplace_back(job, results, count, device_index);
|
||||
|
||||
uv_async_send(m_async);
|
||||
m_async->send();
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
protected:
|
||||
inline void onAsync() override { submit(); }
|
||||
|
||||
|
||||
private:
|
||||
static void onResult(uv_async_t *handle) { static_cast<JobResultsPrivate*>(handle->data)->submit(); }
|
||||
|
||||
|
||||
# if defined(XMRIG_FEATURE_OPENCL) || defined(XMRIG_FEATURE_CUDA)
|
||||
inline void submit()
|
||||
{
|
||||
|
@ -300,7 +296,7 @@ private:
|
|||
IJobResultListener *m_listener;
|
||||
std::list<JobResult> m_results;
|
||||
std::mutex m_mutex;
|
||||
uv_async_t *m_async;
|
||||
std::shared_ptr<Async> m_async;
|
||||
|
||||
# if defined(XMRIG_FEATURE_OPENCL) || defined(XMRIG_FEATURE_CUDA)
|
||||
std::list<JobBundle> m_bundles;
|
||||
|
|
|
@ -128,14 +128,6 @@ void xmrig::Network::onActive(IStrategy *strategy, IClient *client)
|
|||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (pool.mode() == Pool::MODE_BENCHMARK) {
|
||||
m_benchSize = pool.benchSize();
|
||||
|
||||
LOG_NOTICE("%s " MAGENTA_BOLD("start benchmark ") "hashes " CYAN_BOLD("%" PRIu64 "M") " algo " WHITE_BOLD("%s") " print_time " CYAN_BOLD("%us"),
|
||||
Tags::bench(),
|
||||
pool.benchSize() / 1000000,
|
||||
client->job().algorithm().shortName(),
|
||||
m_controller->config()->printTime());
|
||||
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
@ -282,17 +274,20 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
|||
const char *scale = NetworkState::scaleDiff(diff);
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (!m_benchSize)
|
||||
if (job.benchSize()) {
|
||||
LOG_NOTICE("%s " MAGENTA_BOLD("start benchmark ") "hashes " CYAN_BOLD("%" PRIu64 "M") " algo " WHITE_BOLD("%s") " print_time " CYAN_BOLD("%us"),
|
||||
Tags::bench(),
|
||||
job.benchSize() / 1000000,
|
||||
job.algorithm().shortName(),
|
||||
m_controller->config()->printTime());
|
||||
|
||||
LOG_NOTICE("%s " WHITE_BOLD("seed ") BLACK_BOLD("%s"), Tags::bench(), job.seed().toHex().data());
|
||||
}
|
||||
else
|
||||
# endif
|
||||
{
|
||||
if (job.height()) {
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), diff, scale, job.algorithm().shortName(), job.height());
|
||||
}
|
||||
else {
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s"),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), diff, scale, job.algorithm().shortName());
|
||||
}
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), diff, scale, job.algorithm().shortName(), job.height());
|
||||
}
|
||||
|
||||
if (!donate && m_donate) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue