Intro
Our team has an application that performed fine with Windows 10, but has now started suffering from compute throttling of some kind in Windows 11 when it is not shown on the desktop.
In broad terms, the architecture of the solution is that this application communicates over USB (through our own proprietary DLL) with a hardware device (also our own design) to fascilitate serial and CAN/J1939 communication from a PC.
Symptoms
The specific symptoms we observe is that the rate at which the function gets called to pop messages from the DLL queue is reduced to about a third of the rate we are used to be adequate for keeping up. The approximate rates we're talking about is 1000 function calls per second get reduced to about 300 function calls per second. This happens when the application is not visible on the desktop.
When the application is minimized, the "throttling" occurs as well as when the application itself is maximized, but then another maximized "over" it.
The specific test we did was:
- Run the application and observe ~1000 function calls per second
- Minimize the application and observe ~300 function calls per second (and the queue not keeping up)
- Maximize the application and still observe ~1000 function calls per second
- Run calc.exe "on top" of our application's window while focus remains on Calculator (doing some simple maths) - we still observe ~1000 function calls per second
- Maximize Calculator to completely cover our application's window - observe ~300 function calls per second
The same tests reveal no change in the rate of function calls when it is done on Windows 10.
Tried This...
We have tried to optimize the infrastructure around the function call itself and reduced sleep(1)
calls to sleep(0)
calls. We have also tried Windows' Gaming Mode as well as High Performance power modes.
The expectation was that these may allow the application not to fall behind on the message queue when other applications are using all the Desktop real-estate or when the application gets minimized. This is the normal way of using our application, and was adequate for many years.
In reality, none of those changes prevented the reduction in function call rate which in turn prevents us from keeping up with the communication on the bus. When the application then comes to the foreground, the queue first has to be cleared before real time messages are being processed and presented.
Questions
- We thought this was caused by Windows' Power Throttling feature that was introduced in versions of Windows 8, but the fact that we don't have the problem in Windows 10 says otherwise. What is the Windows 11 feature called that could cause this type of behaviour?
- Could this feature be controlled in some way for an application with our architecture and requirements? Are there manifest settings or specific Windows API methods that could be used to address our problem?
Other Technical Info
- The application is developed in Embarcadero C++ Builder XE7
- The DLL is developed in Codegear C++ Builder RAD Studio 2007
- We use the RP1210a/b standard for CAN communication
- We use FTDI's Driver Package Version 2.12.18
- The version of Windows 10 on which the test did not show the reduction in function call rate was 21H2 build 19044.2846
- The version of Windows 11 on which the test showed the reduction of function call rate was 21H2 build 22000.1817