Finalize config changes.

This commit is contained in:
XMRig 2018-04-15 21:41:03 +07:00
parent f8bf48a522
commit dba1acd302
5 changed files with 59 additions and 22 deletions

View file

@ -245,7 +245,9 @@ xmrig::CpuThread::Data xmrig::CpuThread::parse(const rapidjson::Value &object)
#ifndef XMRIG_NO_API
rapidjson::Value xmrig::CpuThread::toAPI(rapidjson::Document &doc) const
{
rapidjson::Value obj(rapidjson::kObjectType);
using namespace rapidjson;
Value obj(kObjectType);
auto &allocator = doc.GetAllocator();
obj.AddMember("type", "cpu", allocator);
@ -259,3 +261,17 @@ rapidjson::Value xmrig::CpuThread::toAPI(rapidjson::Document &doc) const
return obj;
}
#endif
rapidjson::Value xmrig::CpuThread::toConfig(rapidjson::Document &doc) const
{
using namespace rapidjson;
Value obj(kObjectType);
auto &allocator = doc.GetAllocator();
obj.AddMember("low_power_mode", multiway(), allocator);
obj.AddMember("affine_to_cpu", affinity() == -1L ? Value(kFalseType) : Value(affinity()), allocator);
return obj;
}

View file

@ -77,10 +77,13 @@ public:
inline size_t index() const override { return m_index; }
inline Type type() const override { return CPU; }
protected:
# ifndef XMRIG_NO_API
rapidjson::Value toAPI(rapidjson::Document &doc) const override;
# endif
rapidjson::Value toConfig(rapidjson::Document &doc) const override;
private:
const Algo m_algorithm;
const AlgoVariant m_av;