mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-10 09:02:45 -05:00
Compare commits
18 Commits
9428422f16
...
c3f565796d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3f565796d | ||
|
|
f9e990d0f0 | ||
|
|
200f23bba7 | ||
|
|
4234b20e21 | ||
|
|
c5d8b8265b | ||
|
|
77c14c8362 | ||
|
|
8b03750806 | ||
|
|
40949f2767 | ||
|
|
56c447e02a | ||
|
|
21c206f05d | ||
|
|
05f8b796d1 | ||
|
|
e702b3e095 | ||
|
|
b9af8762d0 | ||
|
|
ce09c5b089 | ||
|
|
531657cb45 | ||
|
|
d170db1ed3 | ||
|
|
7ad834de92 | ||
|
|
e051564d73 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,3 +4,5 @@ scripts/deps
|
|||||||
/CMakeLists.txt.user
|
/CMakeLists.txt.user
|
||||||
/.idea
|
/.idea
|
||||||
/src/backend/opencl/cl/cn/cryptonight_gen.cl
|
/src/backend/opencl/cl/cn/cryptonight_gen.cl
|
||||||
|
/.vscode
|
||||||
|
/..bfg-report
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# v6.22.2
|
||||||
|
- [#3569](https://github.com/xmrig/xmrig/pull/3569) Fixed corrupted API output in some rare conditions.
|
||||||
|
- [#3571](https://github.com/xmrig/xmrig/pull/3571) Fixed number of threads on the new Intel Core Ultra CPUs.
|
||||||
|
|
||||||
# v6.22.1
|
# v6.22.1
|
||||||
- [#3531](https://github.com/xmrig/xmrig/pull/3531) Always reset nonce on RandomX dataset change.
|
- [#3531](https://github.com/xmrig/xmrig/pull/3531) Always reset nonce on RandomX dataset change.
|
||||||
- [#3534](https://github.com/xmrig/xmrig/pull/3534) Fixed threads auto-config on Zen5.
|
- [#3534](https://github.com/xmrig/xmrig/pull/3534) Fixed threads auto-config on Zen5.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(xmrig)
|
project(xmrig)
|
||||||
|
|
||||||
|
option(WITH_DONATION "Enable donation" ON)
|
||||||
option(WITH_HWLOC "Enable hwloc support" ON)
|
option(WITH_HWLOC "Enable hwloc support" ON)
|
||||||
option(WITH_CN_LITE "Enable CryptoNight-Lite algorithms family" ON)
|
option(WITH_CN_LITE "Enable CryptoNight-Lite algorithms family" ON)
|
||||||
option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
|
option(WITH_CN_HEAVY "Enable CryptoNight-Heavy algorithms family" ON)
|
||||||
@@ -135,6 +136,13 @@ if (CMAKE_C_COMPILER_ID MATCHES GNU)
|
|||||||
set_source_files_properties(src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize")
|
set_source_files_properties(src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_DONATION)
|
||||||
|
message("-- Donation state: enabled")
|
||||||
|
else()
|
||||||
|
message("-- Donation state: disabled")
|
||||||
|
add_definitions(-DXMRIG_NO_DONATE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WITH_VAES)
|
if (WITH_VAES)
|
||||||
add_definitions(-DXMRIG_VAES)
|
add_definitions(-DXMRIG_VAES)
|
||||||
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_x86_vaes.h)
|
set(HEADERS_CRYPTO "${HEADERS_CRYPTO}" src/crypto/cn/CryptoNight_x86_vaes.h)
|
||||||
|
|||||||
0
sccache.log
Normal file
0
sccache.log
Normal file
@@ -30,10 +30,10 @@
|
|||||||
#include "base/tools/Handle.h"
|
#include "base/tools/Handle.h"
|
||||||
|
|
||||||
|
|
||||||
inline static const char *format(double h, char *buf, size_t size)
|
inline static const char *format(std::pair<bool, double> h, char *buf, size_t size)
|
||||||
{
|
{
|
||||||
if (std::isnormal(h)) {
|
if (h.first) {
|
||||||
snprintf(buf, size, (h < 100.0) ? "%04.2f" : "%03.1f", h);
|
snprintf(buf, size, (h.second < 100.0) ? "%04.2f" : "%03.1f", h.second);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,15 +80,16 @@ double xmrig::Hashrate::average() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *xmrig::Hashrate::format(double h, char *buf, size_t size)
|
const char *xmrig::Hashrate::format(std::pair<bool, double> h, char *buf, size_t size)
|
||||||
{
|
{
|
||||||
return ::format(h, buf, size);
|
return ::format(h, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rapidjson::Value xmrig::Hashrate::normalize(double d)
|
rapidjson::Value xmrig::Hashrate::normalize(std::pair<bool, double> d)
|
||||||
{
|
{
|
||||||
return Json::normalize(d, false);
|
using namespace rapidjson;
|
||||||
|
return d.first ? Value(floor(d.second * 100.0) / 100.0) : Value(kNullType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -122,11 +123,11 @@ rapidjson::Value xmrig::Hashrate::toJSON(size_t threadId, rapidjson::Document &d
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
double xmrig::Hashrate::hashrate(size_t index, size_t ms) const
|
std::pair<bool, double> xmrig::Hashrate::hashrate(size_t index, size_t ms) const
|
||||||
{
|
{
|
||||||
assert(index < m_threads);
|
assert(index < m_threads);
|
||||||
if (index >= m_threads) {
|
if (index >= m_threads) {
|
||||||
return nan("");
|
return { false, 0.0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t earliestHashCount = 0;
|
uint64_t earliestHashCount = 0;
|
||||||
@@ -157,17 +158,27 @@ double xmrig::Hashrate::hashrate(size_t index, size_t ms) const
|
|||||||
} while (idx != idx_start);
|
} while (idx != idx_start);
|
||||||
|
|
||||||
if (!haveFullSet || earliestStamp == 0 || lastestStamp == 0) {
|
if (!haveFullSet || earliestStamp == 0 || lastestStamp == 0) {
|
||||||
return nan("");
|
return { false, 0.0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastestStamp - earliestStamp == 0) {
|
if (lastestHashCnt == earliestHashCount) {
|
||||||
return nan("");
|
return { true, 0.0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastestStamp == earliestStamp) {
|
||||||
|
return { false, 0.0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto hashes = static_cast<double>(lastestHashCnt - earliestHashCount);
|
const auto hashes = static_cast<double>(lastestHashCnt - earliestHashCount);
|
||||||
const auto time = static_cast<double>(lastestStamp - earliestStamp) / 1000.0;
|
const auto time = static_cast<double>(lastestStamp - earliestStamp);
|
||||||
|
|
||||||
return hashes / time;
|
const auto hr = hashes * 1000.0 / time;
|
||||||
|
|
||||||
|
if (!std::isnormal(hr)) {
|
||||||
|
return { false, 0.0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { true, hr };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,16 +47,16 @@ public:
|
|||||||
Hashrate(size_t threads);
|
Hashrate(size_t threads);
|
||||||
~Hashrate();
|
~Hashrate();
|
||||||
|
|
||||||
inline double calc(size_t ms) const { const double data = hashrate(0U, ms); return std::isnormal(data) ? data : 0.0; }
|
inline std::pair<bool, double> calc(size_t ms) const { return hashrate(0U, ms); }
|
||||||
inline double calc(size_t threadId, size_t ms) const { return hashrate(threadId + 1, ms); }
|
inline std::pair<bool, double> calc(size_t threadId, size_t ms) const { return hashrate(threadId + 1, ms); }
|
||||||
inline size_t threads() const { return m_threads > 0U ? m_threads - 1U : 0U; }
|
inline size_t threads() const { return m_threads > 0U ? m_threads - 1U : 0U; }
|
||||||
inline void add(size_t threadId, uint64_t count, uint64_t timestamp) { addData(threadId + 1U, count, timestamp); }
|
inline void add(size_t threadId, uint64_t count, uint64_t timestamp) { addData(threadId + 1U, count, timestamp); }
|
||||||
inline void add(uint64_t count, uint64_t timestamp) { addData(0U, count, timestamp); }
|
inline void add(uint64_t count, uint64_t timestamp) { addData(0U, count, timestamp); }
|
||||||
|
|
||||||
double average() const;
|
double average() const;
|
||||||
|
|
||||||
static const char *format(double h, char *buf, size_t size);
|
static const char *format(std::pair<bool, double> h, char *buf, size_t size);
|
||||||
static rapidjson::Value normalize(double d);
|
static rapidjson::Value normalize(std::pair<bool, double> d);
|
||||||
|
|
||||||
# ifdef XMRIG_FEATURE_API
|
# ifdef XMRIG_FEATURE_API
|
||||||
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
rapidjson::Value toJSON(rapidjson::Document &doc) const;
|
||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double hashrate(size_t index, size_t ms) const;
|
std::pair<bool, double> hashrate(size_t index, size_t ms) const;
|
||||||
void addData(size_t index, uint64_t count, uint64_t timestamp);
|
void addData(size_t index, uint64_t count, uint64_t timestamp);
|
||||||
|
|
||||||
constexpr static size_t kBucketSize = 2 << 11;
|
constexpr static size_t kBucketSize = 2 << 11;
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ifdef XMRIG_ALGO_RANDOMX
|
# ifdef XMRIG_ALGO_RANDOMX
|
||||||
if ((algorithm.family() == Algorithm::RANDOM_X) && L3_exclusive && (PUs > cores.size()) && (PUs < cores.size() * 2)) {
|
if ((vendor() == VENDOR_INTEL) && (algorithm.family() == Algorithm::RANDOM_X) && L3_exclusive && (PUs < cores.size() * 2)) {
|
||||||
// Use all L3+L2 on latest Intel CPUs with P-cores, E-cores and exclusive L3 cache
|
// Use all L3+L2 on latest Intel CPUs with P-cores, E-cores and exclusive L3 cache
|
||||||
cacheHashes = (L3 + L2) / scratchpad;
|
cacheHashes = (L3 + L2) / scratchpad;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,15 +372,20 @@ void xmrig::CudaBackend::printHashrate(bool details)
|
|||||||
|
|
||||||
char num[16 * 3] = { 0 };
|
char num[16 * 3] = { 0 };
|
||||||
|
|
||||||
const double hashrate_short = hashrate()->calc(Hashrate::ShortInterval);
|
auto hashrate_short = hashrate()->calc(Hashrate::ShortInterval);
|
||||||
const double hashrate_medium = hashrate()->calc(Hashrate::MediumInterval);
|
auto hashrate_medium = hashrate()->calc(Hashrate::MediumInterval);
|
||||||
const double hashrate_large = hashrate()->calc(Hashrate::LargeInterval);
|
auto hashrate_large = hashrate()->calc(Hashrate::LargeInterval);
|
||||||
|
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
const char* h = " H/s";
|
const char* h = " H/s";
|
||||||
|
|
||||||
if ((hashrate_short >= 1e6) || (hashrate_medium >= 1e6) || (hashrate_large >= 1e6)) {
|
if ((hashrate_short.second >= 1e6) || (hashrate_medium.second >= 1e6) || (hashrate_large.second >= 1e6)) {
|
||||||
scale = 1e-6;
|
scale = 1e-6;
|
||||||
|
|
||||||
|
hashrate_short.second *= scale;
|
||||||
|
hashrate_medium.second *= scale;
|
||||||
|
hashrate_large.second *= scale;
|
||||||
|
|
||||||
h = "MH/s";
|
h = "MH/s";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,12 +393,20 @@ void xmrig::CudaBackend::printHashrate(bool details)
|
|||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (const auto& data : d_ptr->threads) {
|
for (const auto& data : d_ptr->threads) {
|
||||||
|
auto h0 = hashrate()->calc(i, Hashrate::ShortInterval);
|
||||||
|
auto h1 = hashrate()->calc(i, Hashrate::MediumInterval);
|
||||||
|
auto h2 = hashrate()->calc(i, Hashrate::LargeInterval);
|
||||||
|
|
||||||
|
h0.second *= scale;
|
||||||
|
h1.second *= scale;
|
||||||
|
h2.second *= scale;
|
||||||
|
|
||||||
Log::print("| %8zu | %8" PRId64 " | %8s | %8s | %8s |" CYAN_BOLD(" #%u") YELLOW(" %s") GREEN(" %s"),
|
Log::print("| %8zu | %8" PRId64 " | %8s | %8s | %8s |" CYAN_BOLD(" #%u") YELLOW(" %s") GREEN(" %s"),
|
||||||
i,
|
i,
|
||||||
data.thread.affinity(),
|
data.thread.affinity(),
|
||||||
Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval) * scale, num, sizeof num / 3),
|
Hashrate::format(h0, num, sizeof num / 3),
|
||||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval) * scale, num + 16, sizeof num / 3),
|
Hashrate::format(h1, num + 16, sizeof num / 3),
|
||||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval) * scale, num + 16 * 2, sizeof num / 3),
|
Hashrate::format(h2, num + 16 * 2, sizeof num / 3),
|
||||||
data.device.index(),
|
data.device.index(),
|
||||||
data.device.topology().toString().data(),
|
data.device.topology().toString().data(),
|
||||||
data.device.name().data()
|
data.device.name().data()
|
||||||
@@ -403,9 +416,9 @@ void xmrig::CudaBackend::printHashrate(bool details)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log::print(WHITE_BOLD_S "| - | - | %8s | %8s | %8s |",
|
Log::print(WHITE_BOLD_S "| - | - | %8s | %8s | %8s |",
|
||||||
Hashrate::format(hashrate_short * scale, num, sizeof num / 3),
|
Hashrate::format(hashrate_short , num, sizeof num / 3),
|
||||||
Hashrate::format(hashrate_medium * scale, num + 16, sizeof num / 3),
|
Hashrate::format(hashrate_medium, num + 16, sizeof num / 3),
|
||||||
Hashrate::format(hashrate_large * scale, num + 16 * 2, sizeof num / 3)
|
Hashrate::format(hashrate_large , num + 16 * 2, sizeof num / 3)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -352,15 +352,20 @@ void xmrig::OclBackend::printHashrate(bool details)
|
|||||||
|
|
||||||
char num[16 * 3] = { 0 };
|
char num[16 * 3] = { 0 };
|
||||||
|
|
||||||
const double hashrate_short = hashrate()->calc(Hashrate::ShortInterval);
|
auto hashrate_short = hashrate()->calc(Hashrate::ShortInterval);
|
||||||
const double hashrate_medium = hashrate()->calc(Hashrate::MediumInterval);
|
auto hashrate_medium = hashrate()->calc(Hashrate::MediumInterval);
|
||||||
const double hashrate_large = hashrate()->calc(Hashrate::LargeInterval);
|
auto hashrate_large = hashrate()->calc(Hashrate::LargeInterval);
|
||||||
|
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
const char* h = " H/s";
|
const char* h = " H/s";
|
||||||
|
|
||||||
if ((hashrate_short >= 1e6) || (hashrate_medium >= 1e6) || (hashrate_large >= 1e6)) {
|
if ((hashrate_short.second >= 1e6) || (hashrate_medium.second >= 1e6) || (hashrate_large.second >= 1e6)) {
|
||||||
scale = 1e-6;
|
scale = 1e-6;
|
||||||
|
|
||||||
|
hashrate_short.second *= scale;
|
||||||
|
hashrate_medium.second *= scale;
|
||||||
|
hashrate_large.second *= scale;
|
||||||
|
|
||||||
h = "MH/s";
|
h = "MH/s";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,12 +373,16 @@ void xmrig::OclBackend::printHashrate(bool details)
|
|||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (const auto& data : d_ptr->threads) {
|
for (const auto& data : d_ptr->threads) {
|
||||||
|
auto h0 = hashrate()->calc(i, Hashrate::ShortInterval);
|
||||||
|
auto h1 = hashrate()->calc(i, Hashrate::MediumInterval);
|
||||||
|
auto h2 = hashrate()->calc(i, Hashrate::LargeInterval);
|
||||||
|
|
||||||
Log::print("| %8zu | %8" PRId64 " | %8s | %8s | %8s |" CYAN_BOLD(" #%u") YELLOW(" %s") " %s",
|
Log::print("| %8zu | %8" PRId64 " | %8s | %8s | %8s |" CYAN_BOLD(" #%u") YELLOW(" %s") " %s",
|
||||||
i,
|
i,
|
||||||
data.affinity,
|
data.affinity,
|
||||||
Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval) * scale, num, sizeof num / 3),
|
Hashrate::format(h0, num, sizeof num / 3),
|
||||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval) * scale, num + 16, sizeof num / 3),
|
Hashrate::format(h1, num + 16, sizeof num / 3),
|
||||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval) * scale, num + 16 * 2, sizeof num / 3),
|
Hashrate::format(h2, num + 16 * 2, sizeof num / 3),
|
||||||
data.device.index(),
|
data.device.index(),
|
||||||
data.device.topology().toString().data(),
|
data.device.topology().toString().data(),
|
||||||
data.device.printableName().data()
|
data.device.printableName().data()
|
||||||
@@ -383,9 +392,9 @@ void xmrig::OclBackend::printHashrate(bool details)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log::print(WHITE_BOLD_S "| - | - | %8s | %8s | %8s |",
|
Log::print(WHITE_BOLD_S "| - | - | %8s | %8s | %8s |",
|
||||||
Hashrate::format(hashrate_short * scale, num, sizeof num / 3),
|
Hashrate::format(hashrate_short , num, sizeof num / 3),
|
||||||
Hashrate::format(hashrate_medium * scale, num + 16, sizeof num / 3),
|
Hashrate::format(hashrate_medium, num + 16, sizeof num / 3),
|
||||||
Hashrate::format(hashrate_large * scale, num + 16 * 2, sizeof num / 3)
|
Hashrate::format(hashrate_large , num + 16 * 2, sizeof num / 3)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include "core/Miner.h"
|
#include "core/Miner.h"
|
||||||
#include "core/Taskbar.h"
|
#include "core/Taskbar.h"
|
||||||
@@ -173,7 +173,7 @@ public:
|
|||||||
Value total(kArrayType);
|
Value total(kArrayType);
|
||||||
Value threads(kArrayType);
|
Value threads(kArrayType);
|
||||||
|
|
||||||
double t[3] = { 0.0 };
|
std::pair<bool, double> t[3] = { { true, 0.0 }, { true, 0.0 }, { true, 0.0 } };
|
||||||
|
|
||||||
for (IBackend *backend : backends) {
|
for (IBackend *backend : backends) {
|
||||||
const Hashrate *hr = backend->hashrate();
|
const Hashrate *hr = backend->hashrate();
|
||||||
@@ -181,9 +181,13 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
t[0] += hr->calc(Hashrate::ShortInterval);
|
const auto h0 = hr->calc(Hashrate::ShortInterval);
|
||||||
t[1] += hr->calc(Hashrate::MediumInterval);
|
const auto h1 = hr->calc(Hashrate::MediumInterval);
|
||||||
t[2] += hr->calc(Hashrate::LargeInterval);
|
const auto h2 = hr->calc(Hashrate::LargeInterval);
|
||||||
|
|
||||||
|
if (h0.first) { t[0].second += h0.second; } else { t[0].first = false; }
|
||||||
|
if (h1.first) { t[1].second += h1.second; } else { t[1].first = false; }
|
||||||
|
if (h2.first) { t[2].second += h2.second; } else { t[2].first = false; }
|
||||||
|
|
||||||
if (version > 1) {
|
if (version > 1) {
|
||||||
continue;
|
continue;
|
||||||
@@ -204,7 +208,7 @@ public:
|
|||||||
total.PushBack(Hashrate::normalize(t[2]), allocator);
|
total.PushBack(Hashrate::normalize(t[2]), allocator);
|
||||||
|
|
||||||
hashrate.AddMember("total", total, allocator);
|
hashrate.AddMember("total", total, allocator);
|
||||||
hashrate.AddMember("highest", Hashrate::normalize(maxHashrate[algorithm]), allocator);
|
hashrate.AddMember("highest", Hashrate::normalize({ maxHashrate[algorithm] > 0.0, maxHashrate[algorithm] }), allocator);
|
||||||
|
|
||||||
if (version == 1) {
|
if (version == 1) {
|
||||||
hashrate.AddMember("threads", threads, allocator);
|
hashrate.AddMember("threads", threads, allocator);
|
||||||
@@ -283,7 +287,7 @@ public:
|
|||||||
void printHashrate(bool details)
|
void printHashrate(bool details)
|
||||||
{
|
{
|
||||||
char num[16 * 5] = { 0 };
|
char num[16 * 5] = { 0 };
|
||||||
double speed[3] = { 0.0 };
|
std::pair<bool, double> speed[3] = { { true, 0.0 }, { true, 0.0 }, { true, 0.0 } };
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
|
||||||
double avg_hashrate = 0.0;
|
double avg_hashrate = 0.0;
|
||||||
@@ -293,9 +297,13 @@ public:
|
|||||||
if (hashrate) {
|
if (hashrate) {
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
speed[0] += hashrate->calc(Hashrate::ShortInterval);
|
const auto h0 = hashrate->calc(Hashrate::ShortInterval);
|
||||||
speed[1] += hashrate->calc(Hashrate::MediumInterval);
|
const auto h1 = hashrate->calc(Hashrate::MediumInterval);
|
||||||
speed[2] += hashrate->calc(Hashrate::LargeInterval);
|
const auto h2 = hashrate->calc(Hashrate::LargeInterval);
|
||||||
|
|
||||||
|
if (h0.first) { speed[0].second += h0.second; } else { speed[0].first = false; }
|
||||||
|
if (h1.first) { speed[1].second += h1.second; } else { speed[1].first = false; }
|
||||||
|
if (h2.first) { speed[2].second += h2.second; } else { speed[2].first = false; }
|
||||||
|
|
||||||
avg_hashrate += hashrate->average();
|
avg_hashrate += hashrate->average();
|
||||||
}
|
}
|
||||||
@@ -312,8 +320,13 @@ public:
|
|||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
const char* h = "H/s";
|
const char* h = "H/s";
|
||||||
|
|
||||||
if ((speed[0] >= 1e6) || (speed[1] >= 1e6) || (speed[2] >= 1e6) || (maxHashrate[algorithm] >= 1e6)) {
|
if ((speed[0].second >= 1e6) || (speed[1].second >= 1e6) || (speed[2].second >= 1e6) || (maxHashrate[algorithm] >= 1e6)) {
|
||||||
scale = 1e-6;
|
scale = 1e-6;
|
||||||
|
|
||||||
|
speed[0].second *= scale;
|
||||||
|
speed[1].second *= scale;
|
||||||
|
speed[2].second *= scale;
|
||||||
|
|
||||||
h = "MH/s";
|
h = "MH/s";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,16 +335,16 @@ public:
|
|||||||
|
|
||||||
# ifdef XMRIG_ALGO_GHOSTRIDER
|
# ifdef XMRIG_ALGO_GHOSTRIDER
|
||||||
if (algorithm.family() == Algorithm::GHOSTRIDER) {
|
if (algorithm.family() == Algorithm::GHOSTRIDER) {
|
||||||
snprintf(avg_hashrate_buf, sizeof(avg_hashrate_buf), " avg " CYAN_BOLD("%s %s"), Hashrate::format(avg_hashrate * scale, num + 16 * 4, 16), h);
|
snprintf(avg_hashrate_buf, sizeof(avg_hashrate_buf), " avg " CYAN_BOLD("%s %s"), Hashrate::format({ true, avg_hashrate * scale }, num + 16 * 4, 16), h);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
LOG_INFO("%s " WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("%s") " max " CYAN_BOLD("%s %s") "%s",
|
LOG_INFO("%s " WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("%s") " max " CYAN_BOLD("%s %s") "%s",
|
||||||
Tags::miner(),
|
Tags::miner(),
|
||||||
Hashrate::format(speed[0] * scale, num, 16),
|
Hashrate::format(speed[0], num, 16),
|
||||||
Hashrate::format(speed[1] * scale, num + 16, 16),
|
Hashrate::format(speed[1], num + 16, 16),
|
||||||
Hashrate::format(speed[2] * scale, num + 16 * 2, 16), h,
|
Hashrate::format(speed[2], num + 16 * 2, 16), h,
|
||||||
Hashrate::format(maxHashrate[algorithm] * scale, num + 16 * 3, 16), h,
|
Hashrate::format({ maxHashrate[algorithm] > 0.0, maxHashrate[algorithm] * scale }, num + 16 * 3, 16), h,
|
||||||
avg_hashrate_buf
|
avg_hashrate_buf
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -380,6 +393,14 @@ public:
|
|||||||
xmrig::Miner::Miner(Controller *controller)
|
xmrig::Miner::Miner(Controller *controller)
|
||||||
: d_ptr(new MinerPrivate(controller))
|
: d_ptr(new MinerPrivate(controller))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Read the environment variable
|
||||||
|
const char* envNanoSeconds = std::getenv("XMRIG_SLEEP_NANOSECONDS");
|
||||||
|
|
||||||
|
// Default value if not configured
|
||||||
|
sleepNanoSeconds = (envNanoSeconds != nullptr) ? std::atoi(envNanoSeconds) : 0;
|
||||||
|
|
||||||
const int priority = controller->config()->cpu().priority();
|
const int priority = controller->config()->cpu().priority();
|
||||||
if (priority >= 0) {
|
if (priority >= 0) {
|
||||||
Platform::setProcessPriority(priority);
|
Platform::setProcessPriority(priority);
|
||||||
@@ -449,6 +470,8 @@ const std::vector<xmrig::IBackend *> &xmrig::Miner::backends() const
|
|||||||
|
|
||||||
xmrig::Job xmrig::Miner::job() const
|
xmrig::Job xmrig::Miner::job() const
|
||||||
{
|
{
|
||||||
|
std::this_thread::sleep_for(std::chrono::nanoseconds(sleepNanoSeconds));
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
|
||||||
return d_ptr->job;
|
return d_ptr->job;
|
||||||
@@ -646,7 +669,10 @@ void xmrig::Miner::onTimer(const Timer *)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (backend->hashrate()) {
|
if (backend->hashrate()) {
|
||||||
maxHashrate += backend->hashrate()->calc(Hashrate::ShortInterval);
|
const auto h = backend->hashrate()->calc(Hashrate::ShortInterval);
|
||||||
|
if (h.first) {
|
||||||
|
maxHashrate += h.second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public:
|
|||||||
Miner(Controller *controller);
|
Miner(Controller *controller);
|
||||||
~Miner() override;
|
~Miner() override;
|
||||||
|
|
||||||
|
int sleepNanoSeconds;
|
||||||
|
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
bool isEnabled(const Algorithm &algorithm) const;
|
bool isEnabled(const Algorithm &algorithm) const;
|
||||||
const Algorithms &algorithms() const;
|
const Algorithms &algorithms() const;
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "crypto/common/VirtualMemory.h"
|
#include "crypto/common/VirtualMemory.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <thread>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "crypto/rx/Profiler.h"
|
#include "crypto/rx/Profiler.h"
|
||||||
@@ -364,6 +366,10 @@ alignas(64) RandomX_ConfigurationBase RandomX_CurrentConfig;
|
|||||||
|
|
||||||
static std::mutex vm_pool_mutex;
|
static std::mutex vm_pool_mutex;
|
||||||
|
|
||||||
|
const char* envRandomXNanoSeconds = std::getenv("XMRIG_RANDOMX_SLEEP_NANOSECONDS");
|
||||||
|
|
||||||
|
int randomx_sleep_nanoseconds = (envRandomXNanoSeconds != nullptr) ? std::atoi(envRandomXNanoSeconds) : 0;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
randomx_cache *randomx_create_cache(randomx_flags flags, uint8_t *memory) {
|
randomx_cache *randomx_create_cache(randomx_flags flags, uint8_t *memory) {
|
||||||
@@ -574,6 +580,7 @@ extern "C" {
|
|||||||
machine->initScratchpad(&tempHash);
|
machine->initScratchpad(&tempHash);
|
||||||
machine->resetRoundingMode();
|
machine->resetRoundingMode();
|
||||||
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::nanoseconds(randomx_sleep_nanoseconds));
|
||||||
machine->run(&tempHash);
|
machine->run(&tempHash);
|
||||||
rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile));
|
rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile));
|
||||||
}
|
}
|
||||||
@@ -591,6 +598,7 @@ extern "C" {
|
|||||||
|
|
||||||
machine->resetRoundingMode();
|
machine->resetRoundingMode();
|
||||||
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::nanoseconds(randomx_sleep_nanoseconds));
|
||||||
machine->run(&tempHash);
|
machine->run(&tempHash);
|
||||||
rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile));
|
rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
namespace xmrig {
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
|
const char* envRXDatasetSingleThreadInit = std::getenv("XMRIG_RX_DATASET_SINGLE_THREAD_INIT");
|
||||||
|
|
||||||
|
bool rx_dataset_single_thread_init = (envRXDatasetSingleThreadInit != nullptr);
|
||||||
|
|
||||||
static void init_dataset_wrapper(randomx_dataset *dataset, randomx_cache *cache, uint32_t startItem, uint32_t itemCount, int priority)
|
static void init_dataset_wrapper(randomx_dataset *dataset, randomx_cache *cache, uint32_t startItem, uint32_t itemCount, int priority)
|
||||||
{
|
{
|
||||||
Platform::setThreadPriority(priority);
|
Platform::setThreadPriority(priority);
|
||||||
@@ -108,12 +112,17 @@ bool xmrig::RxDataset::init(const Buffer &seed, uint32_t numThreads, int priorit
|
|||||||
const uint32_t a = (datasetItemCount * i) / numThreads;
|
const uint32_t a = (datasetItemCount * i) / numThreads;
|
||||||
const uint32_t b = (datasetItemCount * (i + 1)) / numThreads;
|
const uint32_t b = (datasetItemCount * (i + 1)) / numThreads;
|
||||||
threads.emplace_back(init_dataset_wrapper, m_dataset, m_cache->get(), a, b - a, priority);
|
threads.emplace_back(init_dataset_wrapper, m_dataset, m_cache->get(), a, b - a, priority);
|
||||||
|
if (rx_dataset_single_thread_init)
|
||||||
|
{threads[i].join();} // force it to be sequential
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rx_dataset_single_thread_init){
|
||||||
for (uint32_t i = 0; i < numThreads; ++i) {
|
for (uint32_t i = 0; i < numThreads; ++i) {
|
||||||
threads[i].join();
|
threads[i].join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
init_dataset_wrapper(m_dataset, m_cache->get(), 0, datasetItemCount, priority);
|
init_dataset_wrapper(m_dataset, m_cache->get(), 0, datasetItemCount, priority);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,13 @@
|
|||||||
* If you plan on changing donations to 0%, please consider making a one-off donation to my wallet:
|
* If you plan on changing donations to 0%, please consider making a one-off donation to my wallet:
|
||||||
* XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD
|
* XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef XMRIG_NO_DONATE
|
||||||
|
constexpr const int kDefaultDonateLevel = 0;
|
||||||
|
constexpr const int kMinimumDonateLevel = 0;
|
||||||
|
#else
|
||||||
constexpr const int kDefaultDonateLevel = 1;
|
constexpr const int kDefaultDonateLevel = 1;
|
||||||
constexpr const int kMinimumDonateLevel = 1;
|
constexpr const int kMinimumDonateLevel = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // XMRIG_DONATE_H
|
#endif // XMRIG_DONATE_H
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#define APP_ID "xmrig"
|
#define APP_ID "xmrig"
|
||||||
#define APP_NAME "XMRig"
|
#define APP_NAME "XMRig"
|
||||||
#define APP_DESC "XMRig miner"
|
#define APP_DESC "XMRig miner"
|
||||||
#define APP_VERSION "6.22.1"
|
#define APP_VERSION "6.22.2"
|
||||||
#define APP_DOMAIN "xmrig.com"
|
#define APP_DOMAIN "xmrig.com"
|
||||||
#define APP_SITE "www.xmrig.com"
|
#define APP_SITE "www.xmrig.com"
|
||||||
#define APP_COPYRIGHT "Copyright (C) 2016-2024 xmrig.com"
|
#define APP_COPYRIGHT "Copyright (C) 2016-2024 xmrig.com"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#define APP_VER_MAJOR 6
|
#define APP_VER_MAJOR 6
|
||||||
#define APP_VER_MINOR 22
|
#define APP_VER_MINOR 22
|
||||||
#define APP_VER_PATCH 1
|
#define APP_VER_PATCH 2
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# if (_MSC_VER >= 1930)
|
# if (_MSC_VER >= 1930)
|
||||||
|
|||||||
Reference in New Issue
Block a user