Unsolved How track time between user action and visual feedback displayed on the screen?
-
I need to find a way to track the time between when a user performs some action and some visual feedback is displayed on the screen.
For example if a user clicks a button to move items from one tab to the other, I want to know the time between when they clicked the button and when all the items have been removed from the currently visible tab and added to the next tab. I need to know not only how long did it take for my code to process the move event, but also when the updated view was rendered to the screen.
Another example would be showing a dialog after a user clicks a button. In this case I need to know the time between the button click and when was the dialog finally visible to the user.
Getting the start time is simple enough. Just capture the time when the slot for the selected button was called, but I'm struggling with how to capture the time when all painting related to processing the button click is complete.
Currently we are attempting to post a LowPriority event to the event queue when our processing of a button click completes. The idea is any widgets that were marked dirty by processing the button clicks will have generated paint events that were added to the event queue. Our low priority event will also be posted but will not be processed until after all the higher priority paint events. We then grab the stop time when the posted event is received.
That seems to work for the first example, but it doesn't seem to work in the dialog case. Unfortunately it appears when a dialog is shown QT makes a pass through the event queue and processes our custom event before the dialog is actually visible. So instead, in dialogs, we override paintEvent and post the custom event when the dialog is done processing paintEvent. We then seem to receive our custom event after the dialog is painted to the screen.
But this all seems a bit unreliable. Is there a better way to approach this? Are there any other bench marking tools we could use?
As a side note: this isn't the whole story. Even if we can make the above work, we still need to add constants for how long it take X/QT before the event is delivered to our button processing code and how long does it take for the image QT is rendering during the paint events to be dumped to the XServer and flushed to the screen. To gather these constants we are hoping to somehow collect the average time between when a button is clicked and QT calls a slot registered on a button. Similar for the painting of the buffered image to the monitor. There might be a separate post related to this.
Thanks for any help.
-
Hi and welcome to the forums.
Such system wide measures are often best captured using a full logging system
and instrument the app code to log in appropriate places.
Its then a matter of comparinging timestamps.
However, to add that to a fully developed app is not a small task.Anyhow, im wondering if
https://www.kdab.com/development-resources/qt-tools/gammaray/
can be used. Not sure if it contains the data but it worth a look.