Monitor system calls

Mar 05, '02 01:30:56AM

Contributed by: ddldreaming

As a transplant from other *nix operating systems, I'm used to system call monitoring tools like truss (on Solaris) and strace (on Linux).

While I haven't found anything quite like these for Darwin, sc_usage comes close. It provides a running statistical breakdown of system calls for any process ID (pid) specified on the command line. Although I haven't yet figured out how to parse its output, I expect it'll aid in figuring out where a particular app is getting hung up. In conjunction with fs_usage (mentioned in a previous hint by Ben Hines), you can also track down what files are being called. Note that this must be run in a Terminal window as root (generally via 'sudo').

Usage is:

sudo sc_usage [pid]
Apple has a developer note describing the tool, with some examples, and you can always type man sc_usage in Terminal for typically laconic Unix documentation.

(Thanks go to Fred S., Apple's Open Source Engineering Lead, who posted about these utilities in a MacPerl thread.)

[Sudo Editor's caution: f you're not comfortable with the terminal and root privileges, I would recommend holding off on this hint. ]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020305013056479