From 80127acfa876bd98e843a67bd17514a2b3f63d49 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 Oct 2022 22:58:25 -0500 Subject: SL-18190 Limit the number of decode threads. --- indra/newview/llappviewer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e874cf02cb..8e5a796498 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2190,6 +2190,19 @@ bool LLAppViewer::initThreads() LLLFSThread::initClass(enable_threads && true); // TODO: fix crashes associated with this shutdo + //auto configure thread count + LLSD threadCounts = gSavedSettings.getLLSD("ThreadPoolSizes"); + + // get the number of concurrent threads that can run + S32 cores = std::thread::hardware_concurrency(); + + // The only configurable thread count right now is ImageDecode + // The viewer typically starts around 8 threads not including image decode, + // so try to leave at least one core free + S32 image_decode_count = llclamp(cores - 9, 1, 8); + threadCounts["ImageDecode"] = image_decode_count; + gSavedSettings.setLLSD("ThreadPoolSizes", threadCounts); + // Image decoding LLAppViewer::sImageDecodeThread = new LLImageDecodeThread(enable_threads && true); LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true); -- cgit v1.2.3