From 812cd9760f73e193c2e0e5024d85d88d51325be3 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sat, 15 Sep 2018 16:48:57 +0300 Subject: [PATCH] Added debug thread log. --- src/Summary.cpp | 2 ++ src/common/interfaces/IConfig.h | 18 +++++++++++------- src/interfaces/IThread.h | 10 +++++++--- src/workers/CpuThread.cpp | 12 ++++++++++++ src/workers/CpuThread.h | 10 +++++++--- src/workers/Workers.cpp | 8 ++++++++ 6 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/Summary.cpp b/src/Summary.cpp index fe538fda..76842d5b 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -134,9 +134,11 @@ static void print_pools(xmrig::Config *config) } # ifdef APP_DEBUG + LOG_NOTICE("POOLS --------------------------------------------------------------------"); for (const Pool &pool : pools) { pool.print(); } + LOG_NOTICE("--------------------------------------------------------------------------"); # endif } diff --git a/src/common/interfaces/IConfig.h b/src/common/interfaces/IConfig.h index fb622e37..95a4babf 100644 --- a/src/common/interfaces/IConfig.h +++ b/src/common/interfaces/IConfig.h @@ -80,13 +80,17 @@ public: HardwareAESKey = 1011, // xmrig amd - OclPlatform = 1400, - OclAffinity = 1401, - OclDevices = 1402, - OclLaunch = 1403, - OclCache = 1404, - OclPrint = 1405, - OclLoader = 1406, + OclPlatformKey = 1400, + OclAffinityKey = 1401, + OclDevicesKey = 1402, + OclLaunchKey = 1403, + OclCacheKey = 1404, + OclPrintKey = 1405, + OclLoaderKey = 1406, + OclSridedIndexKey = 1407, + OclMemChunkKey = 1408, + OclUnrollKey = 1409, + OclCompModeKey = 1410, // xmrig-proxy AccessLogFileKey = 'A', diff --git a/src/interfaces/IThread.h b/src/interfaces/IThread.h index 2e9e3c39..3a8708e6 100644 --- a/src/interfaces/IThread.h +++ b/src/interfaces/IThread.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef __ITHREAD_H__ -#define __ITHREAD_H__ +#ifndef XMRIG_ITHREAD_H +#define XMRIG_ITHREAD_H #include @@ -64,10 +64,14 @@ public: # ifndef XMRIG_NO_API virtual rapidjson::Value toAPI(rapidjson::Document &doc) const = 0; # endif + +# ifdef APP_DEBUG + virtual void print() const = 0; +# endif }; } /* namespace xmrig */ -#endif // __ITHREAD_H__ +#endif // XMRIG_ITHREAD_H diff --git a/src/workers/CpuThread.cpp b/src/workers/CpuThread.cpp index bdf09af4..ca7681f0 100644 --- a/src/workers/CpuThread.cpp +++ b/src/workers/CpuThread.cpp @@ -24,6 +24,7 @@ #include +#include "common/log/Log.h" #include "common/net/Pool.h" #include "rapidjson/document.h" #include "workers/CpuThread.h" @@ -361,6 +362,17 @@ xmrig::IThread::Multiway xmrig::CpuThread::multiway(AlgoVariant av) } +#ifdef APP_DEBUG +void xmrig::CpuThread::print() const +{ + LOG_DEBUG(GREEN_BOLD("CPU thread: ") " index " WHITE_BOLD("%zu") ", multiway " WHITE_BOLD("%d") ", av " WHITE_BOLD("%d") ",", + index(), static_cast(multiway()), static_cast(m_av)); + + LOG_DEBUG(" affine_to_cpu: %" PRId64, affinity()); +} +#endif + + #ifndef XMRIG_NO_API rapidjson::Value xmrig::CpuThread::toAPI(rapidjson::Document &doc) const { diff --git a/src/workers/CpuThread.h b/src/workers/CpuThread.h index 0e364764..622dc3a2 100644 --- a/src/workers/CpuThread.h +++ b/src/workers/CpuThread.h @@ -21,8 +21,8 @@ * along with this program. If not, see . */ -#ifndef __CPUTHREAD_H__ -#define __CPUTHREAD_H__ +#ifndef XMRIG_CPUTHREAD_H +#define XMRIG_CPUTHREAD_H #include "common/xmrig.h" @@ -80,6 +80,10 @@ public: inline Type type() const override { return CPU; } protected: +# ifdef APP_DEBUG + void print() const override; +# endif + # ifndef XMRIG_NO_API rapidjson::Value toAPI(rapidjson::Document &doc) const override; # endif @@ -101,4 +105,4 @@ private: } /* namespace xmrig */ -#endif /* __CPUTHREAD_H__ */ +#endif /* XMRIG_CPUTHREAD_H */ diff --git a/src/workers/Workers.cpp b/src/workers/Workers.cpp index 0e75e736..5deb14f7 100644 --- a/src/workers/Workers.cpp +++ b/src/workers/Workers.cpp @@ -160,6 +160,14 @@ void Workers::setJob(const Job &job, bool donate) void Workers::start(xmrig::Controller *controller) { +# ifdef APP_DEBUG + LOG_NOTICE("THREADS ------------------------------------------------------------------"); + for (const xmrig::IThread *thread : controller->config()->threads()) { + thread->print(); + } + LOG_NOTICE("--------------------------------------------------------------------------"); +# endif + m_controller = controller; const std::vector &threads = controller->config()->threads();