I have a process running on Linux box which occasionally takes more than 100% (its a quad-core processor) CPU (as seen in 'top' output) and the other commands running on this process get stuck. By the time I notice this and dump process core, the CPU utilization drops to normal and the core does not show anything unusual.

Is there any way (command, script, etc.) which can generate process core based on CPU utilization, i.e. during spike automatically?


You could try

while true; do ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 >> logfile.txt; echo "\n" >> logfile.txt; sleep 3; done

This script will show you the top ten processes in terms of CPU usage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.