If you wanted to track down performance issues on a machine running Mac OS X and find out what was causing slowdowns, which command-line or graphical tools would you use, and how would you use them?
I'm interested in advice on the best tools, and explanations of how to use them - when a machine slows down or freezes up, I'd like to be able to dig down and understand what's going on, memory / disk / CPU-wise.
Thanks.
I would begin with
top
(to see the process list at work). Take into account cpu usage / per process and memory usage. Followed byfs_usage
(lets you monitor file system activity).If your finding something using the disk often or using too much cpu your heading in the right direction. Also try
vmstat 3
; good for overall comparison of cpu, memory, disk (vmstat
may be renamedvm_stat
in newer versions of OSX).Turn off every service you done need, is another good starting point. I would suggest you read man pages/howto's on these tools (there is too much to explain).
There is also the OSX activity monitor in applications/utilities which is much easier to read, but not so detailed as the utilities mentioned above.
Found this great resource recently which details some more advanced dtrace-based commands which can be used to track down OS X performance issues; may be of use to people stumbling upon this question:
http://dtrace.org/blogs/brendan/2011/10/10/top-10-dtrace-scripts-for-mac-os-x/