diff --git a/src/backend/cuda/CudaBackend.cpp b/src/backend/cuda/CudaBackend.cpp index 9043299c1..903c096ff 100644 --- a/src/backend/cuda/CudaBackend.cpp +++ b/src/backend/cuda/CudaBackend.cpp @@ -169,7 +169,7 @@ public: } - inline void start(const Job &job) + inline void start(const Job &) { LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" threads)") " scratchpad " CYAN_BOLD("%zu KB"), tag, @@ -285,7 +285,7 @@ void xmrig::CudaBackend::printHashrate(bool details) size_t i = 0; for (const auto &data : d_ptr->threads) { - Log::print("| %8zu | %8" PRId64 " | %7s | %7s | %7s |" CYAN_BOLD(" #%u") YELLOW(" %s") " %s", + Log::print("| %8zu | %8" PRId64 " | %7s | %7s | %7s |" CYAN_BOLD(" #%u") YELLOW(" %s") GREEN(" %s"), i, data.thread.affinity(), Hashrate::format(hashrate()->calc(i, Hashrate::ShortInterval), num, sizeof num / 3), @@ -390,6 +390,27 @@ rapidjson::Value xmrig::CudaBackend::toJSON(rapidjson::Document &doc) const out.AddMember("algo", d_ptr->algo.toJSON(), allocator); out.AddMember("profile", profileName().toJSON(), allocator); + if (d_ptr->threads.empty() || !hashrate()) { + return out; + } + + out.AddMember("hashrate", hashrate()->toJSON(doc), allocator); + + Value threads(kArrayType); + + size_t i = 0; + for (const auto &data : d_ptr->threads) { + Value thread = data.thread.toJSON(doc); + thread.AddMember("hashrate", hashrate()->toJSON(i, doc), allocator); + + data.device.toJSON(thread, doc); + + i++; + threads.PushBack(thread, allocator); + } + + out.AddMember("threads", threads, allocator); + return out; } diff --git a/src/backend/cuda/wrappers/CudaDevice.cpp b/src/backend/cuda/wrappers/CudaDevice.cpp index 7eb947fc2..740a063c5 100644 --- a/src/backend/cuda/wrappers/CudaDevice.cpp +++ b/src/backend/cuda/wrappers/CudaDevice.cpp @@ -115,5 +115,15 @@ void xmrig::CudaDevice::generate(const Algorithm &algorithm, CudaThreads &thread #ifdef XMRIG_FEATURE_API void xmrig::CudaDevice::toJSON(rapidjson::Value &out, rapidjson::Document &doc) const { + using namespace rapidjson; + auto &allocator = doc.GetAllocator(); + + out.AddMember("name", name().toJSON(doc), allocator); + out.AddMember("bus_id", topology().toString().toJSON(doc), allocator); + out.AddMember("smx", smx(), allocator); + out.AddMember("arch", arch(), allocator); + out.AddMember("global_mem", static_cast(globalMemSize()), allocator); + out.AddMember("clock", clock(), allocator); + out.AddMember("memory_clock", memoryClock(), allocator); } #endif diff --git a/src/backend/cuda/wrappers/CudaDevice.h b/src/backend/cuda/wrappers/CudaDevice.h index 40b8ee11f..07866c82e 100644 --- a/src/backend/cuda/wrappers/CudaDevice.h +++ b/src/backend/cuda/wrappers/CudaDevice.h @@ -60,6 +60,7 @@ public: inline bool isValid() const { return m_ctx != nullptr; } inline const PciTopology &topology() const { return m_topology; } inline const String &name() const { return m_name; } + inline uint32_t arch() const { return (computeCapability(true) * 10) + computeCapability(false); } inline uint32_t index() const { return m_index; } # ifdef XMRIG_FEATURE_API diff --git a/src/backend/opencl/OclBackend.cpp b/src/backend/opencl/OclBackend.cpp index 8aadc9264..c9fef1f91 100644 --- a/src/backend/opencl/OclBackend.cpp +++ b/src/backend/opencl/OclBackend.cpp @@ -409,7 +409,7 @@ rapidjson::Value xmrig::OclBackend::toJSON(rapidjson::Document &doc) const Value threads(kArrayType); size_t i = 0; - for (const OclLaunchData &data : d_ptr->threads) { + for (const auto &data : d_ptr->threads) { Value thread = data.thread.toJSON(doc); thread.AddMember("affinity", data.affinity, allocator); thread.AddMember("hashrate", hashrate()->toJSON(i, doc), allocator);