Skip to content

Commit 5fa9909

Browse files
committed
ENHANCEMENTS:
- Autodetect P/E-core CPUs and set affinity accordingly
1 parent 945775c commit 5fa9909

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/data/impl/serverimpl.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import tempfile
1313
import traceback
1414

15+
from core.utils.cpu import get_cpus_from_affinity, get_p_core_affinity
16+
1517
if sys.platform == 'win32':
1618
import win32con
1719
import win32gui
@@ -458,6 +460,12 @@ def do_startup(self):
458460
self.set_priority(self.locals.get('priority'))
459461
if 'affinity' in self.locals:
460462
self.set_affinity(self.locals.get('affinity'))
463+
else:
464+
# make sure, we only use P-cores for DCS servers
465+
p_core_affinity = get_p_core_affinity()
466+
if p_core_affinity:
467+
self.log.info(f" => P/E-Core CPU detected.")
468+
self.set_affinity(get_cpus_from_affinity(get_p_core_affinity()))
461469
self.log.info(f" => DCS server starting up with PID {p.pid}")
462470
except Exception:
463471
self.log.error(f" => Error while trying to launch DCS!", exc_info=True)

0 commit comments

Comments
 (0)