Question

I am running a process and I want to track it's CPU usage and in the end I would like to have a graph of time vs CPU usage. Any app or script for that? I googled and I couldn't find any. And activity monitor does not give graph of over the time of the process.

Was it helpful?

Solution

You could also use a shell command like this:

while :;do ps -p 1234 -o %cpu=;sleep 1;done

Replace 1234 with the pid of the process.

You can use gnuplot to create a graph for the data:

gnuplot<<<'set term png;set output "/tmp/plot.png";plot "/tmp/data" with boxes'
qlmanage -p /tmp/plot.png

OTHER TIPS

There are some apps that allow you to do this, but the ones that I found were paid. If you are willing to pay for one, you could try Hardware Monitor.

If not, you can try using this tip from Mac OS X Hints. With this script, it should be able to track the CPU history and export it to a document.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top