1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-08 00:15:04 -05:00

Compare commits

...

19 Commits

Author SHA1 Message Date
XMRig
a9965c5580 v6.6.2 2020-12-01 20:51:37 +07:00
XMRig
dca6d3f1ff Merge branch 'dev' 2020-12-01 20:49:59 +07:00
xmrig
91979dc4dd Update CHANGELOG.md 2020-12-01 20:12:27 +07:00
xmrig
87195ed237 Merge pull request #1960 from SChernykh/dev
Fix RandomX init when switching to other algo and back
2020-11-30 09:20:14 +07:00
SChernykh
d557fe7f39 Fix RandomX init when switching to other algo and back 2020-11-29 22:02:48 +01:00
xmrig
13ee9d09a8 Merge pull request #1959 from SChernykh/dev
Optimized JIT compiler
2020-11-29 20:08:40 +07:00
SChernykh
f16d1837f8 Optimized JIT compiler
More branch-free code
2020-11-29 14:05:50 +01:00
XMRig
096b09bf4d Update base 2020-11-29 18:45:52 +07:00
xmrig
bbcf8e2be3 Merge pull request #1958 from SChernykh/dev
Example mining scripts to help new miners
2020-11-27 14:51:53 +07:00
SChernykh
fb9d2b9e7c Example mining scripts to help new miners 2020-11-26 19:06:46 +01:00
XMRig
58711aa666 v6.6.2-dev 2020-11-25 21:12:45 +07:00
XMRig
c7236d2cf0 Merge branch 'master' into dev 2020-11-25 21:06:58 +07:00
XMRig
25da0cba57 v6.6.1 2020-11-25 17:46:39 +07:00
XMRig
fb721edc20 Merge branch 'dev' 2020-11-25 17:46:00 +07:00
xmrig
d2a4fa367a Update CHANGELOG.md 2020-11-25 16:44:06 +07:00
XMRig
8686e08336 Fixed, benchmark validation on NUMA hardware produced incorrect results in some conditions. 2020-11-25 09:35:11 +07:00
XMRig
09b68f3cdb Added BenchStatePrivate class. 2020-11-24 17:59:40 +07:00
XMRig
05a2054057 v6.6.1-dev 2020-11-24 10:58:12 +07:00
XMRig
4e59f90495 Merge branch 'master' into dev 2020-11-24 10:57:35 +07:00
42 changed files with 311 additions and 279 deletions

View File

@@ -1,3 +1,11 @@
# v6.6.2
- [#1958](https://github.com/xmrig/xmrig/pull/1958) Added example mining scripts to help new miners.
- [#1959](https://github.com/xmrig/xmrig/pull/1959) Optimized JIT compiler.
- [#1960](https://github.com/xmrig/xmrig/pull/1960) Fixed RandomX init when switching to other algo and back.
# v6.6.1
- Fixed, benchmark validation on NUMA hardware produced incorrect results in some conditions.
# v6.6.0
- Online benchmark protocol upgraded to v2, validation not compatible with previous versions.
- Single thread benchmark now is cheat-resistant, not possible speedup it with multiple threads.

View File

@@ -212,6 +212,8 @@ if (WIN32)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/bin/WinRing0/WinRing0x64.sys" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/benchmark_1M.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/benchmark_10M.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/pool_mine_example.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/scripts/solo_mine_example.cmd" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_BUILD_TYPE STREQUAL Release)

View File

@@ -0,0 +1,19 @@
:: Example batch file for mining Monero at a pool
::
:: Format:
:: xmrig.exe -o <pool address>:<pool port> -u <pool username/wallet> -p <pool password>
::
:: Fields:
:: pool address The host name of the pool stratum or its IP address, for example pool.hashvault.pro
:: pool port The port of the pool's stratum to connect to, for example 3333. Check your pool's getting started page.
:: pool username/wallet For most pools, this is the wallet address you want to mine to. Some pools require a username
:: pool password For most pools this can be just 'x'. For pools using usernames, you may need to provide a password as configured on the pool.
::
:: List of Monero mining pools:
:: https://miningpoolstats.stream/monero
::
:: Choose pools outside of top 5 to help Monero network be more decentralized!
:: Smaller pools also often have smaller fees/payout limits.
xmrig.exe -o pool.hashvault.pro:3333 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD -p x
pause

View File

@@ -0,0 +1,15 @@
:: Example batch file for mining Monero solo
::
:: Format:
:: xmrig.exe -o <node address>:<node port> -a rx/0 -u <wallet address> --daemon
::
:: Fields:
:: node address The host name of your monerod node or its IP address. It can also be a public node with RPC enabled, for example node.xmr.to
:: node port The RPC port of your monerod node to connect to, usually 18081.
:: wallet address Check your Monero CLI or GUI wallet to see your wallet's address.
::
:: Mining solo is the best way to help Monero network be more decentralized!
:: But you will only get a payout when you find a block which can take more than a year for a single low-end PC.
xmrig.exe -o node.xmr.to:18081 -a rx/0 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD --daemon
pause

View File

@@ -33,17 +33,26 @@
namespace xmrig {
static bool done = false;
static std::mutex mutex;
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;
class BenchStatePrivate
{
public:
BenchStatePrivate(IBenchListener *listener, uint32_t size) :
listener(listener),
size(size)
{}
IBenchListener *BenchState::m_listener = nullptr;
uint32_t BenchState::m_size = 0;
IBenchListener *listener;
std::mutex mutex;
std::shared_ptr<Async> async;
uint32_t remaining = 0;
uint32_t size;
uint64_t doneTime = 0;
};
static BenchStatePrivate *d_ptr = nullptr;
std::atomic<uint64_t> BenchState::m_data{};
} // namespace xmrig
@@ -52,7 +61,13 @@ uint32_t BenchState::m_size = 0;
bool xmrig::BenchState::isDone()
{
return xmrig::done;
return d_ptr == nullptr;
}
uint32_t xmrig::BenchState::size()
{
return d_ptr ? d_ptr->size : 0U;
}
@@ -71,18 +86,18 @@ uint64_t xmrig::BenchState::referenceHash(const Algorithm &algo, uint32_t size,
uint64_t xmrig::BenchState::start(size_t threads, const IBackend *backend)
{
assert(m_listener != nullptr);
assert(d_ptr != nullptr);
remaining = static_cast<uint32_t>(threads);
d_ptr->remaining = static_cast<uint32_t>(threads);
async = std::make_shared<Async>([] {
m_listener->onBenchDone(result, topDiff, doneTime);
async.reset();
xmrig::done = true;
d_ptr->async = std::make_shared<Async>([] {
d_ptr->listener->onBenchDone(m_data, 0, d_ptr->doneTime);
destroy();
});
const uint64_t ts = Chrono::steadyMSecs();
m_listener->onBenchReady(ts, remaining, backend);
d_ptr->listener->onBenchReady(ts, d_ptr->remaining, backend);
return ts;
}
@@ -90,23 +105,39 @@ uint64_t xmrig::BenchState::start(size_t threads, const IBackend *backend)
void xmrig::BenchState::destroy()
{
xmrig::done = true;
async.reset();
delete d_ptr;
d_ptr = nullptr;
}
void xmrig::BenchState::done(uint64_t data, uint64_t diff, uint64_t ts)
void xmrig::BenchState::done()
{
assert(async && remaining > 0);
assert(d_ptr != nullptr && d_ptr->async && d_ptr->remaining > 0);
std::lock_guard<std::mutex> lock(mutex);
const uint64_t ts = Chrono::steadyMSecs();
result ^= data;
doneTime = std::max(doneTime, ts);
topDiff = std::max(topDiff, diff);
--remaining;
std::lock_guard<std::mutex> lock(d_ptr->mutex);
if (remaining == 0) {
async->send();
d_ptr->doneTime = std::max(d_ptr->doneTime, ts);
--d_ptr->remaining;
if (d_ptr->remaining == 0) {
d_ptr->async->send();
}
}
void xmrig::BenchState::init(IBenchListener *listener, uint32_t size)
{
assert(d_ptr == nullptr);
d_ptr = new BenchStatePrivate(listener, size);
}
void xmrig::BenchState::setSize(uint32_t size)
{
assert(d_ptr != nullptr);
d_ptr->size = size;
}

View File

@@ -20,6 +20,7 @@
#define XMRIG_BENCHSTATE_H
#include <atomic>
#include <cstddef>
#include <cstdint>
@@ -36,18 +37,19 @@ class BenchState
{
public:
static bool isDone();
static uint32_t size();
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 uint32_t size() { return m_size; }
inline static void setListener(IBenchListener *listener) { m_listener = listener; }
inline static void setSize(uint32_t size) { m_size = 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 IBenchListener *m_listener;
static uint32_t m_size;
static std::atomic<uint64_t> m_data;
};

View File

@@ -347,13 +347,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
const auto &cpu = d_ptr->controller->config()->cpu();
# ifdef XMRIG_FEATURE_BENCHMARK
const uint32_t benchSize = BenchState::size();
# else
constexpr uint32_t benchSize = 0;
# endif
auto threads = cpu.get(d_ptr->controller->miner(), job.algorithm(), benchSize);
auto threads = cpu.get(d_ptr->controller->miner(), job.algorithm());
if (!d_ptr->threads.empty() && d_ptr->threads.size() == threads.size() && std::equal(d_ptr->threads.begin(), d_ptr->threads.end(), threads.begin())) {
return;
}
@@ -370,7 +364,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
stop();
# ifdef XMRIG_FEATURE_BENCHMARK
if (benchSize) {
if (BenchState::size()) {
d_ptr->benchmark = std::make_shared<Benchmark>(threads.size(), this);
}
# endif

View File

@@ -113,7 +113,7 @@ size_t xmrig::CpuConfig::memPoolSize() const
}
std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, const Algorithm &algorithm, uint32_t benchSize) const
std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, const Algorithm &algorithm) const
{
std::vector<CpuLaunchData> out;
const auto &threads = m_threads.get(algorithm);
@@ -126,7 +126,7 @@ std::vector<xmrig::CpuLaunchData> xmrig::CpuConfig::get(const Miner *miner, cons
out.reserve(count);
for (const auto &thread : threads.data()) {
out.emplace_back(miner, algorithm, *this, thread, benchSize, count);
out.emplace_back(miner, algorithm, *this, thread, count);
}
return out;

View File

@@ -72,7 +72,7 @@ public:
bool isHwAES() const;
rapidjson::Value toJSON(rapidjson::Document &doc) const;
size_t memPoolSize() const;
std::vector<CpuLaunchData> get(const Miner *miner, const Algorithm &algorithm, uint32_t benchSize) const;
std::vector<CpuLaunchData> get(const Miner *miner, const Algorithm &algorithm) const;
void read(const rapidjson::Value &value);
inline bool isEnabled() const { return m_enabled; }

View File

@@ -32,7 +32,7 @@
#include <algorithm>
xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, uint32_t benchSize, size_t threads) :
xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, size_t threads) :
algorithm(algorithm),
assembly(config.assembly()),
astrobwtAVX2(config.astrobwtAVX2()),
@@ -44,7 +44,6 @@ xmrig::CpuLaunchData::CpuLaunchData(const Miner *miner, const Algorithm &algorit
affinity(thread.affinity()),
miner(miner),
threads(threads),
benchSize(benchSize),
intensity(std::min<uint32_t>(thread.intensity(), algorithm.maxIntensity()))
{
}

View File

@@ -44,7 +44,7 @@ class Miner;
class CpuLaunchData
{
public:
CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, uint32_t benchSize, size_t threads);
CpuLaunchData(const Miner *miner, const Algorithm &algorithm, const CpuConfig &config, const CpuThread &thread, size_t threads);
bool isEqual(const CpuLaunchData &other) const;
CnHash::AlgoVariant av() const;
@@ -67,7 +67,6 @@ public:
const int64_t affinity;
const Miner *miner;
const size_t threads;
const uint32_t benchSize;
const uint32_t intensity;
};

View File

@@ -62,20 +62,6 @@ namespace xmrig {
static constexpr uint32_t kReserveCount = 32768;
template<size_t N>
inline bool nextRound(WorkerJob<N> &job, uint32_t benchSize)
{
if (!job.nextRound(benchSize ? 1 : kReserveCount, 1)) {
JobResults::done(job.currentJob());
return false;
}
return true;
}
} // namespace xmrig
@@ -92,7 +78,6 @@ xmrig::CpuWorker<N>::CpuWorker(size_t id, const CpuLaunchData &data) :
m_astrobwtMaxSize(data.astrobwtMaxSize * 1000),
m_miner(data.miner),
m_threads(data.threads),
m_benchSize(data.benchSize),
m_ctx()
{
m_memory = new VirtualMemory(m_algorithm.l3() * N, data.hugePages, false, true, m_node);
@@ -241,12 +226,12 @@ void xmrig::CpuWorker<N>::start()
# ifdef XMRIG_FEATURE_BENCHMARK
if (m_benchSize) {
if (current_job_nonces[0] >= m_benchSize) {
return BenchState::done(m_benchData, m_benchDiff, Chrono::steadyMSecs());;
return BenchState::done();
}
// Make each hash dependent on the previous one in single thread benchmark to prevent cheating with multiple threads
if (m_threads == 1) {
*(uint64_t*)(m_job.blob()) ^= m_benchData;
*(uint64_t*)(m_job.blob()) ^= BenchState::data();
}
}
# endif
@@ -260,7 +245,7 @@ void xmrig::CpuWorker<N>::start()
randomx_calculate_hash_first(m_vm, tempHash, m_job.blob(), job.size());
}
if (!nextRound(m_job, m_benchSize)) {
if (!nextRound()) {
break;
}
@@ -280,7 +265,7 @@ void xmrig::CpuWorker<N>::start()
fn(job.algorithm())(m_job.blob(), job.size(), m_hash, m_ctx, job.height());
}
if (!nextRound(m_job, m_benchSize)) {
if (!nextRound()) {
break;
};
}
@@ -292,8 +277,7 @@ void xmrig::CpuWorker<N>::start()
# ifdef XMRIG_FEATURE_BENCHMARK
if (m_benchSize) {
if (current_job_nonces[i] < m_benchSize) {
m_benchData ^= value;
m_benchDiff = std::max(m_benchDiff, Job::toDiff(value));
BenchState::add(value);
}
}
else
@@ -315,6 +299,25 @@ void xmrig::CpuWorker<N>::start()
}
template<size_t N>
bool xmrig::CpuWorker<N>::nextRound()
{
# ifdef XMRIG_FEATURE_BENCHMARK
const uint32_t count = m_benchSize ? 1U : kReserveCount;
# else
constexpr uint32_t count = kReserveCount;
# endif
if (!m_job.nextRound(count, 1)) {
JobResults::done(m_job.currentJob());
return false;
}
return true;
}
template<size_t N>
bool xmrig::CpuWorker<N>::verify(const Algorithm &algorithm, const uint8_t *referenceValue)
{
@@ -395,12 +398,17 @@ void xmrig::CpuWorker<N>::consumeJob()
return;
}
m_job.add(m_miner->job(), m_benchSize ? 1 : kReserveCount, Nonce::CPU);
auto job = m_miner->job();
# ifdef XMRIG_FEATURE_BENCHMARK
m_benchData = 0;
m_benchSize = job.benchSize();
const uint32_t count = m_benchSize ? 1U : kReserveCount;
# else
constexpr uint32_t count = kReserveCount;
# endif
m_job.add(job, count, Nonce::CPU);
# ifdef XMRIG_ALGO_RANDOMX
if (m_job.currentJob().algorithm().family() == Algorithm::RANDOM_X) {
allocateRandomX_VM();

View File

@@ -68,6 +68,7 @@ private:
void allocateRandomX_VM();
# endif
bool nextRound();
bool verify(const Algorithm &algorithm, const uint8_t *referenceValue);
bool verify2(const Algorithm &algorithm, const uint8_t *referenceValue);
void allocateCnCtx();
@@ -83,18 +84,16 @@ private:
const int m_astrobwtMaxSize;
const Miner *m_miner;
const size_t m_threads;
const uint32_t m_benchSize;
cryptonight_ctx *m_ctx[N];
VirtualMemory *m_memory = nullptr;
WorkerJob<N> m_job;
# ifdef XMRIG_ALGO_RANDOMX
randomx_vm *m_vm = nullptr;
randomx_vm *m_vm = nullptr;
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
uint64_t m_benchData = 0;
uint64_t m_benchDiff = 0;
uint32_t m_benchSize = 0;
# endif
};

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -72,7 +66,7 @@ static void createVariables()
} // namespace xmrig
xmrig::String xmrig::Env::expand(const char *in)
xmrig::String xmrig::Env::expand(const char *in, const std::map<String, String> &extra)
{
# ifdef XMRIG_FEATURE_ENV
if (in == nullptr) {
@@ -96,7 +90,7 @@ xmrig::String xmrig::Env::expand(const char *in)
continue;
}
vars.insert({ var, get(m[1].str().c_str()) });
vars.insert({ var, get(m[1].str().c_str(), extra) });
}
for (const auto &kv : vars) {
@@ -118,15 +112,23 @@ xmrig::String xmrig::Env::expand(const char *in)
}
xmrig::String xmrig::Env::get(const String &name)
xmrig::String xmrig::Env::get(const String &name, const std::map<String, String> &extra)
{
# ifdef XMRIG_FEATURE_ENV
if (variables.empty()) {
createVariables();
}
if (variables.count(name)) {
return variables.at(name);
const auto it = variables.find(name);
if (it != variables.end()) {
return it->second;
}
if (!extra.empty()) {
const auto it = extra.find(name);
if (it != extra.end()) {
return it->second;
}
}
# endif

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,14 +23,17 @@
#include "base/tools/String.h"
#include <map>
namespace xmrig {
class Env
{
public:
static String expand(const char *in);
static String get(const String &name);
static String expand(const char *in, const std::map<String, String> &extra = {});
static String get(const String &name, const std::map<String, String> &extra = {});
static String hostname();
};

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,7 +46,7 @@ public:
static void setProcessPriority(int priority);
static void setThreadPriority(int priority);
static inline const char *userAgent() { return m_userAgent; }
static inline const String &userAgent() { return m_userAgent; }
static bool isOnBatteryPower();

View File

@@ -1,13 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,11 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,11 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,11 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,12 +20,18 @@
#define XMRIG_ICONSOLELISTENER_H
#include "base/tools/Object.h"
namespace xmrig {
class IConsoleListener
{
public:
XMRIG_DISABLE_COPY_MOVE(IConsoleListener)
IConsoleListener() = default;
virtual ~IConsoleListener() = default;
virtual void onConsoleCommand(char command) = 0;

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +20,9 @@
#define XMRIG_IDNSLISTENER_H
#include "base/tools/Object.h"
namespace xmrig {
@@ -35,6 +32,9 @@ class Dns;
class IDnsListener
{
public:
XMRIG_DISABLE_COPY_MOVE(IDnsListener)
IDnsListener() = default;
virtual ~IDnsListener() = default;
virtual void onResolved(const Dns &dns, int status) = 0;

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +20,9 @@
#define XMRIG_IHTTPLISTENER_H
#include "base/tools/Object.h"
namespace xmrig {
@@ -36,7 +33,10 @@ class HttpResponse;
class IHttpListener
{
public:
virtual ~IHttpListener() = default;
XMRIG_DISABLE_COPY_MOVE(IHttpListener)
IHttpListener() = default;
virtual ~IHttpListener() = default;
virtual void onHttpData(const HttpData &data) = 0;
};

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +20,9 @@
#define XMRIG_ISIGNALLISTENER_H
#include "base/tools/Object.h"
namespace xmrig {
@@ -35,7 +32,10 @@ class String;
class ISignalListener
{
public:
virtual ~ISignalListener() = default;
XMRIG_DISABLE_COPY_MOVE(ISignalListener)
ISignalListener() = default;
virtual ~ISignalListener() = default;
virtual void onSignal(int signum) = 0;
};

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +20,9 @@
#define XMRIG_ITIMERLISTENER_H
#include "base/tools/Object.h"
namespace xmrig {
@@ -35,7 +32,10 @@ class Timer;
class ITimerListener
{
public:
virtual ~ITimerListener() = default;
XMRIG_DISABLE_COPY_MOVE(ITimerListener)
ITimerListener() = default;
virtual ~ITimerListener() = default;
virtual void onTimer(const Timer *timer) = 0;
};

View File

@@ -95,7 +95,7 @@ void xmrig::HttpClient::handshake()
{
headers.insert({ "Host", host() });
headers.insert({ "Connection", "close" });
headers.insert({ "User-Agent", Platform::userAgent() });
headers.insert({ "User-Agent", Platform::userAgent().data() });
if (!body.empty()) {
headers.insert({ "Content-Length", std::to_string(body.size()) });

View File

@@ -174,6 +174,10 @@ void xmrig::Job::copy(const Job &other)
memcpy(m_rawBlob, other.m_rawBlob, sizeof(m_rawBlob));
memcpy(m_rawTarget, other.m_rawTarget, sizeof(m_rawTarget));
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
m_benchSize = other.m_benchSize;
# endif
}
@@ -205,4 +209,8 @@ void xmrig::Job::move(Job &&other)
memcpy(m_rawBlob, other.m_rawBlob, sizeof(m_rawBlob));
memcpy(m_rawTarget, other.m_rawTarget, sizeof(m_rawTarget));
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
m_benchSize = other.m_benchSize;
# endif
}

View File

@@ -111,6 +111,11 @@ public:
inline Job &operator=(const Job &other) { copy(other); return *this; }
inline Job &operator=(Job &&other) noexcept { move(std::move(other)); return *this; }
# ifdef XMRIG_FEATURE_BENCHMARK
inline uint32_t benchSize() const { return m_benchSize; }
inline void setBenchSize(uint32_t size) { m_benchSize = size; }
# endif
private:
void copy(const Job &other);
void move(Job &&other);
@@ -135,6 +140,10 @@ private:
char m_rawTarget[24]{};
String m_rawSeedHash;
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
uint32_t m_benchSize = 0;
# endif
};

View File

@@ -51,8 +51,7 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
blob[Job::kMaxSeedSize * 2] = '\0';
m_job.setSeedHash(blob.data());
BenchState::setListener(this);
BenchState::setSize(m_benchmark->size());
BenchState::init(this, m_benchmark->size());
# ifdef XMRIG_FEATURE_HTTP
if (m_benchmark->isSubmit()) {
@@ -75,6 +74,9 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
return;
}
m_job.setBenchSize(m_benchmark->size());
}
@@ -219,6 +221,8 @@ bool xmrig::BenchClient::setSeed(const char *seed)
return false;
}
m_job.setBenchSize(BenchState::size());
LOG_NOTICE("%s " WHITE_BOLD("seed ") BLACK_BOLD("%s"), tag(), seed);
return true;
@@ -286,11 +290,11 @@ void xmrig::BenchClient::onGetReply(const rapidjson::Value &value)
m_hash = strtoull(hash, nullptr, 16);
}
BenchState::setSize(Json::getUint(value, BenchConfig::kSize));
m_job.setAlgorithm(Json::getString(value, BenchConfig::kAlgo));
setSeed(Json::getString(value, BenchConfig::kSeed));
BenchState::setSize(Json::getUint(value, BenchConfig::kSize));
start();
}

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,6 +24,21 @@
#include <cctype>
xmrig::String::String(const char *str, size_t size) :
m_size(size)
{
if (str == nullptr) {
m_size = 0;
return;
}
m_data = new char[m_size + 1];
memcpy(m_data, str, m_size);
m_data[m_size] = '\0';
}
xmrig::String::String(const char *str) :
m_size(str == nullptr ? 0 : strlen(str))
{
@@ -42,17 +51,18 @@ xmrig::String::String(const char *str) :
}
xmrig::String::String(const char *str, size_t size) :
m_size(size)
xmrig::String::String(const rapidjson::Value &value)
{
if (str == nullptr) {
m_size = 0;
if (!value.IsString()) {
return;
}
if ((m_size = value.GetStringLength()) == 0) {
return;
}
m_data = new char[m_size + 1];
memcpy(m_data, str, m_size);
memcpy(m_data, value.GetString(), m_size);
m_data[m_size] = '\0';
}
@@ -103,8 +113,10 @@ rapidjson::Value xmrig::String::toJSON(rapidjson::Document &doc) const
std::vector<xmrig::String> xmrig::String::split(char sep) const
{
std::vector<xmrig::String> out;
std::vector<String> out;
if (m_size == 0) {
out.emplace_back(*this);
return out;
}

View File

@@ -1,12 +1,6 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,8 +44,9 @@ public:
inline String(char *str) : m_data(str), m_size(str == nullptr ? 0 : strlen(str)) {}
inline String(String &&other) noexcept : m_data(other.m_data), m_size(other.m_size) { other.m_data = nullptr; other.m_size = 0; }
String(const char *str);
String(const char *str, size_t size);
String(const char *str);
String(const rapidjson::Value &value);
String(const String &other);
inline ~String() { delete [] m_data; }
@@ -66,6 +61,7 @@ public:
inline bool isEmpty() const { return size() == 0; }
inline bool isNull() const { return m_data == nullptr; }
inline bool isValid() const { return m_data != nullptr; }
inline char *data() { return m_data; }
inline const char *data() const { return m_data; }
inline size_t size() const { return m_size; }
@@ -73,7 +69,7 @@ public:
inline bool operator!=(const char *str) const { return !isEqual(str); }
inline bool operator!=(const String &other) const { return !isEqual(other); }
inline bool operator<(const String &str) const { return strcmp(data(), str.data()) < 0; }
inline bool operator<(const String &str) const { return !isEmpty() && !str.isEmpty() && strcmp(data(), str.data()) < 0; }
inline bool operator==(const char *str) const { return isEqual(str); }
inline bool operator==(const String &other) const { return isEqual(other); }
inline operator const char*() const { return m_data; }

View File

@@ -163,7 +163,7 @@ public:
reply.AddMember("version", APP_VERSION, allocator);
reply.AddMember("kind", APP_KIND, allocator);
reply.AddMember("ua", StringRef(Platform::userAgent()), allocator);
reply.AddMember("ua", Platform::userAgent().toJSON(), allocator);
reply.AddMember("cpu", Cpu::toJSON(doc), allocator);
reply.AddMember("donate_level", controller->config()->pools().donateLevel(), allocator);
reply.AddMember("paused", !enabled, allocator);

View File

@@ -495,12 +495,10 @@ namespace randomx {
emit32(instr.getImm32(), code, codePos);
emitByte(0x25, code, codePos);
if (instr.getModCond() < StoreL3Condition) {
emit32(AddressMask[instr.getModMem()], code, codePos);
}
else {
emit32(ScratchpadL3Mask, code, codePos);
}
const uint32_t mask1 = AddressMask[instr.getModMem()];
const uint32_t mask2 = ScratchpadL3Mask;
emit32((instr.mod < (StoreL3Condition << 4)) ? mask1 : mask2, code, codePos);
}
FORCE_INLINE void JitCompilerX86::genAddressImm(const Instruction& instr, uint8_t* code, uint32_t& codePos) {

View File

@@ -104,10 +104,6 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu
randomx_set_scratchpad_prefetch_mode(config.scratchpadPrefetchMode());
randomx_set_huge_pages_jit(cpu.isHugePagesJit());
if (isReady(seed)) {
return true;
}
if (!msrInitialized) {
msrEnabled = msrInit(config, cpu.threads().get(seed.algorithm()).data());
msrInitialized = true;
@@ -121,6 +117,10 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu
osInitialized = true;
}
if (isReady(seed)) {
return true;
}
d_ptr->queue.enqueue(seed, config.nodeset(), config.threads(cpu.limit()), cpu.isHugePages(), config.isOneGbPages(), config.mode(), cpu.priority());
return false;

View File

@@ -28,7 +28,7 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "XMRig miner"
#define APP_VERSION "6.6.0"
#define APP_VERSION "6.6.2"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com"
@@ -36,7 +36,7 @@
#define APP_VER_MAJOR 6
#define APP_VER_MINOR 6
#define APP_VER_PATCH 0
#define APP_VER_PATCH 2
#ifdef _MSC_VER
# if (_MSC_VER >= 1920)