Skip to main content

Posts

Showing posts with the label dtrace

List the DTrace providers in your machine

I don't see any official way to list the DTrace providers; you can seemingly only list ALL the probes, the >300K of them (in my Mac right now), and then you have to deal with the multitude of providers instantiated multiple times for different PIDs. So here's a small AWK script to list the unique providers, how many instances of each are there, and how many providers are attached to each PID:

FileMon-like functionality on OS X as a one-liner dtrace script

I first thought about this as a lsof substitute, but no, it's more like a primitive / simple FileMon/fs_usage. It shows the executable and the file it opened. Could be improved, of course. Dtrace is amazing. sudo dtrace -qn 'syscall::open*:entry{ printf("%s %s\n",execname,copyinstr(arg0)); }' fs_usage shows much more information... but is not a one-liner ;P

dtrace'ing paging to disk

How to know which processes are paging to/from disk (as opposed to other VMM management) in OS X, and how much exactly: sudo dtrace -n maj_fault'{@[execname] = count()}' reference (with examples and other options): http://wikis.sun.com/display/DTrace/vminfo+Provider I had been meaning to look for ways to do this, and tried some of the tools included in OS X (Activity Monitor, top, Instruments, vm_stat, vmmap, top, ...). But nothing really helped, and/or seemed to miss the exact level of information I was targeting (only resulting in real I/O; relationship between I/O and process; realtime... ). Finally I had the inspiration to google for "dtrace pagefaults". Bingo. (dtrace in this example isn't realtime, but is the best approximation so far, and I'm guessing some tuning should fix it. Heck, it's a one-liner!) Learning dtrace is still something I'd love to do, and once again it is tempting me to let it jump to the front of queue... (Mhm, wi...