0

Recently, I was debugging something in a very big Qt application. The problem is that I have a stuck (lag) application sometimes. I tried so many things and different ways to find which one was blocking the GUI thread.

  1. I disabled so many parts of the application to find the bottleneck, so I found a part.
  2. disabled just that part, and it was not anymore, but the problem is that the part is doing something for just 2-3 seconds, and it finishes after that, but I have lags for so long later too, and when I disable that, I have not anymore. it's weird.
  3. So I used so many profilers; the last one was better for me, the Intelvtune amplifier. but it can't help me so much.

So the best solution for me now, I think, is to watch the tasks that are queued in the event loop and see which ones are consuming more than 30 ms, but I don't know how to see what's calling in the event loop (internal). Do you have any suggestions or solutions? thanks. 

H.M
  • 425
  • 2
  • 16
  • If you have isolated the part, review code. Do any of the methods there do anything suspicious? Use QElapsedTimer and qDebug to quickly get timings. Try to isolate the problem to a single method, which blocks, or causes some kind of busy loop / event chain. – hyde Jul 02 '23 at 11:04
  • the problem is that , the isolated part that has bottelneck , is not problem , I think intenral functions in that isolated part from qt will be executed in event loop, cause of that I want to know what's that. I mean the isolated part is consuming about 4-5 ms. – H.M Jul 02 '23 at 11:24
  • 1
    One thing to beware, so in your case, to check for, is calling `processEvents()` or similar. It can easily lead non-re-entrant methods getting called re-entrantly. Also all `waitForXxx()` are inherently problematic in GUI thread. – hyde Jul 02 '23 at 19:57

0 Answers0