SL-18190 Limit the number of decode threads.

master
Dave Parks 2022-10-12 22:58:25 -05:00
parent 6a63c546ec
commit 80127acfa8
1 changed files with 13 additions and 0 deletions

View File

@ -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);