I know I can use Activity Monitor (as well as a slew of 3rd party applications) to monitor the usage of RAM and CPU on my Mac. However, I want to capture a log over an amount of time so that I can compare usage between processes without having to take screen shots, etc. Something Console-like, like this:
Process A (5:22 - 5:32)
5:22:01: 2.2% CPU, 5 Threads, 111.1MB Real Mem
5:22:03: 2.1% CPU, 4 Threads, 90.4MB Real Mem
...
How can I accomplish this?
Answer
This mightn't quite hit the mark, but try this:
sar -o ~/output.sar 10 10
That gathers 10 sets of metrics at 10 second intervals. You can then extract useful information from the output file (even while it's still running), for instance this will get you the disk activity for the interval you sampled:
sar -d -f ~/output.sar
Do a man sar
to find out what other options there are.
Edit:
sar
doesn't do memory so this will get you the free memory on your system at ten second intervals:
vm_stat 10 | awk 'NR>2 {gsub("K","000");print ($1+$4)/256000}'
You can redirect that to a file.
If you need more information, please ask.
No comments:
Post a Comment