0

I'm trying to configure profiling of a Python application (running under pypy2.7 v7.1.1) using vmprof.

If the application is ran via pypy -m vmprof ..., the resulting profile file contains samples from all threads (main and background). However, I need to enable and disable the profiler in a running process, so I'm doing this using the vmprof.enable()/vmprof.disable() functions in a signal handler. The problem is that the resulting file only contains samples from the main thread.

Is there a way to profile all threads of a running application using vmprof?

Mikhail Burshteyn
  • 4,762
  • 14
  • 27

1 Answers1

0

I ended up recreating the background threads when the profiler is starting.

It is important to spawn the new threads from the main thread when the profiler is running. If the new background threads are spawned from the old background threads, the new threads still will not be profiled.

Mikhail Burshteyn
  • 4,762
  • 14
  • 27