GUI freezes caused by high stream rates
-
Hello,
Firstly, sorry in advance for my poor english as it is not my first language.
So, I have to create a powerful app that plots industrial robot positions in real-time. I wrote a demo app that runs a UDP server on a worker thread which fetches the data from the robot and emits a signal containing it. I use a QCustomPlot to plot the data.
My problem is that generally the data stream rate we use is at 250 Hz but it can't be handled by the GUI which freezes if the user interacts. Surprisingly, my demo can go up to 100Hz before being saturated.
Also I can't downsample the data fetched and I can't change the stream rate. Do you have an idea of how I can prevent GUI freezes at these stream rates ? (alternatives to QCustomPlot, Qt, software optimizations, ...).
Thank you !
-
Hello,
Firstly, sorry in advance for my poor english as it is not my first language.
So, I have to create a powerful app that plots industrial robot positions in real-time. I wrote a demo app that runs a UDP server on a worker thread which fetches the data from the robot and emits a signal containing it. I use a QCustomPlot to plot the data.
My problem is that generally the data stream rate we use is at 250 Hz but it can't be handled by the GUI which freezes if the user interacts. Surprisingly, my demo can go up to 100Hz before being saturated.
Also I can't downsample the data fetched and I can't change the stream rate. Do you have an idea of how I can prevent GUI freezes at these stream rates ? (alternatives to QCustomPlot, Qt, software optimizations, ...).
Thank you !
@mtjsc00 said in GUI freezes caused by high stream rates:
Hello,
Firstly, sorry in advance for my poor english as it is not my first language.
So, I have to create a powerful app that plots industrial robot positions in real-time. I wrote a demo app that runs a UDP server on a worker thread which fetches the data from the robot and emits a signal containing it. I use a QCustomPlot to plot the data.
My problem is that generally the data stream rate we use is at 250 Hz but it can't be handled by the GUI which freezes if the user interacts. Surprisingly, my demo can go up to 100Hz before being saturated.
Also I can't downsample the data fetched and I can't change the stream rate. Do you have an idea of how I can prevent GUI freezes at these stream rates ? (alternatives to QCustomPlot, Qt, software optimizations, ...).
Thank you !
Hi,
Your use of English is fine!
First off, have you profiled to see where the time is spent? Optimizing outside of hotspots isn't going to yield much improvement.
An extra thread emitting a signal per sample might make the situation worse, as each emission will result in a metacall event. Unless significant time is spent processing each datagram (verified through profiling), try performing all of the work in the GUI thread. If too much time is indeed spent per datagram, try to complete as much computation as possible before crossing a thread boundary.
Is there a target frame rate for the application? While this may sound like the explicitly disallowed downsampling, computation on samples that will never be shown is wasted time. If the UI is expected to update at 30 or 60 Hz, try batching at that interval. Queue the updates, and use a timer to dispatch them at the desired rate. Prune samples that are superseded by later samples in the same update batch.
-