Thank you for your answers.
What I wanna do it could be easy if I could know which pid represents each thread.
When I run my python process it has a PID, for example 11341. Now I can go to the /proc/11341 folder and I can show all the threads of this process in the task folder, for example I can show:
dr-xr-xr-x 3 root root 0 feb 13 16:20 899
dr-xr-xr-x 3 root root 0 feb 13 16:20 900
dr-xr-xr-x 3 root root 0 feb 13 16:20 901
dr-xr-xr-x 3 root root 0 feb 13 16:20 902
dr-xr-xr-x 3 root root 0 feb 13 16:20 903
dr-xr-xr-x 3 root root 0 feb 13 16:20 904
dr-xr-xr-x 3 root root 0 feb 13 16:20 905
dr-xr-xr-x 3 root root 0 feb 13 16:20 906
dr-xr-xr-x 3 root root 0 feb 13 16:20 907
dr-xr-xr-x 3 root root 0 feb 13 16:20 908
dr-xr-xr-x 3 root root 0 feb 13 16:20 909
and I could know what CPU time it's consumed by each thread by the command top:
top -b -n 1 -p $list
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
899 root 16 0 149m 12m 8232 S 0.0 1.3 0:00.44 run.py
900 root 16 0 149m 12m 8232 S 0.0 1.3 0:00.02 run.py
901 root 15 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
902 root 19 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
903 root 19 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
904 root 15 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
905 root 21 0 149m 12m 8232 S 0.0 1.3 0:00.01 run.py
906 root 23 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
907 root 15 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
908 root 21 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
909 root 22 0 149m 12m 8232 S 0.0 1.3 0:00.00 run.py
and I show all the threads of my process and their CPU's time... But my problem is that I can't know wich thread is corresponding with each PID. In this case I know that the thread 899 of my process consumes 440 ms. but I don't know wich is this thred.
