mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-06 23:52:38 -05:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ceacbbfd0 | ||
|
|
c18a0152dd | ||
|
|
3bbe3fa481 | ||
|
|
4d6b384c16 | ||
|
|
e4283d5f53 | ||
|
|
3b6cfd9c4f | ||
|
|
a076f739e3 | ||
|
|
4cdea633bf | ||
|
|
e3727f01b8 | ||
|
|
837bd1a43c | ||
|
|
eb36d2beef | ||
|
|
f08887180d | ||
|
|
95d3293f4b | ||
|
|
44054ac7eb | ||
|
|
057fbf7608 | ||
|
|
a64ff6b7c7 | ||
|
|
673c366f77 | ||
|
|
c8c0abdb00 | ||
|
|
0a183a59c0 | ||
|
|
3f7cf2ac18 | ||
|
|
d97b5a7552 | ||
|
|
cbd0c45c2b | ||
|
|
e5fd83554b | ||
|
|
c9e17780e7 | ||
|
|
5df1686810 | ||
|
|
1e3e8ff8ee | ||
|
|
d4750239ea | ||
|
|
99e9073993 | ||
|
|
51690ebad6 | ||
|
|
5ac908c027 | ||
|
|
f1a24b7ddd | ||
|
|
f977b31331 | ||
|
|
80b980c9d3 |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
||||
# v6.5.2
|
||||
- [#1935](https://github.com/xmrig/xmrig/pull/1935) Separate MSR mod for Zen/Zen2 and Zen3.
|
||||
- [#1937](https://github.com/xmrig/xmrig/issues/1937) Print path to existing WinRing0 service without verbose option.
|
||||
- [#1939](https://github.com/xmrig/xmrig/pull/1939) Fixed build with gcc 4.8.
|
||||
- [#1941](https://github.com/xmrig/xmrig/pull/1941) Added CPUID info to JSON report.
|
||||
- [#1941](https://github.com/xmrig/xmrig/pull/1942) Fixed alignment modification in memory pool.
|
||||
- [#1944](https://github.com/xmrig/xmrig/pull/1944) Updated `randomx_boost.sh` with new MSR mod.
|
||||
- Added `250K` and `500K` offline benchmarks.
|
||||
|
||||
# v6.5.1
|
||||
- [#1932](https://github.com/xmrig/xmrig/pull/1932) New MSR mod for Ryzen, up to +3.5% on Zen2 and +1-2% on Zen3.
|
||||
- [#1918](https://github.com/xmrig/xmrig/issues/1918) Fixed 1GB huge pages support on ARMv8.
|
||||
- [#1926](https://github.com/xmrig/xmrig/pull/1926) Fixed compilation on ARMv8 with GCC 9.3.0.
|
||||
- [#1929](https://github.com/xmrig/xmrig/issues/1929) Fixed build without HTTP.
|
||||
|
||||
# v6.5.0
|
||||
- **Added [online benchmark](https://xmrig.com/benchmark) mode for sharing results.**
|
||||
- Added new command line options: `--submit`, ` --verify=ID`, ` --seed=SEED`, `--hash=HASH`.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
[](https://github.com/xmrig/xmrig/stargazers)
|
||||
[](https://github.com/xmrig/xmrig/network)
|
||||
|
||||
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and AstroBWT unified CPU/GPU miner. Official binaries are available for Windows, Linux, macOS and FreeBSD.
|
||||
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and AstroBWT unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD.
|
||||
|
||||
## Mining backends
|
||||
- **CPU** (x64/ARMv8)
|
||||
|
||||
@@ -4,12 +4,22 @@ modprobe msr
|
||||
|
||||
if cat /proc/cpuinfo | grep "AMD Ryzen" > /dev/null;
|
||||
then
|
||||
echo "Detected Ryzen"
|
||||
wrmsr -a 0xc0011022 0x510000
|
||||
wrmsr -a 0xc001102b 0x1808cc16
|
||||
wrmsr -a 0xc0011020 0
|
||||
wrmsr -a 0xc0011021 0x40
|
||||
echo "MSR register values for Ryzen applied"
|
||||
if cat /proc/cpuinfo | grep "cpu family[[:space:]]:[[:space:]]25" > /dev/null;
|
||||
then
|
||||
echo "Detected Ryzen (Zen3)"
|
||||
wrmsr -a 0xc0011020 0x4480000000000
|
||||
wrmsr -a 0xc0011021 0x1c000200000040
|
||||
wrmsr -a 0xc0011022 0xc000000401500000
|
||||
wrmsr -a 0xc001102b 0x2000cc14
|
||||
echo "MSR register values for Ryzen (Zen3) applied"
|
||||
else
|
||||
echo "Detected Ryzen (Zen1/Zen2)"
|
||||
wrmsr -a 0xc0011020 0
|
||||
wrmsr -a 0xc0011021 0x40
|
||||
wrmsr -a 0xc0011022 0x1510000
|
||||
wrmsr -a 0xc001102b 0x2000cc16
|
||||
echo "MSR register values for Ryzen (Zen1/Zen2) applied"
|
||||
fi
|
||||
elif cat /proc/cpuinfo | grep "Intel" > /dev/null;
|
||||
then
|
||||
echo "Detected Intel"
|
||||
|
||||
@@ -37,9 +37,35 @@
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static uint64_t hashCheck[2][10] = {
|
||||
{ 0x898B6E0431C28A6BULL, 0xEE9468F8B40926BCULL, 0xC2BC5D11724813C0ULL, 0x3A2C7B285B87F941ULL, 0x3B5BD2C3A16B450EULL, 0x5CD0602F20C5C7C4ULL, 0x101DE939474B6812ULL, 0x52B765A1B156C6ECULL, 0x323935102AB6B45CULL, 0xB5231262E2792B26ULL },
|
||||
{ 0x0F3E5400B39EA96AULL, 0x85944CCFA2752D1FULL, 0x64AFFCAE991811BAULL, 0x3E4D0B836D3B13BAULL, 0xEB7417D621271166ULL, 0x97FFE10C0949FFA5ULL, 0x84CAC0F8879A4BA1ULL, 0xA1B79F031DA2459FULL, 0x9B65226DA873E65DULL, 0x0F9E00C5A511C200ULL },
|
||||
static const std::map<int, std::map<uint32_t, uint64_t> > hashCheck = {
|
||||
{ Algorithm::RX_0, {
|
||||
{ 250000U, 0x7D6054757BB08A63ULL },
|
||||
{ 500000U, 0x96607546DE1F5ECCULL },
|
||||
{ 1000000U, 0x898B6E0431C28A6BULL },
|
||||
{ 2000000U, 0xEE9468F8B40926BCULL },
|
||||
{ 3000000U, 0xC2BC5D11724813C0ULL },
|
||||
{ 4000000U, 0x3A2C7B285B87F941ULL },
|
||||
{ 5000000U, 0x3B5BD2C3A16B450EULL },
|
||||
{ 6000000U, 0x5CD0602F20C5C7C4ULL },
|
||||
{ 7000000U, 0x101DE939474B6812ULL },
|
||||
{ 8000000U, 0x52B765A1B156C6ECULL },
|
||||
{ 9000000U, 0x323935102AB6B45CULL },
|
||||
{ 10000000U, 0xB5231262E2792B26ULL }
|
||||
}},
|
||||
{ Algorithm::RX_WOW, {
|
||||
{ 250000U, 0xC7F712C9603E2603ULL },
|
||||
{ 500000U, 0x21A0E5AAE6DA7D8DULL },
|
||||
{ 1000000U, 0x0F3E5400B39EA96AULL },
|
||||
{ 2000000U, 0x85944CCFA2752D1FULL },
|
||||
{ 3000000U, 0x64AFFCAE991811BAULL },
|
||||
{ 4000000U, 0x3E4D0B836D3B13BAULL },
|
||||
{ 5000000U, 0xEB7417D621271166ULL },
|
||||
{ 6000000U, 0x97FFE10C0949FFA5ULL },
|
||||
{ 7000000U, 0x84CAC0F8879A4BA1ULL },
|
||||
{ 8000000U, 0xA1B79F031DA2459FULL },
|
||||
{ 9000000U, 0x9B65226DA873E65DULL },
|
||||
{ 10000000U, 0x0F9E00C5A511C200ULL }
|
||||
}}
|
||||
};
|
||||
|
||||
|
||||
@@ -55,9 +81,11 @@ xmrig::Benchmark::Benchmark(const Job &job, size_t workers, const IBackend *back
|
||||
m_end(job.benchSize()),
|
||||
m_hash(job.benchHash())
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (!m_token.isEmpty()) {
|
||||
m_httpListener = std::make_shared<HttpListener>(this, Tags::bench());
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +104,7 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
|
||||
|
||||
LOG_NOTICE("%s " WHITE_BOLD("benchmark finished in ") CYAN_BOLD("%.3f seconds") WHITE_BOLD_S " hash sum = " CLEAR "%s%016" PRIX64 CLEAR, Tags::bench(), dt, color, m_data);
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (!m_token.isEmpty()) {
|
||||
using namespace rapidjson;
|
||||
|
||||
@@ -88,7 +117,9 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
|
||||
|
||||
send(doc);
|
||||
}
|
||||
else {
|
||||
else
|
||||
# endif
|
||||
{
|
||||
printExit();
|
||||
}
|
||||
|
||||
@@ -100,6 +131,7 @@ void xmrig::Benchmark::start()
|
||||
{
|
||||
m_startTime = Chrono::steadyMSecs();
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (!m_token.isEmpty()) {
|
||||
using namespace rapidjson;
|
||||
|
||||
@@ -108,6 +140,7 @@ void xmrig::Benchmark::start()
|
||||
|
||||
send(doc);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +178,7 @@ void xmrig::Benchmark::tick(IWorker *worker)
|
||||
|
||||
void xmrig::Benchmark::onHttpData(const HttpData &data)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
rapidjson::Document doc;
|
||||
|
||||
try {
|
||||
@@ -161,6 +195,7 @@ void xmrig::Benchmark::onHttpData(const HttpData &data)
|
||||
LOG_NOTICE("%s " WHITE_BOLD("benchmark submitted ") CYAN_BOLD("https://xmrig.com/benchmark/%s"), Tags::bench(), m_id.data());
|
||||
printExit();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -170,16 +205,19 @@ uint64_t xmrig::Benchmark::referenceHash() const
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (!m_token.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
# endif
|
||||
|
||||
const uint32_t N = (m_end / 1000000) - 1;
|
||||
if (((m_algo == Algorithm::RX_0) || (m_algo == Algorithm::RX_WOW)) && ((m_end % 1000000) == 0) && (N < 10)) {
|
||||
return hashCheck[(m_algo == Algorithm::RX_0) ? 0 : 1][N];
|
||||
}
|
||||
uint64_t hash = 0;
|
||||
|
||||
return 0;
|
||||
try {
|
||||
hash = hashCheck.at(m_algo).at(m_end);
|
||||
} catch (const std::exception &ex) {}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,6 +227,7 @@ void xmrig::Benchmark::printExit()
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_HTTP
|
||||
void xmrig::Benchmark::send(const rapidjson::Value &body)
|
||||
{
|
||||
FetchRequest req(HTTP_PATCH, BenchConfig::kApiHost, BenchConfig::kApiPort, fmt::format("/1/benchmark/{}", m_id).c_str(), body, BenchConfig::kApiTLS, true);
|
||||
@@ -202,3 +241,4 @@ void xmrig::Benchmark::setError(const char *message)
|
||||
{
|
||||
LOG_ERR("%s " RED("benchmark failed ") RED_BOLD("\"%s\""), Tags::bench(), message);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -56,8 +56,11 @@ protected:
|
||||
private:
|
||||
uint64_t referenceHash() const;
|
||||
void printExit();
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
void send(const rapidjson::Value &body);
|
||||
void setError(const char *message);
|
||||
# endif
|
||||
|
||||
bool m_reset = false;
|
||||
const Algorithm m_algo;
|
||||
|
||||
@@ -48,7 +48,8 @@ public:
|
||||
|
||||
enum MsrMod : uint32_t {
|
||||
MSR_MOD_NONE,
|
||||
MSR_MOD_RYZEN,
|
||||
MSR_MOD_RYZEN_17H,
|
||||
MSR_MOD_RYZEN_19H,
|
||||
MSR_MOD_INTEL,
|
||||
MSR_MOD_CUSTOM,
|
||||
MSR_MOD_MAX
|
||||
|
||||
@@ -189,15 +189,32 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
|
||||
memcpy(vendor + 4, &data[3], 4);
|
||||
memcpy(vendor + 8, &data[2], 4);
|
||||
|
||||
cpuid(PROCESSOR_INFO, data);
|
||||
|
||||
m_procInfo = data[EAX_Reg];
|
||||
m_family = get_masked(m_procInfo, 12, 8) + get_masked(m_procInfo, 28, 20);
|
||||
m_model = (get_masked(m_procInfo, 20, 16) << 4) | get_masked(m_procInfo, 8, 4);
|
||||
m_stepping = get_masked(m_procInfo, 4, 0);
|
||||
|
||||
if (memcmp(vendor, "AuthenticAMD", 12) == 0) {
|
||||
m_vendor = VENDOR_AMD;
|
||||
|
||||
cpuid(PROCESSOR_INFO, data);
|
||||
const int32_t family = get_masked(data[EAX_Reg], 12, 8) + get_masked(data[EAX_Reg], 28, 20);
|
||||
|
||||
if (family >= 23) {
|
||||
if (m_family >= 0x17) {
|
||||
m_assembly = Assembly::RYZEN;
|
||||
m_msrMod = MSR_MOD_RYZEN;
|
||||
|
||||
switch (m_family) {
|
||||
case 0x17:
|
||||
m_msrMod = MSR_MOD_RYZEN_17H;
|
||||
break;
|
||||
|
||||
case 0x19:
|
||||
m_msrMod = MSR_MOD_RYZEN_19H;
|
||||
break;
|
||||
|
||||
default:
|
||||
m_msrMod = MSR_MOD_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_assembly = Assembly::BULLDOZER;
|
||||
@@ -220,7 +237,6 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
|
||||
unsigned int reserved2 : 4;
|
||||
} processor_info;
|
||||
|
||||
cpuid(1, data);
|
||||
memcpy(&processor_info, data, sizeof(processor_info));
|
||||
|
||||
// Intel JCC erratum mitigation
|
||||
@@ -314,6 +330,10 @@ rapidjson::Value xmrig::BasicCpuInfo::toJSON(rapidjson::Document &doc) const
|
||||
Value out(kObjectType);
|
||||
|
||||
out.AddMember("brand", StringRef(brand()), allocator);
|
||||
out.AddMember("family", m_family, allocator);
|
||||
out.AddMember("model", m_model, allocator);
|
||||
out.AddMember("stepping", m_stepping, allocator);
|
||||
out.AddMember("proc_info", m_procInfo, allocator);
|
||||
out.AddMember("aes", hasAES(), allocator);
|
||||
out.AddMember("avx2", hasAVX2(), allocator);
|
||||
out.AddMember("x64", isX64(), allocator);
|
||||
|
||||
@@ -70,6 +70,10 @@ protected:
|
||||
bool m_jccErratum = false;
|
||||
|
||||
private:
|
||||
uint32_t m_procInfo = 0;
|
||||
uint32_t m_family = 0;
|
||||
uint32_t m_model = 0;
|
||||
uint32_t m_stepping = 0;
|
||||
Assembly m_assembly = Assembly::NONE;
|
||||
MsrMod m_msrMod = MSR_MOD_NONE;
|
||||
std::bitset<FLAG_MAX> m_flags;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <thread>
|
||||
|
||||
|
||||
@@ -66,6 +67,8 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
|
||||
if (!name.isNull()) {
|
||||
strncpy(m_brand, name, sizeof(m_brand) - 1);
|
||||
}
|
||||
|
||||
m_flags.set(FLAG_PDPE1GB, std::ifstream("/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages").good());
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ public:
|
||||
BenchVerifyKey = 1045,
|
||||
BenchSeedKey = 1046,
|
||||
BenchHashKey = 1047,
|
||||
BenchTokenKey = 1048,
|
||||
|
||||
// xmrig common
|
||||
CPUPriorityKey = 1021,
|
||||
|
||||
@@ -70,6 +70,16 @@ bool xmrig::Pools::isEqual(const Pools &other) const
|
||||
}
|
||||
|
||||
|
||||
int xmrig::Pools::donateLevel() const
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
return benchSize() || (m_benchmark && !m_benchmark->id().isEmpty()) ? 0 : m_donateLevel;
|
||||
# else
|
||||
return m_donateLevel;
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
xmrig::IStrategy *xmrig::Pools::createStrategy(IStrategyListener *listener) const
|
||||
{
|
||||
if (active() == 1) {
|
||||
@@ -184,6 +194,27 @@ void xmrig::Pools::print() const
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pools::toJSON(rapidjson::Value &out, rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (m_benchmark) {
|
||||
out.AddMember(StringRef(BenchConfig::kBenchmark), m_benchmark->toJSON(doc), allocator);
|
||||
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
doc.AddMember(StringRef(kDonateLevel), m_donateLevel, allocator);
|
||||
doc.AddMember(StringRef(kDonateOverProxy), m_proxyDonate, allocator);
|
||||
out.AddMember(StringRef(kPools), toJSON(doc), allocator);
|
||||
doc.AddMember(StringRef(kRetries), retries(), allocator);
|
||||
doc.AddMember(StringRef(kRetryPause), retryPause(), allocator);
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Pools::setDonateLevel(int level)
|
||||
{
|
||||
if (level >= kMinimumDonateLevel && level <= 99) {
|
||||
|
||||
@@ -58,7 +58,6 @@ public:
|
||||
Pools();
|
||||
|
||||
inline const std::vector<Pool> &data() const { return m_data; }
|
||||
inline int donateLevel() const { return benchSize() ? 0 : m_donateLevel; }
|
||||
inline int retries() const { return m_retries; }
|
||||
inline int retryPause() const { return m_retryPause; }
|
||||
inline ProxyDonate proxyDonate() const { return m_proxyDonate; }
|
||||
@@ -67,12 +66,14 @@ public:
|
||||
inline bool operator==(const Pools &other) const { return isEqual(other); }
|
||||
|
||||
bool isEqual(const Pools &other) const;
|
||||
int donateLevel() const;
|
||||
IStrategy *createStrategy(IStrategyListener *listener) const;
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
size_t active() const;
|
||||
uint32_t benchSize() const;
|
||||
void load(const IJsonReader &reader);
|
||||
void print() const;
|
||||
void toJSON(rapidjson::Value &out, rapidjson::Document &doc) const;
|
||||
|
||||
private:
|
||||
void setDonateLevel(int level);
|
||||
|
||||
@@ -35,8 +35,6 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
|
||||
m_listener(listener),
|
||||
m_benchmark(benchmark)
|
||||
{
|
||||
m_httpListener = std::make_shared<HttpListener>(this, Tags::bench());
|
||||
|
||||
std::vector<char> blob(112 * 2 + 1, '0');
|
||||
blob.back() = '\0';
|
||||
|
||||
@@ -47,6 +45,7 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
|
||||
m_job.setBenchSize(m_benchmark->size());
|
||||
m_job.setBenchHash(m_benchmark->hash());
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
if (m_benchmark->isSubmit()) {
|
||||
m_mode = ONLINE_BENCH;
|
||||
|
||||
@@ -55,10 +54,12 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
|
||||
|
||||
if (!m_benchmark->id().isEmpty()) {
|
||||
m_job.setId(m_benchmark->id());
|
||||
m_job.setBenchToken(m_benchmark->token());
|
||||
m_mode = ONLINE_VERIFY;
|
||||
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
m_job.setId("00000000");
|
||||
|
||||
@@ -74,7 +75,8 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
|
||||
|
||||
|
||||
void xmrig::BenchClient::connect()
|
||||
{
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
switch (m_mode) {
|
||||
case STATIC_BENCH:
|
||||
case STATIC_VERIFY:
|
||||
@@ -86,6 +88,9 @@ void xmrig::BenchClient::connect()
|
||||
case ONLINE_VERIFY:
|
||||
return getBench();
|
||||
}
|
||||
# else
|
||||
start();
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +102,7 @@ void xmrig::BenchClient::setPool(const Pool &pool)
|
||||
|
||||
void xmrig::BenchClient::onHttpData(const HttpData &data)
|
||||
{
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
rapidjson::Document doc;
|
||||
|
||||
try {
|
||||
@@ -115,11 +121,23 @@ void xmrig::BenchClient::onHttpData(const HttpData &data)
|
||||
else {
|
||||
startVerify(doc);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
|
||||
void xmrig::BenchClient::start()
|
||||
{
|
||||
m_listener->onLoginSuccess(this);
|
||||
m_listener->onJobReceived(this, m_job, rapidjson::Value());
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_HTTP
|
||||
void xmrig::BenchClient::createBench()
|
||||
{
|
||||
createHttpListener();
|
||||
|
||||
using namespace rapidjson;
|
||||
|
||||
Document doc(kObjectType);
|
||||
@@ -135,8 +153,18 @@ void xmrig::BenchClient::createBench()
|
||||
}
|
||||
|
||||
|
||||
void xmrig::BenchClient::createHttpListener()
|
||||
{
|
||||
if (!m_httpListener) {
|
||||
m_httpListener = std::make_shared<HttpListener>(this, Tags::bench());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::BenchClient::getBench()
|
||||
{
|
||||
createHttpListener();
|
||||
|
||||
FetchRequest req(HTTP_GET, BenchConfig::kApiHost, BenchConfig::kApiPort, fmt::format("/1/benchmark/{}", m_job.id()).c_str(), BenchConfig::kApiTLS, true);
|
||||
fetch(std::move(req), m_httpListener);
|
||||
}
|
||||
@@ -148,13 +176,6 @@ void xmrig::BenchClient::setError(const char *message)
|
||||
}
|
||||
|
||||
|
||||
void xmrig::BenchClient::start()
|
||||
{
|
||||
m_listener->onLoginSuccess(this);
|
||||
m_listener->onJobReceived(this, m_job, rapidjson::Value());
|
||||
}
|
||||
|
||||
|
||||
void xmrig::BenchClient::startBench(const rapidjson::Value &value)
|
||||
{
|
||||
m_job.setId(Json::getString(value, BenchConfig::kId));
|
||||
@@ -178,3 +199,4 @@ void xmrig::BenchClient::startVerify(const rapidjson::Value &value)
|
||||
|
||||
start();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -75,12 +75,16 @@ private:
|
||||
ONLINE_VERIFY
|
||||
};
|
||||
|
||||
void start();
|
||||
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
void createBench();
|
||||
void createHttpListener();
|
||||
void getBench();
|
||||
void setError(const char *message);
|
||||
void start();
|
||||
void startBench(const rapidjson::Value &value);
|
||||
void startVerify(const rapidjson::Value &value);
|
||||
# endif
|
||||
|
||||
IClientListener* m_listener;
|
||||
Job m_job;
|
||||
|
||||
@@ -57,6 +57,7 @@ xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson
|
||||
m_submit(Json::getBool(object, kSubmit)),
|
||||
m_id(id),
|
||||
m_seed(Json::getString(object, kSeed)),
|
||||
m_token(Json::getString(object, kToken)),
|
||||
m_size(size),
|
||||
m_hash(0)
|
||||
{
|
||||
@@ -88,16 +89,53 @@ xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object)
|
||||
}
|
||||
|
||||
|
||||
rapidjson::Value xmrig::BenchConfig::toJSON(rapidjson::Document &doc) const
|
||||
{
|
||||
using namespace rapidjson;
|
||||
Value out(kObjectType);
|
||||
auto &allocator = doc.GetAllocator();
|
||||
|
||||
if (m_size == 0) {
|
||||
out.AddMember(StringRef(kSize), 0U, allocator);
|
||||
}
|
||||
else if (m_size < 1000000) {
|
||||
out.AddMember(StringRef(kSize), Value(fmt::format("{}K", m_size / 1000).c_str(), allocator), allocator);
|
||||
}
|
||||
else {
|
||||
out.AddMember(StringRef(kSize), Value(fmt::format("{}M", m_size / 1000000).c_str(), allocator), allocator);
|
||||
}
|
||||
|
||||
out.AddMember(StringRef(kAlgo), m_algorithm.toJSON(), allocator);
|
||||
out.AddMember(StringRef(kSubmit), m_submit, allocator);
|
||||
out.AddMember(StringRef(kVerify), m_id.toJSON(), allocator);
|
||||
out.AddMember(StringRef(kToken), m_token.toJSON(), allocator);
|
||||
out.AddMember(StringRef(kSeed), m_seed.toJSON(), allocator);
|
||||
|
||||
if (m_hash) {
|
||||
out.AddMember(StringRef(kHash), Value(fmt::format("{:016X}", m_hash).c_str(), allocator), allocator);
|
||||
}
|
||||
else {
|
||||
out.AddMember(StringRef(kHash), kNullType, allocator);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
uint32_t xmrig::BenchConfig::getSize(const char *benchmark)
|
||||
{
|
||||
if (!benchmark) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const auto size = strtoul(benchmark, nullptr, 10);
|
||||
if (size < 1 || size > 10) {
|
||||
return false;
|
||||
if (size >= 1 && size <= 10) {
|
||||
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;
|
||||
}
|
||||
|
||||
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;
|
||||
if (size == 250 || size == 500) {
|
||||
return strcasecmp(benchmark, fmt::format("{}K", size).c_str()) == 0 ? size * 1000 : 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -57,9 +57,12 @@ public:
|
||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||
inline const String &id() const { return m_id; }
|
||||
inline const String &seed() const { return m_seed; }
|
||||
inline const String &token() const { return m_token; }
|
||||
inline uint32_t size() const { return m_size; }
|
||||
inline uint64_t hash() const { return m_hash; }
|
||||
|
||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||
|
||||
private:
|
||||
static uint32_t getSize(const char *benchmark);
|
||||
|
||||
@@ -67,6 +70,7 @@ private:
|
||||
bool m_submit;
|
||||
String m_id;
|
||||
String m_seed;
|
||||
String m_token;
|
||||
uint32_t m_size;
|
||||
uint64_t m_hash;
|
||||
};
|
||||
|
||||
@@ -228,16 +228,14 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
|
||||
doc.AddMember(StringRef(kCuda), cuda().toJSON(doc), allocator);
|
||||
# endif
|
||||
|
||||
doc.AddMember(StringRef(Pools::kDonateLevel), m_pools.donateLevel(), allocator);
|
||||
doc.AddMember(StringRef(Pools::kDonateOverProxy), m_pools.proxyDonate(), allocator);
|
||||
doc.AddMember(StringRef(kLogFile), m_logFile.toJSON(), allocator);
|
||||
doc.AddMember(StringRef(Pools::kPools), m_pools.toJSON(doc), allocator);
|
||||
|
||||
m_pools.toJSON(doc, doc);
|
||||
|
||||
doc.AddMember(StringRef(kPrintTime), printTime(), allocator);
|
||||
# if defined(XMRIG_FEATURE_NVML) || defined (XMRIG_FEATURE_ADL)
|
||||
doc.AddMember(StringRef(kHealthPrintTime), healthPrintTime(), allocator);
|
||||
# endif
|
||||
doc.AddMember(StringRef(Pools::kRetries), m_pools.retries(), allocator);
|
||||
doc.AddMember(StringRef(Pools::kRetryPause), m_pools.retryPause(), allocator);
|
||||
doc.AddMember(StringRef(kSyslog), isSyslog(), allocator);
|
||||
|
||||
# ifdef XMRIG_FEATURE_TLS
|
||||
|
||||
@@ -257,6 +257,7 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
||||
case IConfig::StressKey: /* --stress */
|
||||
case IConfig::BenchSubmitKey: /* --submit */
|
||||
case IConfig::BenchVerifyKey: /* --verify */
|
||||
case IConfig::BenchTokenKey: /* --token */
|
||||
case IConfig::BenchSeedKey: /* --seed */
|
||||
case IConfig::BenchHashKey: /* --hash */
|
||||
return transformBenchmark(doc, key, arg);
|
||||
@@ -333,6 +334,9 @@ void xmrig::ConfigTransform::transformBenchmark(rapidjson::Document &doc, int ke
|
||||
case IConfig::BenchVerifyKey: /* --verify */
|
||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kVerify, arg);
|
||||
|
||||
case IConfig::BenchTokenKey: /* --token */
|
||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kToken, arg);
|
||||
|
||||
case IConfig::BenchSeedKey: /* --seed */
|
||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kSeed, arg);
|
||||
|
||||
|
||||
@@ -100,8 +100,11 @@ static const option options[] = {
|
||||
{ "stress", 0, nullptr, IConfig::StressKey },
|
||||
{ "bench", 1, nullptr, IConfig::BenchKey },
|
||||
{ "benchmark", 1, nullptr, IConfig::BenchKey },
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
{ "submit", 0, nullptr, IConfig::BenchSubmitKey },
|
||||
{ "verify", 1, nullptr, IConfig::BenchVerifyKey },
|
||||
{ "token", 1, nullptr, IConfig::BenchTokenKey },
|
||||
# endif
|
||||
{ "seed", 1, nullptr, IConfig::BenchSeedKey },
|
||||
{ "hash", 1, nullptr, IConfig::BenchHashKey },
|
||||
# endif
|
||||
|
||||
@@ -182,8 +182,10 @@ static inline const std::string &usage()
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
u += " --stress run continuous stress test to check system stability\n";
|
||||
u += " --bench=N run benchmark, N can be between 1M and 10M\n";
|
||||
# ifdef XMRIG_FEATURE_HTTP
|
||||
u += " --submit perform an online benchmark and submit result for sharing\n";
|
||||
u += " --verify=ID verify submitted benchmark by ID\n";
|
||||
# endif
|
||||
u += " --seed=SEED custom RandomX seed for benchmark\n";
|
||||
u += " --hash=HASH compare benchmark result with specified hash\n";
|
||||
# endif
|
||||
|
||||
@@ -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
|
||||
@@ -22,19 +16,17 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
//#include <iostream>
|
||||
|
||||
#include "crypto/common/LinuxMemory.h"
|
||||
#include "3rdparty/fmt/core.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "crypto/common/VirtualMemory.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -47,7 +39,7 @@ constexpr size_t oneGiB = 1024U * 1024U * 1024U;
|
||||
|
||||
static inline std::string sysfs_path(uint32_t node, bool oneGbPages, bool nr)
|
||||
{
|
||||
return "/sys/devices/system/node/node" + std::to_string(node) + "/hugepages/hugepages-" + (oneGbPages ? "1048576" : "2048") + "kB/" + (nr ? "nr" : "free") + "_hugepages";
|
||||
return fmt::format("/sys/devices/system/node/node{}/hugepages/hugepages-{}kB/{}_hugepages", node, oneGbPages ? "1048576" : "2048", nr ? "nr" : "free");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -71,7 +71,7 @@ uint8_t *xmrig::MemoryPool::get(size_t size, uint32_t)
|
||||
{
|
||||
assert(!(size % pageSize));
|
||||
|
||||
if (!m_memory || (m_memory->size() - m_offset) < size) {
|
||||
if (!m_memory || (m_memory->size() - m_offset - m_alignOffset) < size) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace randomx {
|
||||
class CompiledVm : public VmBase<softAes>
|
||||
{
|
||||
public:
|
||||
inline CompiledVm() {}
|
||||
void* operator new(size_t, void* ptr) { return ptr; }
|
||||
void operator delete(void*) {}
|
||||
|
||||
|
||||
@@ -64,16 +64,17 @@ static const std::array<const char *, RxConfig::ModeMax> modeNames = { "auto", "
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_MSR
|
||||
constexpr size_t kMsrArraySize = 4;
|
||||
constexpr size_t kMsrArraySize = 5;
|
||||
|
||||
static const std::array<MsrItems, kMsrArraySize> msrPresets = {
|
||||
MsrItems(),
|
||||
MsrItems{{ 0xC0011020, 0x0 }, { 0xC0011021, 0x40, ~0x20ULL }, { 0xC0011022, 0x510000 }, { 0xC001102b, 0x1808cc16 }},
|
||||
MsrItems{{ 0xC0011020, 0ULL }, { 0xC0011021, 0x40ULL, ~0x20ULL }, { 0xC0011022, 0x1510000ULL }, { 0xC001102b, 0x2000cc16ULL }},
|
||||
MsrItems{{ 0xC0011020, 0x0004480000000000ULL }, { 0xC0011021, 0x001c000200000040ULL, ~0x20ULL }, { 0xC0011022, 0xc000000401500000ULL }, { 0xC001102b, 0x2000cc14ULL }},
|
||||
MsrItems{{ 0x1a4, 0xf }},
|
||||
MsrItems()
|
||||
};
|
||||
|
||||
static const std::array<const char *, kMsrArraySize> modNames = { "none", "ryzen", "intel", "custom" };
|
||||
static const std::array<const char *, kMsrArraySize> modNames = { "none", "ryzen_17h", "ryzen_19h", "intel", "custom" };
|
||||
|
||||
static_assert (kMsrArraySize == ICpuInfo::MSR_MOD_MAX, "kMsrArraySize and MSR_MOD_MAX mismatch");
|
||||
#endif
|
||||
|
||||
@@ -174,7 +174,8 @@ void xmrig::RxDataset::setRaw(const void *raw)
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(randomx_get_dataset_memory(m_dataset), raw, maxSize());
|
||||
volatile size_t N = maxSize();
|
||||
memcpy(randomx_get_dataset_memory(m_dataset), raw, N);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ static HANDLE wrmsr_install_driver()
|
||||
SERVICE_STATUS status;
|
||||
const auto rc = QueryServiceStatus(hService, &status);
|
||||
|
||||
if (rc && Log::isVerbose()) {
|
||||
if (rc) {
|
||||
DWORD dwBytesNeeded;
|
||||
|
||||
QueryServiceConfigA(hService, nullptr, 0, &dwBytesNeeded);
|
||||
|
||||
@@ -260,14 +260,16 @@ void xmrig::Network::onRequest(IApiRequest &request)
|
||||
|
||||
void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
||||
{
|
||||
uint64_t diff = job.diff();;
|
||||
const char *scale = NetworkState::scaleDiff(diff);
|
||||
uint64_t diff = job.diff();;
|
||||
const char *scale = NetworkState::scaleDiff(diff);
|
||||
|
||||
# ifdef XMRIG_FEATURE_BENCHMARK
|
||||
if (job.benchSize()) {
|
||||
LOG_NOTICE("%s " MAGENTA_BOLD("start benchmark ") "hashes " CYAN_BOLD("%" PRIu64 "M") " algo " WHITE_BOLD("%s") " print_time " CYAN_BOLD("%us"),
|
||||
const uint32_t size = job.benchSize();
|
||||
if (size) {
|
||||
LOG_NOTICE("%s " MAGENTA_BOLD("start benchmark ") "hashes " CYAN_BOLD("%u%s") " algo " WHITE_BOLD("%s") " print_time " CYAN_BOLD("%us"),
|
||||
Tags::bench(),
|
||||
job.benchSize() / 1000000,
|
||||
size < 1000000 ? size / 1000 : size / 1000000,
|
||||
size < 1000000 ? "K" : "M",
|
||||
job.algorithm().shortName(),
|
||||
m_controller->config()->printTime());
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#define APP_ID "xmrig"
|
||||
#define APP_NAME "XMRig"
|
||||
#define APP_DESC "XMRig miner"
|
||||
#define APP_VERSION "6.5.0"
|
||||
#define APP_VERSION "6.5.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 5
|
||||
#define APP_VER_PATCH 0
|
||||
#define APP_VER_PATCH 2
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if (_MSC_VER >= 1920)
|
||||
|
||||
Reference in New Issue
Block a user