Maassoft / ColorControl

Easily change NVIDIA display settings and/or control LG TV's
GNU General Public License v3.0
829 stars 39 forks source link

Background CPU usage #316

Open farnoy opened 5 months ago

farnoy commented 5 months ago

With the app minimized into the tray, it still uses 1-2% of the CPU in the background. Seems rather high if the primary activity with my config is waiting for the screensaver to engage to shut down my configured displays.

As a workaround, I've set the EcoQoS setting to efficiency mode from task manager, and it halved the CPU usage, but that's still more than I'd expect it to use.

Maassoft commented 4 months ago

That's not normal. With the process monitor polling interval at 1000ms my CPU usage is about 0.01% (1/100th of a percent) according to Process Hacker. If I set the interval to 50ms, the usage jumps to 0.15%, but is still not visible in the regular task manager. What interval are you using and what CPU do you have?

farnoy commented 4 months ago

image

Checked with Process Hacker at Normal 1s interval: image

It's a 7950X3D and the app is minimized to the tray. I also cleared logs as they were large but it didn't have an effect on CPU usage.

Perhaps you could recommend a .NET profiler and I could check where it's spending time?

farnoy commented 4 months ago

I seem to be running 8.2.0.0 still, will re-test on the latest release later

farnoy commented 4 months ago

On 9.8.1.0, this was still an issue even after disabling all modules except for LG. Increasing the process polling to 5s (maximum?) helps a lot to bring it down to what I'd expect from a background app 👍

That said, I don't actually use per-app profiles and always trigger the changes manually. Could the process polling be skipped entirely if there are no profiles to apply depending on running processes?

Maassoft commented 4 months ago

Strange that it's still using more than on my CPU, which is "only" a 5900X. Currently the only background task (apart from the service which is mostly idle and just waits on requests from the client) is the polling of processes. Essentially it just fetches all processes via .NET API and checks if a preset/screensaver should be (de)activated. It can currently not be stopped and the interval must be between 50 and 5000ms. One thing I've noticed in your screenshots though, is the very high PID numbers. Does your system have a very long uptime or are there lots of processes running?

farnoy commented 4 months ago

I have 300 processes running, so not that many.