mirror of
https://github.com/xmrig/xmrig.git
synced 2024-10-30 13:07:46 +00:00
Merge pull request #1700 from SChernykh/evo
Fixed hashrate and diff display for KawPow
This commit is contained in:
commit
06809df4a0
7 changed files with 133 additions and 39 deletions
|
@ -39,7 +39,7 @@
|
|||
inline static const char *format(double h, char *buf, size_t size)
|
||||
{
|
||||
if (std::isnormal(h)) {
|
||||
snprintf(buf, size, "%03.1f", h);
|
||||
snprintf(buf, size, (h < 100.0) ? "%04.2f" : "%03.1f", h);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,12 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_KAWPOW
|
||||
# include "crypto/kawpow/KPCache.h"
|
||||
# include "crypto/kawpow/KPHash.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
# include "base/api/interfaces/IApiRequest.h"
|
||||
#endif
|
||||
|
@ -205,7 +211,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
inline void start(const Job &)
|
||||
inline void start(const Job &job)
|
||||
{
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
Tags::nvidia(),
|
||||
|
@ -227,6 +233,15 @@ public:
|
|||
|
||||
size_t i = 0;
|
||||
for (const auto &data : threads) {
|
||||
size_t mem_used = (data.thread.threads() * data.thread.blocks()) * algo_l3 / oneMiB;
|
||||
|
||||
# ifdef XMRIG_ALGO_KAWPOW
|
||||
if (algo.family() == Algorithm::KAWPOW) {
|
||||
const uint32_t epoch = job.height() / KPHash::EPOCH_LENGTH;
|
||||
mem_used = (KPCache::cache_size(epoch) + KPCache::dag_size(epoch)) / oneMiB;
|
||||
}
|
||||
# endif
|
||||
|
||||
Log::print("|" CYAN_BOLD("%3zu") " |" CYAN_BOLD("%4u") " |" YELLOW(" %7s") " |" CYAN_BOLD("%10d") " |" CYAN_BOLD("%8d") " |"
|
||||
CYAN_BOLD("%7d") " |" CYAN_BOLD("%3d") " |" CYAN_BOLD("%4d") " |" CYAN("%7zu") " | " GREEN("%s"),
|
||||
i,
|
||||
|
@ -237,7 +252,7 @@ public:
|
|||
data.thread.blocks(),
|
||||
data.thread.bfactor(),
|
||||
data.thread.bsleep(),
|
||||
(data.thread.threads() * data.thread.blocks()) * algo_l3 / oneMiB,
|
||||
mem_used,
|
||||
data.device.name().data()
|
||||
);
|
||||
|
||||
|
@ -368,18 +383,30 @@ void xmrig::CudaBackend::printHashrate(bool details)
|
|||
return;
|
||||
}
|
||||
|
||||
char num[8 * 3] = { 0 };
|
||||
char num[16 * 3] = { 0 };
|
||||
|
||||
Log::print(WHITE_BOLD_S "| CUDA # | AFFINITY | 10s H/s | 60s H/s | 15m H/s |");
|
||||
const double hashrate_short = hashrate()->calc(Hashrate::ShortInterval);
|
||||
const double hashrate_medium = hashrate()->calc(Hashrate::MediumInterval);
|
||||
const double hashrate_large = hashrate()->calc(Hashrate::LargeInterval);
|
||||
|
||||
double scale = 1.0;
|
||||
const char* h = " H/s";
|
||||
|
||||
if ((hashrate_short >= 1e6) || (hashrate_medium >= 1e6) || (hashrate_large >= 1e6)) {
|
||||
scale = 1e-6;
|
||||
h = "MH/s";
|
||||
}
|
||||
|
||||
Log::print(WHITE_BOLD_S "| CUDA # | AFFINITY | 10s %s | 60s %s | 15m %s |", h, h, h);
|
||||
|
||||
size_t i = 0;
|
||||
for (const auto &data : d_ptr->threads) {
|
||||
Log::print("| %8zu | %8" PRId64 " | %7s | %7s | %7s |" CYAN_BOLD(" #%u") YELLOW(" %s") GREEN(" %s"),
|
||||
for (const auto& data : d_ptr->threads) {
|
||||
Log::print("| %8zu | %8" PRId64 " | %8s | %8s | %8s |" CYAN_BOLD(" #%u") YELLOW(" %s") GREEN(" %s"),
|
||||
i,
|
||||
data.thread.affinity(),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval), num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval), num + 8, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval), num + 8 * 2, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval) * scale, num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval) * scale, num + 16, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval) * scale, num + 16 * 2, sizeof num / 3),
|
||||
data.device.index(),
|
||||
data.device.topology().toString().data(),
|
||||
data.device.name().data()
|
||||
|
@ -388,10 +415,10 @@ void xmrig::CudaBackend::printHashrate(bool details)
|
|||
i++;
|
||||
}
|
||||
|
||||
Log::print(WHITE_BOLD_S "| - | - | %7s | %7s | %7s |",
|
||||
Hashrate::format(hashrate()->calc(Hashrate::ShortInterval), num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::MediumInterval), num + 8, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::LargeInterval), num + 8 * 2, sizeof num / 3)
|
||||
Log::print(WHITE_BOLD_S "| - | - | %8s | %8s | %8s |",
|
||||
Hashrate::format(hashrate()->calc(Hashrate::ShortInterval) * scale, num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::MediumInterval) * scale, num + 16, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::LargeInterval) * scale, num + 16 * 2, sizeof num / 3)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,12 @@
|
|||
#include "core/Controller.h"
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_KAWPOW
|
||||
# include "crypto/kawpow/KPCache.h"
|
||||
# include "crypto/kawpow/KPHash.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_API
|
||||
# include "base/api/interfaces/IApiRequest.h"
|
||||
#endif
|
||||
|
@ -213,6 +219,15 @@ public:
|
|||
|
||||
size_t i = 0;
|
||||
for (const auto &data : threads) {
|
||||
size_t mem_used = data.thread.intensity() * algo_l3 / oneMiB;
|
||||
|
||||
# ifdef XMRIG_ALGO_KAWPOW
|
||||
if (algo.family() == Algorithm::KAWPOW) {
|
||||
const uint32_t epoch = job.height() / KPHash::EPOCH_LENGTH;
|
||||
mem_used = (KPCache::cache_size(epoch) + KPCache::dag_size(epoch)) / oneMiB;
|
||||
}
|
||||
# endif
|
||||
|
||||
Log::print("|" CYAN_BOLD("%3zu") " |" CYAN_BOLD("%4u") " |" YELLOW(" %7s") " |" CYAN_BOLD("%10u") " |" CYAN_BOLD("%6u") " |"
|
||||
CYAN("%7zu") " | %s",
|
||||
i,
|
||||
|
@ -220,7 +235,7 @@ public:
|
|||
data.device.topology().toString().data(),
|
||||
data.thread.intensity(),
|
||||
data.thread.worksize(),
|
||||
data.thread.intensity() * algo_l3 / oneMiB,
|
||||
mem_used,
|
||||
data.device.printableName().data()
|
||||
);
|
||||
|
||||
|
@ -346,18 +361,30 @@ void xmrig::OclBackend::printHashrate(bool details)
|
|||
return;
|
||||
}
|
||||
|
||||
char num[8 * 3] = { 0 };
|
||||
char num[16 * 3] = { 0 };
|
||||
|
||||
Log::print(WHITE_BOLD_S "| OPENCL # | AFFINITY | 10s H/s | 60s H/s | 15m H/s |");
|
||||
const double hashrate_short = hashrate()->calc(Hashrate::ShortInterval);
|
||||
const double hashrate_medium = hashrate()->calc(Hashrate::MediumInterval);
|
||||
const double hashrate_large = hashrate()->calc(Hashrate::LargeInterval);
|
||||
|
||||
double scale = 1.0;
|
||||
const char* h = " H/s";
|
||||
|
||||
if ((hashrate_short >= 1e6) || (hashrate_medium >= 1e6) || (hashrate_large >= 1e6)) {
|
||||
scale = 1e-6;
|
||||
h = "MH/s";
|
||||
}
|
||||
|
||||
Log::print(WHITE_BOLD_S "| OPENCL # | AFFINITY | 10s %s | 60s %s | 15m %s |", h, h, h);
|
||||
|
||||
size_t i = 0;
|
||||
for (const auto &data : d_ptr->threads) {
|
||||
Log::print("| %8zu | %8" PRId64 " | %7s | %7s | %7s |" CYAN_BOLD(" #%u") YELLOW(" %s") " %s",
|
||||
for (const auto& data : d_ptr->threads) {
|
||||
Log::print("| %8zu | %8" PRId64 " | %8s | %8s | %8s |" CYAN_BOLD(" #%u") YELLOW(" %s") " %s",
|
||||
i,
|
||||
data.affinity,
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval), num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval), num + 8, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval), num + 8 * 2, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval) * scale, num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::MediumInterval) * scale, num + 16, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(i, Hashrate::LargeInterval) * scale, num + 16 * 2, sizeof num / 3),
|
||||
data.device.index(),
|
||||
data.device.topology().toString().data(),
|
||||
data.device.printableName().data()
|
||||
|
@ -366,10 +393,10 @@ void xmrig::OclBackend::printHashrate(bool details)
|
|||
i++;
|
||||
}
|
||||
|
||||
Log::print(WHITE_BOLD_S "| - | - | %7s | %7s | %7s |",
|
||||
Hashrate::format(hashrate()->calc(Hashrate::ShortInterval), num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::MediumInterval), num + 8, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::LargeInterval), num + 8 * 2, sizeof num / 3)
|
||||
Log::print(WHITE_BOLD_S "| - | - | %8s | %8s | %8s |",
|
||||
Hashrate::format(hashrate()->calc(Hashrate::ShortInterval) * scale, num, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::MediumInterval) * scale, num + 16, sizeof num / 3),
|
||||
Hashrate::format(hashrate()->calc(Hashrate::LargeInterval) * scale, num + 16 * 2, sizeof num / 3)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -259,12 +259,20 @@ public:
|
|||
backend->printHashrate(details);
|
||||
}
|
||||
|
||||
LOG_INFO("%s " WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("H/s") " max " CYAN_BOLD("%s H/s"),
|
||||
double scale = 1.0;
|
||||
const char* h = "H/s";
|
||||
|
||||
if ((speed[0] >= 1e6) || (speed[1] >= 1e6) || (speed[2] >= 1e6) || (maxHashrate[algorithm] >= 1e6)) {
|
||||
scale = 1e-6;
|
||||
h = "MH/s";
|
||||
}
|
||||
|
||||
LOG_INFO("%s " WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("%s") " max " CYAN_BOLD("%s %s"),
|
||||
Tags::miner(),
|
||||
Hashrate::format(speed[0], num, sizeof(num) / 4),
|
||||
Hashrate::format(speed[1], num + 16, sizeof(num) / 4),
|
||||
Hashrate::format(speed[2], num + 16 * 2, sizeof(num) / 4 ),
|
||||
Hashrate::format(maxHashrate[algorithm], num + 16 * 3, sizeof(num) / 4)
|
||||
Hashrate::format(speed[0] * scale, num, sizeof(num) / 4),
|
||||
Hashrate::format(speed[1] * scale, num + 16, sizeof(num) / 4),
|
||||
Hashrate::format(speed[2] * scale, num + 16 * 2, sizeof(num) / 4), h,
|
||||
Hashrate::format(maxHashrate[algorithm] * scale, num + 16 * 3, sizeof(num) / 4), h
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,6 +114,16 @@ static inline uint32_t clz(uint32_t a)
|
|||
}
|
||||
|
||||
|
||||
uint64_t KPCache::cache_size(uint32_t epoch)
|
||||
{
|
||||
if (epoch >= sizeof(cache_sizes) / sizeof(cache_sizes[0])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cache_sizes[epoch];
|
||||
}
|
||||
|
||||
|
||||
uint64_t KPCache::dag_size(uint32_t epoch)
|
||||
{
|
||||
if (epoch >= sizeof(dag_sizes) / sizeof(dag_sizes[0])) {
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
|
||||
const uint32_t* l1_cache() const { return m_l1Cache; }
|
||||
|
||||
static uint64_t cache_size(uint32_t epoch);
|
||||
static uint64_t dag_size(uint32_t epoch);
|
||||
|
||||
static void calculate_fast_mod_data(uint32_t divisor, uint32_t &reciprocal, uint32_t &increment, uint32_t& shift);
|
||||
|
|
|
@ -192,15 +192,32 @@ void xmrig::Network::onPause(IStrategy *strategy)
|
|||
}
|
||||
|
||||
|
||||
static void scale_diff(uint64_t& diff, const char* &scale)
|
||||
{
|
||||
if (diff >= 100000000) {
|
||||
diff /= 1000000;
|
||||
scale = "M";
|
||||
}
|
||||
else if (diff >= 1000000) {
|
||||
diff /= 1000;
|
||||
scale = "K";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::Network::onResultAccepted(IStrategy *, IClient *, const SubmitResult &result, const char *error)
|
||||
{
|
||||
uint64_t diff = result.diff;
|
||||
const char* scale = "";
|
||||
scale_diff(diff, scale);
|
||||
|
||||
if (error) {
|
||||
LOG_INFO("%s " RED_BOLD("rejected") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " RED("\"%s\"") " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
backend_tag(result.backend), m_state->accepted(), m_state->rejected(), result.diff, error, result.elapsed);
|
||||
LOG_INFO("%s " RED_BOLD("rejected") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64 "%s") " " RED("\"%s\"") " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
backend_tag(result.backend), m_state->accepted(), m_state->rejected(), diff, scale, error, result.elapsed);
|
||||
}
|
||||
else {
|
||||
LOG_INFO("%s " GREEN_BOLD("accepted") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64) " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
backend_tag(result.backend), m_state->accepted(), m_state->rejected(), result.diff, result.elapsed);
|
||||
LOG_INFO("%s " GREEN_BOLD("accepted") " (%" PRId64 "/%" PRId64 ") diff " WHITE_BOLD("%" PRIu64 "%s") " " BLACK_BOLD("(%" PRIu64 " ms)"),
|
||||
backend_tag(result.backend), m_state->accepted(), m_state->rejected(), diff, scale, result.elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,13 +247,17 @@ 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 = "";
|
||||
scale_diff(diff, scale);
|
||||
|
||||
if (job.height()) {
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName(), job.height());
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), diff, scale, job.algorithm().shortName(), job.height());
|
||||
}
|
||||
else {
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s"),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName());
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64 "%s") " algo " WHITE_BOLD("%s"),
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), diff, scale, job.algorithm().shortName());
|
||||
}
|
||||
|
||||
if (!donate && m_donate) {
|
||||
|
|
Loading…
Reference in a new issue