Added --token command line option.
This commit is contained in:
parent
95d3293f4b
commit
f08887180d
7 changed files with 13 additions and 3 deletions
|
@ -87,7 +87,7 @@ bool xmrig::Benchmark::finish(uint64_t totalHashCount)
|
||||||
|
|
||||||
doc.AddMember("steady_done_ts", m_doneTime, allocator);
|
doc.AddMember("steady_done_ts", m_doneTime, allocator);
|
||||||
doc.AddMember(StringRef(BenchConfig::kHash), Value(fmt::format("{:016X}", m_data).c_str(), allocator), allocator);
|
doc.AddMember(StringRef(BenchConfig::kHash), Value(fmt::format("{:016X}", m_data).c_str(), allocator), allocator);
|
||||||
doc.AddMember("backend", m_backend->toJSON(doc), allocator); // FIXME
|
doc.AddMember("backend", m_backend->toJSON(doc), allocator);
|
||||||
|
|
||||||
send(doc);
|
send(doc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
BenchVerifyKey = 1045,
|
BenchVerifyKey = 1045,
|
||||||
BenchSeedKey = 1046,
|
BenchSeedKey = 1046,
|
||||||
BenchHashKey = 1047,
|
BenchHashKey = 1047,
|
||||||
|
BenchTokenKey = 1048,
|
||||||
|
|
||||||
// xmrig common
|
// xmrig common
|
||||||
CPUPriorityKey = 1021,
|
CPUPriorityKey = 1021,
|
||||||
|
|
|
@ -54,6 +54,7 @@ xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, I
|
||||||
|
|
||||||
if (!m_benchmark->id().isEmpty()) {
|
if (!m_benchmark->id().isEmpty()) {
|
||||||
m_job.setId(m_benchmark->id());
|
m_job.setId(m_benchmark->id());
|
||||||
|
m_job.setBenchToken(m_benchmark->token());
|
||||||
m_mode = ONLINE_VERIFY;
|
m_mode = ONLINE_VERIFY;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -57,6 +57,7 @@ xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson
|
||||||
m_submit(Json::getBool(object, kSubmit)),
|
m_submit(Json::getBool(object, kSubmit)),
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_seed(Json::getString(object, kSeed)),
|
m_seed(Json::getString(object, kSeed)),
|
||||||
|
m_token(Json::getString(object, kToken)),
|
||||||
m_size(size),
|
m_size(size),
|
||||||
m_hash(0)
|
m_hash(0)
|
||||||
{
|
{
|
||||||
|
@ -91,12 +92,12 @@ xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object)
|
||||||
uint32_t xmrig::BenchConfig::getSize(const char *benchmark)
|
uint32_t xmrig::BenchConfig::getSize(const char *benchmark)
|
||||||
{
|
{
|
||||||
if (!benchmark) {
|
if (!benchmark) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto size = strtoul(benchmark, nullptr, 10);
|
const auto size = strtoul(benchmark, nullptr, 10);
|
||||||
if (size < 1 || size > 10) {
|
if (size < 1 || size > 10) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;
|
return strcasecmp(benchmark, fmt::format("{}M", size).c_str()) == 0 ? size * 1000000 : 0;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
inline const Algorithm &algorithm() const { return m_algorithm; }
|
inline const Algorithm &algorithm() const { return m_algorithm; }
|
||||||
inline const String &id() const { return m_id; }
|
inline const String &id() const { return m_id; }
|
||||||
inline const String &seed() const { return m_seed; }
|
inline const String &seed() const { return m_seed; }
|
||||||
|
inline const String &token() const { return m_token; }
|
||||||
inline uint32_t size() const { return m_size; }
|
inline uint32_t size() const { return m_size; }
|
||||||
inline uint64_t hash() const { return m_hash; }
|
inline uint64_t hash() const { return m_hash; }
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ private:
|
||||||
bool m_submit;
|
bool m_submit;
|
||||||
String m_id;
|
String m_id;
|
||||||
String m_seed;
|
String m_seed;
|
||||||
|
String m_token;
|
||||||
uint32_t m_size;
|
uint32_t m_size;
|
||||||
uint64_t m_hash;
|
uint64_t m_hash;
|
||||||
};
|
};
|
||||||
|
|
|
@ -257,6 +257,7 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
|
||||||
case IConfig::StressKey: /* --stress */
|
case IConfig::StressKey: /* --stress */
|
||||||
case IConfig::BenchSubmitKey: /* --submit */
|
case IConfig::BenchSubmitKey: /* --submit */
|
||||||
case IConfig::BenchVerifyKey: /* --verify */
|
case IConfig::BenchVerifyKey: /* --verify */
|
||||||
|
case IConfig::BenchTokenKey: /* --token */
|
||||||
case IConfig::BenchSeedKey: /* --seed */
|
case IConfig::BenchSeedKey: /* --seed */
|
||||||
case IConfig::BenchHashKey: /* --hash */
|
case IConfig::BenchHashKey: /* --hash */
|
||||||
return transformBenchmark(doc, key, arg);
|
return transformBenchmark(doc, key, arg);
|
||||||
|
@ -333,6 +334,9 @@ void xmrig::ConfigTransform::transformBenchmark(rapidjson::Document &doc, int ke
|
||||||
case IConfig::BenchVerifyKey: /* --verify */
|
case IConfig::BenchVerifyKey: /* --verify */
|
||||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kVerify, arg);
|
return set(doc, BenchConfig::kBenchmark, BenchConfig::kVerify, arg);
|
||||||
|
|
||||||
|
case IConfig::BenchTokenKey: /* --token */
|
||||||
|
return set(doc, BenchConfig::kBenchmark, BenchConfig::kToken, arg);
|
||||||
|
|
||||||
case IConfig::BenchSeedKey: /* --seed */
|
case IConfig::BenchSeedKey: /* --seed */
|
||||||
return set(doc, BenchConfig::kBenchmark, BenchConfig::kSeed, arg);
|
return set(doc, BenchConfig::kBenchmark, BenchConfig::kSeed, arg);
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ static const option options[] = {
|
||||||
# ifdef XMRIG_FEATURE_HTTP
|
# ifdef XMRIG_FEATURE_HTTP
|
||||||
{ "submit", 0, nullptr, IConfig::BenchSubmitKey },
|
{ "submit", 0, nullptr, IConfig::BenchSubmitKey },
|
||||||
{ "verify", 1, nullptr, IConfig::BenchVerifyKey },
|
{ "verify", 1, nullptr, IConfig::BenchVerifyKey },
|
||||||
|
{ "token", 1, nullptr, IConfig::BenchTokenKey },
|
||||||
# endif
|
# endif
|
||||||
{ "seed", 1, nullptr, IConfig::BenchSeedKey },
|
{ "seed", 1, nullptr, IConfig::BenchSeedKey },
|
||||||
{ "hash", 1, nullptr, IConfig::BenchHashKey },
|
{ "hash", 1, nullptr, IConfig::BenchHashKey },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue