1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-27 22:33:29 -05:00

Added benchmark support

This commit is contained in:
MoneroOcean
2019-07-21 22:31:52 -07:00
parent 9660dfc7b3
commit e6f199e4f4
18 changed files with 309 additions and 22 deletions

View File

@@ -50,6 +50,7 @@ bool xmrig::Config::read(const IJsonReader &reader, const char *fileName)
}
m_cpu.read(reader.getValue("cpu"));
m_benchmark.read(reader.getValue("algo-perf"));
return true;
}
@@ -72,6 +73,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember("background", isBackground(), allocator);
doc.AddMember("colors", Log::colors, allocator);
doc.AddMember("cpu", m_cpu.toJSON(doc), allocator);
doc.AddMember("algo-perf", m_benchmark.toJSON(doc), allocator);
doc.AddMember("donate-level", m_pools.donateLevel(), allocator);
doc.AddMember("donate-over-proxy", m_pools.proxyDonate(), allocator);
doc.AddMember("http", m_http.toJSON(doc), allocator);
@@ -83,4 +85,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember("syslog", isSyslog(), allocator);
doc.AddMember("user-agent", m_userAgent.toJSON(), allocator);
doc.AddMember("watch", m_watch, allocator);
doc.AddMember("rebench-algo", isRebenchAlgo(), allocator);
doc.AddMember("bench-algo-time", benchAlgoTime(), allocator);
}

View File

@@ -31,6 +31,7 @@
#include "backend/cpu/CpuConfig.h"
#include "base/kernel/config/BaseConfig.h"
#include "core/Benchmark.h"
#include "rapidjson/fwd.h"
@@ -48,12 +49,14 @@ public:
bool read(const IJsonReader &reader, const char *fileName) override;
void getJSON(rapidjson::Document &doc) const override;
inline bool isShouldSave() const { return (m_shouldSave || m_upgrade || m_cpu.isShouldSave()) && isAutoSave(); }
inline bool isShouldSave() const { return (m_shouldSave || m_upgrade || m_cpu.isShouldSave() || m_benchmark.isNewBenchRun()) && isAutoSave(); }
inline const CpuConfig &cpu() const { return m_cpu; }
inline Benchmark &benchmark() { return m_benchmark; }
private:
bool m_shouldSave = false;
CpuConfig m_cpu;
Benchmark m_benchmark;
};

View File

@@ -81,6 +81,10 @@ static const option options[] = {
{ "asm", 1, nullptr, IConfig::AssemblyKey },
{ "daemon", 0, nullptr, IConfig::DaemonKey },
{ "daemon-poll-interval", 1, nullptr, IConfig::DaemonPollKey },
{ "rebench-algo", 0, nullptr, IConfig::RebenchAlgoKey },
{ "bench-algo-time", 1, nullptr, IConfig::BenchAlgoTimeKey },
{ nullptr, 0, nullptr, 0 }
};