My python process at certain point in automated scripts starts chewing CPU on Linux based System (Ubuntu). I’m trying to debug this issue in GDB. I'm fairly new to GDB. Are there any GDB commands to give information on which thread is using most of the cpu. Looking at the thread stack doesn't really give that away.
On windows windbg world the command '!runaway' did give the info on time consumed by each thread in a process. Do we've an equivalent command here ? Any other suggestions to debug issue ?
One possible solution is to use the command top with the option to display all threads:
The tasks will be sorted by CPU usage by default.
Alternate solutions can be found in the previous thread here.
Just to clarify all the steps required to diagnose this issue. (thanks everyone for postings) :
Following command shows the list of process with their CPU / Memory usage :
Following command gives the list of all threads of a process sorted with CPU usage.
Thread 1654 is chewing CPU. Attach gdb to the process
Following command in gdb to get list of threads
in gdb switch to the thread to check its stack.