Improve some benchmark log messages.

This commit is contained in:
XMRig 2020-10-16 04:11:50 +07:00
parent a152d6be42
commit 5155139e9a
No known key found for this signature in database
GPG key ID: 446A53638BE94409
5 changed files with 45 additions and 9 deletions

View file

@ -241,7 +241,9 @@ bool xmrig::Workers<T>::tick(uint64_t)
const char* color = checkData ? ((benchData == checkData) ? GREEN_BOLD_S : RED_BOLD_S) : BLACK_BOLD_S;
LOG_INFO("%s Benchmark finished in %.3f seconds, hash sum = %s%016" PRIX64 CLEAR, Tags::miner(), dt, color, benchData);
LOG_INFO("%s " WHITE_BOLD("benchmark finished in ") CYAN_BOLD("%.3f seconds") WHITE_BOLD_S " hash sum = " CLEAR "%s%016" PRIX64 CLEAR,
Tags::bench(), dt, color, benchData);
return false;
}
}

View file

@ -103,6 +103,7 @@ private:
#define WHITE_S CSI "0;37m" // another name for LT.GRAY
#define WHITE_BOLD_S CSI "1;37m" // actually white
#define RED_BG_BOLD_S CSI "41;1m"
#define GREEN_BG_BOLD_S CSI "42;1m"
#define YELLOW_BG_BOLD_S CSI "43;1m"
#define BLUE_BG_S CSI "44m"
@ -130,6 +131,7 @@ private:
#define WHITE(x) WHITE_S x CLEAR
#define WHITE_BOLD(x) WHITE_BOLD_S x CLEAR
#define RED_BG_BOLD(x) RED_BG_BOLD_S x CLEAR
#define GREEN_BG_BOLD(x) GREEN_BG_BOLD_S x CLEAR
#define YELLOW_BG_BOLD(x) YELLOW_BG_BOLD_S x CLEAR
#define BLUE_BG(x) BLUE_BG_S x CLEAR

View file

@ -70,6 +70,16 @@ const char *xmrig::Tags::randomx()
return tag;
}
#endif
#ifdef XMRIG_FEATURE_BENCHMARK
const char *xmrig::Tags::bench()
{
static const char *tag = RED_BG_BOLD(WHITE_BOLD_S " bench ");
return tag;
}
#endif
#endif

View file

@ -40,6 +40,9 @@ public:
# ifdef XMRIG_ALGO_RANDOMX
static const char *randomx();
# endif
# ifdef XMRIG_FEATURE_BENCHMARK
static const char *bench();
# endif
# endif
# ifdef XMRIG_PROXY_PROJECT

View file

@ -124,9 +124,23 @@ void xmrig::Network::onActive(IStrategy *strategy, IClient *client)
return;
}
const auto &pool = client->pool();
# ifdef XMRIG_FEATURE_BENCHMARK
if (pool.mode() == Pool::MODE_BENCHMARK) {
LOG_NOTICE("%s " MAGENTA_BOLD("start benchmark ") "hashes " CYAN_BOLD("%" PRIu64 "M") " algo " WHITE_BOLD("%s") " print_time " CYAN_BOLD("%us"),
Tags::bench(),
pool.benchSize() / 1000000,
client->job().algorithm().shortName(),
m_controller->config()->printTime());
return;
}
# endif
const char *tlsVersion = client->tlsVersion();
LOG_INFO("%s " WHITE_BOLD("use %s ") CYAN_BOLD("%s:%d ") GREEN_BOLD("%s") " " BLACK_BOLD("%s"),
Tags::network(), client->mode(), client->pool().host().data(), client->pool().port(), tlsVersion ? tlsVersion : "", client->ip().data());
Tags::network(), client->mode(), pool.host().data(), pool.port(), tlsVersion ? tlsVersion : "", client->ip().data());
const char *fingerprint = client->tlsFingerprint();
if (fingerprint != nullptr) {
@ -255,6 +269,10 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
uint64_t diff = job.diff();;
const char *scale = NetworkState::scaleDiff(diff);
# ifdef XMRIG_FEATURE_BENCHMARK
if (!job.bench())
# endif
{
if (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());
@ -263,6 +281,7 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
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) {
m_donate->setAlgo(job.algorithm());