diff --git a/src/Cpu_mac.cpp b/src/Cpu_mac.cpp index 357e15efe..085148bc4 100644 --- a/src/Cpu_mac.cpp +++ b/src/Cpu_mac.cpp @@ -4,8 +4,8 @@ * Copyright 2014 Lucas Jones * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee - * Copyright 2016-2017 XMRig - * + * Copyright 2016 Jay D Dee + * Copyright 2016-2018 XMRig , * * 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 @@ -38,8 +38,3 @@ void Cpu::init() initCommon(); } - - -void Cpu::setAffinity(int id, uint64_t mask) -{ -} diff --git a/src/api/ApiRouter.cpp b/src/api/ApiRouter.cpp index b8caac9ca..42256cc9b 100644 --- a/src/api/ApiRouter.cpp +++ b/src/api/ApiRouter.cpp @@ -285,6 +285,8 @@ void ApiRouter::getThreads(rapidjson::Document &doc) const auto &allocator = doc.GetAllocator(); const Hashrate *hr = Workers::hashrate(); + Workers::threadsSummary(doc); + const std::vector &threads = m_controller->config()->threads(); rapidjson::Value list(rapidjson::kArrayType); diff --git a/src/workers/Workers.cpp b/src/workers/Workers.cpp index 82ad54ebf..e1609c0ee 100644 --- a/src/workers/Workers.cpp +++ b/src/workers/Workers.cpp @@ -33,6 +33,7 @@ #include "interfaces/IThread.h" #include "log/Log.h" #include "Mem.h" +#include "rapidjson/document.h" #include "workers/Handle.h" #include "workers/Hashrate.h" #include "workers/MultiWorker.h" @@ -188,6 +189,26 @@ void Workers::submit(const JobResult &result) } +#ifndef XMRIG_NO_API +void Workers::threadsSummary(rapidjson::Document &doc) +{ + uv_mutex_lock(&m_mutex); + const size_t pages[2] = { m_status.hugePages, m_status.pages }; + const size_t memory = m_status.ways * xmrig::cn_select_memory(m_status.algo); + uv_mutex_unlock(&m_mutex); + + auto &allocator = doc.GetAllocator(); + + rapidjson::Value hugepages(rapidjson::kArrayType); + hugepages.PushBack(pages[0], allocator); + hugepages.PushBack(pages[1], allocator); + + doc.AddMember("hugepages", hugepages, allocator); + doc.AddMember("memory", memory, allocator); +} +#endif + + void Workers::onReady(void *arg) { auto handle = static_cast(arg); diff --git a/src/workers/Workers.h b/src/workers/Workers.h index f96aa2cab..bbe9a7609 100644 --- a/src/workers/Workers.h +++ b/src/workers/Workers.h @@ -32,6 +32,7 @@ #include "net/Job.h" #include "net/JobResult.h" +#include "rapidjson/fwd.h" class Handle; @@ -66,6 +67,10 @@ public: static inline void pause() { m_active = false; m_paused = 1; m_sequence++; } static inline void setListener(IJobResultListener *listener) { m_listener = listener; } +# ifndef XMRIG_NO_API + static void threadsSummary(rapidjson::Document &doc); +# endif + private: static void onReady(void *arg); static void onResult(uv_async_t *handle);