3

Currently I want to find any Python tool can let me monitor another Python process' threads status. I know there is already a similar question

But the solution does not work in my case as it only dumps the process' own threads status.

Is it possible to do this in Python?

Thanks!

Community
  • 1
  • 1
Willy
  • 1,828
  • 16
  • 41

3 Answers3

2

As far as I know, there's no built-in support for this, but I've wanted it myself as well, and that's why I wrote my "PDM" library. Maybe you'll find it useful as well.

Dolda2000
  • 25,216
  • 4
  • 51
  • 92
  • Hi, currently I want to figure out why the target Python process runs strangely slow in some case. Is the tool suitable to do this? – Willy Sep 27 '13 at 07:05
  • If you can do that with a stack dump, it certainly can be used for it. Just attach with `pdm-repl` to the process, `import pdm.util` and check `pdm.util.traces()`. – Dolda2000 Sep 27 '13 at 07:14
2

There is something that I tried to monitor thread statuses in python. This code instruments the python code and may hamper performance overall. Since I wrote this code for my company it is proprietary and I can't post it on SO. But to your question whether one can output thread status of another python process, the answer is a resounding yes.

Lee
  • 301
  • 2
  • 3
  • 10
1

You could try installing and running the psutils library.

Steve Barnes
  • 27,618
  • 6
  • 63
  • 73