1
0
Fork 0

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
This commit is contained in:
Julian Smith 2022-04-30 00:05:49 +01:00
parent 0923400e35
commit a59c94f8be

View file

@ -479,6 +479,9 @@ FGRenderer::init( void )
} }
else { else {
composite_viewer = new osgViewer::CompositeViewer; 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 // https://stackoverflow.com/questions/15207076/openscenegraph-and-multiple-viewers