High CPU usage for thread function `prThreadThumbnailFileDatasExtractionFunc`
ilovexyz opened this issue · 4 comments
Describe the bug
if USE_THUMBNAILS
macro is defined, thread function prThreadThumbnailFileDatasExtractionFunc
consumes too much cpu.
To Reproduce
Steps to reproduce the behavior:
- using the latest version "v0.6.5"
- define
USE_THUMBNAILS
- Open a modal dialog
- the cpu usage is high
- close the dialog, the cpu usage goes to 0%
Posible reason
When i debug into the source code, i found the thread function prThreadThumbnailFileDatasExtractionFunc
is running continuously if prThumbnailFileDatasToGet
is empty.
Suggested solution?
sleep for a while if prThumbnailFileDatasToGet
is empty.
while(prIsWorking)
{
if (!prThumbnailFileDatasToGet.empty())
{...}
// sleep for a while
else
{
using namespace std::chrono_literals;
std::this_thread::sleep_for(1ms);
}
}
after adding sleep, the cpu usage goes to 0% again. But i am not sure is this a correct solution.
Hello,
Thanks for thz feedback.
Ok make sende, will check that Hen i have time. Maybe not before saturday soery
Btw what is you cpu, memory amount and os please ?
Hello,
Thanks for thz feedback.
Ok make sende, will check that Hen i have time. Maybe not before saturday soery
Btw what is you cpu, memory amount and os please ?
My CPU is Intel Core i9-9880H, memory 48G, os is windows 10 enterprise with version 21H2.
if the dialog is shown, the cpu goes from 0% to ~12% suddenly, and keep that value as long as the dialog is shown, which cause the cpu fan spinning
Yes maybe a sleep xan be a solution but can add a delay when the lidt contain again a file to treat
But we can add a sleep of 500 m.
Could be sufficient i guess
fixed :)