Hashrate display fixes

This commit is contained in:
SChernykh 2020-05-28 22:23:31 +02:00
parent 2e3d087750
commit c9730faa49
2 changed files with 79 additions and 25 deletions

View file

@ -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)
);
}

View file

@ -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)
);
}