Print benchmark url

This commit is contained in:
XMRig 2020-10-30 23:24:01 +07:00
parent 4914fefb1f
commit 5f314edb2f
No known key found for this signature in database
GPG key ID: 446A53638BE94409
5 changed files with 29 additions and 3 deletions

View file

@ -0,0 +1,3 @@
@echo off
xmrig.exe --bench=10M --submit
pause

3
scripts/benchmark_1M.cmd Normal file
View file

@ -0,0 +1,3 @@
@echo off
xmrig.exe --bench=1M --submit
pause

View file

@ -55,7 +55,9 @@ xmrig::Benchmark::Benchmark(const Job &job, size_t workers, const IBackend *back
m_end(job.benchSize()),
m_hash(job.benchHash())
{
m_httpListener = std::make_shared<HttpListener>(this, Tags::bench());
if (!m_token.isEmpty()) {
m_httpListener = std::make_shared<HttpListener>(this, Tags::bench());
}
}
@ -73,7 +75,6 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
const char *color = checkData ? ((m_data == checkData) ? GREEN_BOLD_S : RED_BOLD_S) : BLACK_BOLD_S;
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);
LOG_INFO("%s " WHITE_BOLD("press ") MAGENTA_BOLD("Ctrl+C") WHITE_BOLD(" to exit"), Tags::bench());
if (!m_token.isEmpty()) {
using namespace rapidjson;
@ -87,6 +88,9 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
send(doc);
}
else {
printExit();
}
return true;
}
@ -152,6 +156,11 @@ void xmrig::Benchmark::onHttpData(const HttpData &data)
if (data.status != 200) {
return setError(data.statusName());
}
if (m_doneTime) {
LOG_NOTICE("%s " WHITE_BOLD("benchmark submitted ") CYAN_BOLD("https://xmrig.com/benchmark/%s"), Tags::bench(), m_id.data());
printExit();
}
}
@ -174,6 +183,12 @@ uint64_t xmrig::Benchmark::referenceHash() const
}
void xmrig::Benchmark::printExit()
{
LOG_INFO("%s " WHITE_BOLD("press ") MAGENTA_BOLD("Ctrl+C") WHITE_BOLD(" to exit"), Tags::bench());
}
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);

View file

@ -55,6 +55,7 @@ protected:
private:
uint64_t referenceHash() const;
void printExit();
void send(const rapidjson::Value &body);
void setError(const char *message);

View file

@ -181,7 +181,11 @@ 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 in offline mode, N can be between 1M and 10M\n";
u += " --bench=N run benchmark, N can be between 1M and 10M\n";
u += " --submit perform an online benchmark and submit result for sharing\n";
u += " --verify=ID verify submitted benchmark by ID\n";
u += " --seed=SEED custom RandomX seed for benchmark\n";
u += " --hash=HASH compare benchmark result with specified hash\n";
# endif
return u;