Python Forum
How to get a count of -Python- threads from the outside (or via code instrumentation) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to get a count of -Python- threads from the outside (or via code instrumentation) (/thread-19809.html)



How to get a count of -Python- threads from the outside (or via code instrumentation) - dstromberg - Jul-15-2019

  • Detailed description of your problem, including steps to reproduce it
This is more informational, than a problem.

I want some way of identifying which of my program's many threads are coming from CPython, and which are coming from C/C++ extension modules.

I can tell my program has a couple dozen threads by looking at it in csysdig on a Linux system.
  • What steps have you tried? What was the outcome?
I've googled a lot, but I keep getting tutorials about threading, not how to tell Python threads from C/C++ threads.

I've got this question at stackoverflow too: https://stackoverflow.com/questions/56958009/how-can-i-tell-how-many-python-threads-a-process-has-from-the-outside
So far it has no answers.
  • Full traceback verbatim or other error you receive
The "error" is that the application is much slower than it seems like it should be, even though the CPU load and I/O load on the machine are both low. But this post is mostly about the thread question.
  • System info, python version, operating system, etc.
Python 2.7.12 (I know; we're working on upgrading to 3.x)
Ubuntu 16.04.6 LTS