Python Forum

Full Version: How to get a count of -Python- threads from the outside (or via code instrumentation)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
  • 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/5695...he-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