[PyQt] Fwd: Profiling with QThreads

Martin Teichmann lkb.teichmann at gmail.com
Tue Oct 4 15:56:50 BST 2011


Hi List,

[...]
> I put this operation in a QThread so that the GUI would stay responsive.
> I am now using a profiler on this application trying to see which
> calls to the server are taking most of the time.
> The problem here is that because its on a different thread the
> profiler doesn't pick up any of the calls.

his is what I'm doing for the same problem:

1. rename the method run to run_
2. add a new method run:

  def run(self):
      import cProfile
      cProfile.runctx("self.run_()", globals(), locals(), "profile.stat")

That let's you profile everything in that thread.

Greetings

Martin


More information about the PyQt mailing list