Browse Source

Added DMI data to online benchmark.

feature-dmi
XMRig 3 years ago
parent
commit
ef8cc28f3f
No known key found for this signature in database GPG Key ID: 446A53638BE94409
  1. 6
      src/base/net/stratum/Pools.cpp
  2. 4
      src/base/net/stratum/Pools.h
  3. 17
      src/base/net/stratum/benchmark/BenchClient.cpp
  4. 4
      src/base/net/stratum/benchmark/BenchClient.h
  5. 11
      src/base/net/stratum/benchmark/BenchConfig.cpp
  6. 10
      src/base/net/stratum/benchmark/BenchConfig.h
  7. 2
      src/hw/api/HwApi.cpp

6
src/base/net/stratum/Pools.cpp

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -134,7 +134,7 @@ void xmrig::Pools::load(const IJsonReader &reader)
m_data.clear();
# ifdef XMRIG_FEATURE_BENCHMARK
m_benchmark = std::shared_ptr<BenchConfig>(BenchConfig::create(reader.getObject(BenchConfig::kBenchmark)));
m_benchmark = std::shared_ptr<BenchConfig>(BenchConfig::create(reader.getObject(BenchConfig::kBenchmark), reader.getBool("dmi", true)));
if (m_benchmark) {
m_data.emplace_back(m_benchmark);

4
src/base/net/stratum/Pools.h

@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

17
src/base/net/stratum/benchmark/BenchClient.cpp

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,6 +34,10 @@
#include "base/tools/Cvt.h"
#include "version.h"
#ifdef XMRIG_FEATURE_DMI
# include "hw/dmi/DmiReader.h"
#endif
xmrig::BenchClient::BenchClient(const std::shared_ptr<BenchConfig> &benchmark, IClientListener* listener) :
m_listener(listener),
@ -336,6 +340,15 @@ void xmrig::BenchClient::send(Request request)
doc.AddMember("steady_ready_ts", m_readyTime, allocator);
doc.AddMember("cpu", Cpu::toJSON(doc), allocator);
# ifdef XMRIG_FEATURE_DMI
if (m_benchmark->isDMI()) {
DmiReader reader;
if (reader.read()) {
doc.AddMember("dmi", reader.toJSON(doc), allocator);
}
}
# endif
FetchRequest req(HTTP_POST, m_ip, BenchConfig::kApiPort, "/1/benchmark", doc, BenchConfig::kApiTLS, true);
fetch(tag(), std::move(req), m_httpListener);
}

4
src/base/net/stratum/benchmark/BenchClient.h

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

11
src/base/net/stratum/benchmark/BenchConfig.cpp

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,8 +52,9 @@ const char *BenchConfig::kApiHost = "127.0.0.1";
} // namespace xmrig
xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson::Value &object) :
xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson::Value &object, bool dmi) :
m_algorithm(Json::getString(object, kAlgo)),
m_dmi(dmi),
m_submit(Json::getBool(object, kSubmit)),
m_id(id),
m_seed(Json::getString(object, kSeed)),
@ -72,7 +73,7 @@ xmrig::BenchConfig::BenchConfig(uint32_t size, const String &id, const rapidjson
}
xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object)
xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object, bool dmi)
{
if (!object.IsObject() || object.ObjectEmpty()) {
return nullptr;
@ -85,7 +86,7 @@ xmrig::BenchConfig *xmrig::BenchConfig::create(const rapidjson::Value &object)
return nullptr;
}
return new BenchConfig(size, id, object);
return new BenchConfig(size, id, object, dmi);
}

10
src/base/net/stratum/benchmark/BenchConfig.h

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -49,10 +49,11 @@ public:
static constexpr const uint16_t kApiPort = 18805;
# endif
BenchConfig(uint32_t size, const String &id, const rapidjson::Value &object);
BenchConfig(uint32_t size, const String &id, const rapidjson::Value &object, bool dmi);
static BenchConfig *create(const rapidjson::Value &object);
static BenchConfig *create(const rapidjson::Value &object, bool dmi);
inline bool isDMI() const { return m_dmi; }
inline bool isSubmit() const { return m_submit; }
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const String &id() const { return m_id; }
@ -67,6 +68,7 @@ private:
static uint32_t getSize(const char *benchmark);
Algorithm m_algorithm;
bool m_dmi;
bool m_submit;
String m_id;
String m_seed;

2
src/hw/api/HwApi.cpp

@ -21,8 +21,6 @@
#include "base/api/interfaces/IApiRequest.h"
#include "base/tools/String.h"
#include "base/io/log/Log.h" // FIXME
#ifdef XMRIG_FEATURE_DMI
# include "hw/dmi/DmiReader.h"

Loading…
Cancel
Save