From 164eb4de7be4d6f163a498bc264ee7bc399df8a2 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 27 Jan 2016 15:16:44 +0100 Subject: [PATCH] Merge with develop --- code/ryzom/client/src/client_cfg.cpp | 53 ------------------- code/ryzom/client/src/init.cpp | 49 +++++++++++++++++ .../client/client_patcher/CMakeLists.txt | 3 +- 3 files changed, 51 insertions(+), 54 deletions(-) diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index e0502bf6a..007157d9a 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -254,43 +254,6 @@ extern NL3D::UDriver *Driver; extern CRyzomTime RT; extern string Cookie; extern string FSAddr; - -extern uint64 Debug_OldCPUMask; -extern uint64 Debug_NewCPUMask; - -// For multi cpu, active only one CPU for the main thread -void setCPUMask(uint64 userCPUMask) -{ - uint64 cpuMask = IProcess::getCurrentProcess()->getCPUMask(); - Debug_OldCPUMask = cpuMask; - - // if user CPU mask is valid - if (cpuMask & userCPUMask) - { - // use it - IProcess::getCurrentProcess ()->setCPUMask(cpuMask & userCPUMask); - } - else - { - // else get first available CPU - - // get the processor to allow process - uint i = 0; - while ((i < 64) && ((cpuMask & (UINT64_CONSTANT(1) << i)) == 0)) - i++; - - // Set the CPU mask - if (i < 64) - { - IProcess::getCurrentProcess ()->setCPUMask(UINT64_CONSTANT(1) << i); - } - } - - // check - cpuMask = IProcess::getCurrentProcess ()->getCPUMask(); - Debug_NewCPUMask = cpuMask; -} - #endif ///////////// @@ -1703,22 +1666,6 @@ void CClientConfig::setValues() SetPriorityClass (GetCurrentProcess(), priority[index]); #endif // NL_OS_WINDOWS - sint cpuMask; - - if (ClientCfg.CPUMask < 1) - { - CTime::CTimerInfo timerInfo; - NLMISC::CTime::probeTimerInfo(timerInfo); - - cpuMask = timerInfo.RequiresSingleCore ? 1:0; - } - else - { - cpuMask = ClientCfg.CPUMask; - } - - if (cpuMask) setCPUMask(cpuMask); - // Init Verbose Modes (at the beginning to be able to display them as soon as possible). ::VerboseVP = ClientCfg.VerboseVP; ::VerboseAnimUser = ClientCfg.VerboseAnimUser; diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 94376cd3f..8daabdaa5 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -378,6 +378,39 @@ void outOfMemory() uint64 Debug_OldCPUMask = 0; uint64 Debug_NewCPUMask = 0; +// For multi cpu, active only one CPU for the main thread +void setCPUMask(uint64 userCPUMask) +{ + uint64 cpuMask = IProcess::getCurrentProcess()->getCPUMask(); + Debug_OldCPUMask = cpuMask; + + // if user CPU mask is valid + if (cpuMask & userCPUMask) + { + // use it + IProcess::getCurrentProcess ()->setCPUMask(cpuMask & userCPUMask); + } + else + { + // else get first available CPU + + // get the processor to allow process + uint i = 0; + while ((i < 64) && ((cpuMask & (UINT64_CONSTANT(1) << i)) == 0)) + i++; + + // Set the CPU mask + if (i < 64) + { + IProcess::getCurrentProcess ()->setCPUMask(UINT64_CONSTANT(1) << i); + } + } + + // check + cpuMask = IProcess::getCurrentProcess ()->getCPUMask(); + Debug_NewCPUMask = cpuMask; +} + void displayCPUInfo() { nlinfo("CPUInfo: CPUMask before change: %x, after change: %x, CPUID: %x, hasHyperThreading: %s", (uint32)Debug_OldCPUMask, (uint32)Debug_NewCPUMask, CSystemInfo::getCPUID(), (CSystemInfo::hasHyperThreading()?"YES":"NO")); @@ -836,6 +869,22 @@ void prelogInit() ClientCfg.init(ConfigFileName); CLoginProgressPostThread::getInstance().init(ClientCfg.ConfigFile); + sint cpuMask; + + if (ClientCfg.CPUMask < 1) + { + CTime::CTimerInfo timerInfo; + NLMISC::CTime::probeTimerInfo(timerInfo); + + cpuMask = timerInfo.RequiresSingleCore ? 1:0; + } + else + { + cpuMask = ClientCfg.CPUMask; + } + + if (cpuMask) setCPUMask(cpuMask); + setCrashCallback(crashCallback); // Display Some Info On CPU diff --git a/code/ryzom/tools/client/client_patcher/CMakeLists.txt b/code/ryzom/tools/client/client_patcher/CMakeLists.txt index f8c1ef68b..0b32a9867 100644 --- a/code/ryzom/tools/client/client_patcher/CMakeLists.txt +++ b/code/ryzom/tools/client/client_patcher/CMakeLists.txt @@ -10,11 +10,12 @@ FILE(GLOB SRC main.cpp ) # always enable custom patch server -ADD_DEFINITIONS(-DRZ_USE_CUSTOM_PATCH_SERVER) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DRZ_USE_CUSTOM_PATCH_SERVER) ADD_EXECUTABLE(ryzom_client_patcher ${SRC}) INCLUDE_DIRECTORIES( + ${LIBXML2_INCLUDE_DIR} ${CURL_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/ryzom/client/src )