0

1

I wondered about uncertainty in QT signal and slot communication mechanism timings over the queued connection. My signal and slot (respective objects) live in two different threads, As part of benchmarking signals is emitting from a Worker thread to the Slot in the Main thread. Siganl emit rate is 60 per second. The main thread is running in an event loop and the worker thread keeps on emitting signals as per the rate described. In my scenario, the Main thread is completely ideal and the slot contains only the return statement (so expecting immediate return from the slot). I measured the time taken for signal-slot communication and plotted a graph on resulted data. I found these were some deep spikes intermittently and even communication time also not linear as I thought.

Expected: Expecting signal-slot communication always take the same time when both the worker thread and Main thread (where signal and slot exists) are not involved in other operation. And at least there should not be sudden intermittent spikes in communication time.

vimuth
  • 5,064
  • 33
  • 79
  • 116
Suresh
  • 1
  • 3
  • Please [edit] your question to provide a [mcve] showing exactly how you performed the testing and collected the data -- the details are important. Also note that if the emitter and receiver are on different threads then at least one context switch is required each time the signal is triggered in order for the associated slot(s) to be invoked: that can have a large impact on timing -- especially on a non-realtime OS. – G.M. Feb 01 '23 at 13:39
  • @G.M. I will provide an example in very less time. My example is the elementary level. Understood your point on context switch and its impact on timings but my only concern is why there is a sudden intermittent spike for a few signals. And Is 0.3 or 0.4 ms really an acceptable time for signal slot communication? – Suresh Feb 06 '23 at 06:16

0 Answers0