BR (Windows): Standalone App, high cpu usage when monitor is off

Hi everyone,

I found an issue on both Demo Runner and my app where, after turning off the screen, the cpu usage jumps from less than 1% to 11%. This happens on both master and develop branches of JUCE. This issue is mostly impacting impared users testing the accessible beta version of my app.

The root cause seems to be in [External Code] which unfortunately is not available.

This problem doesn’t appear on JUCE 6.1.6. It seems to be showing up from JUCE 7.0.0 .

The issue seems to only happen on Windows Pcs that have dedicated graphics with both Intel/AMD cpus.

JUCE version: 7.0.2
OS: Windows 10 21H1
Machine Specs: i9 9900k, rtx 3060, mobo Z390 Designare
Profiled with Visual Studio 2022

TIA

Hi @fravezAt,

We’ve had a user report with a similar looking issue to yours on our standalone JUCE app (on Windows). I’ve tested locally with intel integrated graphics on a 13700k, and found our app and the Projucer show similar behaviour with monitors turned off, all on JUCE 7.0.10.

It’s tricky to tell due to the external code calls, but it looks like the VBlankListeners are being called in a fast loop while the monitors are off (presumably because there is nothing to VSync to), but as you’ve found it’s not trivial to debug.

Are you still seeing this issue? Have you had a chance to try JUCE 8 to see if that fixes it?

A fix has been released on develop. This should limit the CPU usage by imposing a 1000 Hz upper limit to the refresh rate. Admittedly this could be improved, but this can significantly reduce CPU usage, and is the same workaround that is currently used by Chrome.

Will this or any fix be ported back to JUCE 7?
Especially since it was reported well in the period when JUCE 7 was the current version.

No, JUCE 7 won’t receive any more updates at this point.

Is the current Juce 8 master as stable / production-ready as the last Juce 7 version?

We aim to keep the master branch stable / production ready at all times. There are always some select issues though so answering that question may depend on your individual circumstances.

1 Like

What would the improvement entail? Just curious.

This work is relevant to this FR: FR: Animation frame rate limits, so I guess improvements could be to have a configurable JUCE default max FPS (like 120Hz), “smartly” makes sure resulting frames are evenly spaced based on the runtime hardware refresh rate, etc…

3 Likes

It could be possible to track the on/off state of the display by using verbose APIs to track multiple OS events and throttle the redraws way down in these situations.

4 Likes