Move Platform.

This commit is contained in:
XMRig 2019-07-13 16:48:14 +07:00
parent 4643742d13
commit 8b3f2d8fff
16 changed files with 31 additions and 16 deletions

View file

@ -27,7 +27,6 @@ set(HEADERS
"${HEADERS_BACKEND}"
src/api/interfaces/IApiListener.h
src/App.h
src/common/Platform.h
src/common/xmrig.h
src/core/config/Config_default.h
src/core/config/Config_platform.h
@ -88,7 +87,6 @@ set(SOURCES
"${SOURCES_BASE_HTTP}"
"${SOURCES_BACKEND}"
src/App.cpp
src/common/Platform.cpp
src/core/config/Config.cpp
src/core/config/ConfigTransform.cpp
src/core/Controller.cpp
@ -123,7 +121,6 @@ if (WIN32)
"${SOURCES_OS}"
res/app.rc
src/App_win.cpp
src/common/Platform_win.cpp
src/Mem_win.cpp
src/crypto/common/VirtualMemory_win.cpp
)
@ -134,7 +131,6 @@ elseif (APPLE)
set(SOURCES_OS
"${SOURCES_OS}"
src/App_unix.cpp
src/common/Platform_mac.cpp
src/Mem_unix.cpp
src/crypto/common/VirtualMemory_unix.cpp
)
@ -142,7 +138,6 @@ else()
set(SOURCES_OS
"${SOURCES_OS}"
src/App_unix.cpp
src/common/Platform_unix.cpp
src/Mem_unix.cpp
src/crypto/common/VirtualMemory_unix.cpp
)

View file

@ -34,7 +34,6 @@
#include "base/io/Console.h"
#include "base/io/log/Log.h"
#include "base/kernel/Signals.h"
#include "common/Platform.h"
#include "core/config/Config.h"
#include "core/Controller.h"
#include "Mem.h"

View file

@ -31,7 +31,7 @@
#include "api/v1/ApiRouter.h"
#include "backend/cpu/Cpu.h"
#include "base/kernel/Base.h"
#include "common/Platform.h"
#include "base/kernel/Platform.h"
#include "core/config/Config.h"
#include "interfaces/IThread.h"
#include "rapidjson/document.h"

View file

@ -26,6 +26,7 @@ set(HEADERS_BASE
src/base/kernel/interfaces/IStrategyListener.h
src/base/kernel/interfaces/ITimerListener.h
src/base/kernel/interfaces/IWatcherListener.h
src/base/kernel/Platform.h
src/base/kernel/Process.h
src/base/kernel/Signals.h
src/base/net/dns/Dns.h
@ -63,6 +64,7 @@ set(SOURCES_BASE
src/base/kernel/config/BaseConfig.cpp
src/base/kernel/config/BaseTransform.cpp
src/base/kernel/Entry.cpp
src/base/kernel/Platform.cpp
src/base/kernel/Process.cpp
src/base/kernel/Signals.cpp
src/base/net/dns/Dns.cpp
@ -83,9 +85,20 @@ set(SOURCES_BASE
if (WIN32)
set(SOURCES_OS src/base/io/json/Json_win.cpp)
set(SOURCES_OS
src/base/io/json/Json_win.cpp
src/base/kernel/Platform_win.cpp
)
elseif (APPLE)
set(SOURCES_OS
src/base/io/json/Json_unix.cpp
src/base/kernel/Platform_mac.cpp
)
else()
set(SOURCES_OS src/base/io/json/Json_unix.cpp)
set(SOURCES_OS
src/base/io/json/Json_unix.cpp
src/base/kernel//Platform_unix.cpp
)
endif()

View file

@ -35,8 +35,8 @@
#include "base/io/Watcher.h"
#include "base/kernel/Base.h"
#include "base/kernel/interfaces/IBaseListener.h"
#include "base/kernel/Platform.h"
#include "base/kernel/Process.h"
#include "common/Platform.h"
#include "core/config/Config.h"
#include "core/config/ConfigTransform.h"

View file

@ -35,6 +35,15 @@
class Platform
{
public:
static inline bool trySetThreadAffinity(int64_t cpu_id)
{
if (cpu_id < 0) {
return false;
}
return setThreadAffinity(static_cast<uint64_t>(cpu_id));
}
static bool setThreadAffinity(uint64_t cpu_id);
static uint32_t setTimerResolution(uint32_t resolution);
static void init(const char *userAgent);

View file

@ -29,10 +29,10 @@
#include "3rdparty/http-parser/http_parser.h"
#include "base/io/log/Log.h"
#include "base/kernel/Platform.h"
#include "base/net/dns/Dns.h"
#include "base/net/http/HttpClient.h"
#include "base/tools/Baton.h"
#include "common/Platform.h"
namespace xmrig {

View file

@ -24,9 +24,9 @@
#include "base/kernel/interfaces/IStrategyListener.h"
#include "base/kernel/Platform.h"
#include "base/net/stratum/Client.h"
#include "base/net/stratum/strategies/FailoverStrategy.h"
#include "common/Platform.h"
#ifdef XMRIG_FEATURE_HTTP

View file

@ -24,9 +24,9 @@
#include "base/kernel/interfaces/IStrategyListener.h"
#include "base/kernel/Platform.h"
#include "base/net/stratum/Client.h"
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
#include "common/Platform.h"
#ifdef XMRIG_FEATURE_HTTP

View file

@ -27,7 +27,6 @@
#include "backend/cpu/Cpu.h"
#include "common/Platform.h"
#include "core/Controller.h"
#include "net/Network.h"

View file

@ -26,13 +26,13 @@
#include <assert.h>
#include "base/kernel/Platform.h"
#include "base/net/stratum/Client.h"
#include "base/net/stratum/Job.h"
#include "base/net/stratum/strategies/FailoverStrategy.h"
#include "base/net/stratum/strategies/SinglePoolStrategy.h"
#include "base/tools/Buffer.h"
#include "base/tools/Timer.h"
#include "common/Platform.h"
#include "common/xmrig.h"
#include "core/config/Config.h"
#include "core/Controller.h"

View file

@ -27,7 +27,7 @@
#include "backend/cpu/Cpu.h"
#include "common/Platform.h"
#include "base/kernel/Platform.h"
#include "workers/CpuThreadLegacy.h"
#include "workers/ThreadHandle.h"
#include "workers/Worker.h"