lundi 26 octobre 2020

top command till a process runs out

I'm running a process and I want to store its CPU usage.

So I used top command

{ test_case.sh > out.log ; } && { sleep 2s ; x=`pidof test_case` ; top -p $x -d 5 -b > cpu.log ; }

But the cpu.log file is empty and out.log contains the output of test_case

I don't know why.

Can you help me to get the output of the top command till that process completes

Aucun commentaire:

Enregistrer un commentaire