Updating os x 10 10
I’m familiar with the latter as I wrote the originals for the DTrace Toolkit, which Apple then customized and enhanced for Mac OS X where they are shipped by default (great! I use them regularly to answer this question: I work in an office where everyone has Mac Book Pros, and “why is my Mac Book slow? Applications can become slow or unresponsive while waiting for CPU work, memory requests or disk I/O to complete.
For people who try to ignore the slowdown, the question can become: Standard performance analysis tools like Activity Monitor and top(1) (and any third-party tools based on the same foundation) can’t tell you some key information about activity on your system, such as how much CPU consumption is caused by short-lived processes, or which processes are causing disk I/O. In this post, I’ll cover the top ten Mac OS X DTrace scripts that I use for figuring out why laptops are slow or why applications are misbehaving.
/Default/Cookies [...] This lets you instantly find out which applications are using the disk, and what files they are reading or writing to.
Disk I/O is typically slow (for non-SSD disks), so an application calling frequent disk I/O (a dozen per second or more) may run slowly as it waits for the disk I/O to complete.
Here’s an example: Brendan-2:~ brendan$ sudo iosnoop Password: password UID PID D BLOCK SIZE COMM PATHNAME 503 67261 W 384070496 73728 Tweet Deck ??You can find it here in Finder: You can also type “terminal” in Spotlight (the magnifying glass in the top right corner of your Mac’s screen), which should find it.I usually drag it to my Dock so it’s easy to find later: When you first run Terminal, it’ll probably look like this: I find the default font small and hard to read.Tweet Deck also wrote to database files (“td_26_brendangregg.db” and “td_26_brendangregg.db-journal”). ” is where the path information ends for iosnoop (if you are a darwin programmer and want to take a swing at improving that, see the fi_pathname translator in /usr/lib/dtrace/io.d).The “-h” option lists options (don’t need “sudo” for this): Brendan-2:~ brendan$ iosnoop -h USAGE: iosnoop [-a|-A|-Deghi Nostv] [-d device] [-f filename] [-m mount_point] [-n name] [-p PID] iosnoop # default output -a # print all data (mostly) -A # dump all data, space delimited -D # print time delta, us (elapsed) -e # print device name -g # print command arguments -i # print device instance -N # print major and minor numbers -o # print disk delta time, us -s # print start time, us -t # print completion time, us -v # print completion time, string -d device # instance name to snoop -f filename # snoop this file only -m mount_point # this FS only -n name # this process name only -p PID # this PID only eg, iosnoop -v # human readable timestamps iosnoop -N # print major and minor numbers iosnoop -m / # snoop events on filesystem / only For tricky performance issues I often use “-sto D” to get start and end timestamps for each I/O in microseconds, and a couple of different types of I/O time calculations.