I am starting a bunch of different threads in my Python script. I want to keep track of the memory and CPU usage of each of these threads. I use top and ps -eLf for that.
But it turns out that the identifier returned by thread.start_new_thread() is different from the thread PID displayed by top and other similar programs. Is there a way to obtain this PID from with in the Python script? This way, I can determine which PID belongs to which thread.