Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
4.5.2
-
None
-
Linux
Description
QTimer spends up to the last millisecond of the timer interval busy-waiting, in its attempt to be very accurate. In an application that attempts to use QTimer to animate the screen at the display's refresh rate, e.g. 70Hz, the application may consume a significant fraction of the CPU (up to 7% in this example) just within the QTimer class, and this fraction may be the same regardless of the processor speed. This excess CPU usage is at the detriment of other running threads or processes.
It seems that something like nanosleep() could be used instead for that last millisecond, to maintain similar accuracy but with a minimum of CPU usage.