From a59c94f8be1547a92c1ef4051a10696adb19abcb Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Sat, 30 Apr 2022 00:05:49 +0100 Subject: [PATCH] src/Viewer/renderer.cxx: use /sim/thread-cpu-affinity to control thread-cpu affinity. This is for investigating bug 2734. If /sim/thread-cpu-affinity is true or unset on startup, we use default behaviour where we tell OSG to set up thread-cpu affinities. Setting /sim/thread-cpu-affinity to false on start up results in all/most threads being free to run on any cpu core. For example in .fgfsrc or on command, use: --prop:bool:/sim/thread-cpu-affinity=false --- src/Viewer/renderer.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Viewer/renderer.cxx b/src/Viewer/renderer.cxx index 807a62fbe..0a3701d32 100644 --- a/src/Viewer/renderer.cxx +++ b/src/Viewer/renderer.cxx @@ -479,6 +479,9 @@ FGRenderer::init( void ) } else { composite_viewer = new osgViewer::CompositeViewer; + bool use_affinity = fgGetBool("/sim/thread-cpu-affinity", true); + SG_LOG(SG_GENERAL, SG_ALERT, "Calling composite_viewer->setUseConfigureAffinity() with use_affinity=" << use_affinity); + composite_viewer->setUseConfigureAffinity(use_affinity); } // https://stackoverflow.com/questions/15207076/openscenegraph-and-multiple-viewers