What is truss or strace?

When you have a problem with your web server it is often quite useful to use a system call tracer to see what the web server is doing. System call tracers exist on most UNIX platforms.

Solaris truss
Linux strace
SGI par, or strace available from SGI's Freeware Website
FreeBSD ktrace
BSDI ktrace
HP-UX tusc (not part of main distribution)
Tru64 (Digital) Unix trace (not part of main distribution)

truss

exec() system call

-vall Verbose. Displays the contents of any structures passed by address to all system calls. Input values as well as values returned by the operating system are shown.

-wall Show the contents of the I/O buffer for each write() on all file descriptors

-o output file

-p process id to trace

Replace -p [pid] with [command] to trace a specific command.

To truss ZWS upon startup you should invoke this command

truss -fae -vall -rall -wall -o /tmp/truss.log ./path/to/zeus/ -z

strace

The equivalent strace command would be :-

strace -fe verbose=all -e write=all -o /tmp/strace.log -p [pid]

-f traces all child processes as they are created byt he currently traced process as a result of the fork() system call.

-e is a qualifying expression which modifies which events to trace or how to race them

verbose=all dereferences structures for all system calls

write=all performs a full hexadecimal and ASCII dump of all the data written to all file descriptors

-o output file

-p process id to trace

Replace -p [pid] with [command] to trace a specific command.

tusc

Using tusc, would yield :-

tusc -fae -o /tmp/tusc.log -p [pid]

-f follows forks

-a prints exec arguements

-e prints environment variables

-o output file

-p process id to trace

Replace -p [pid] with [command] to trace a specific command.

ktrace

On FreeBSD, BSDI and Open BSD, use ktrace :-

ktrace -di -ta -f /tmp/ktrace.log -p [pid]

-d follows decendants

-i passess trace flags on to all future children of the designated processes

-ta traces all points

-f redirects output to specified file, rather than the default

-p process id to trace

Replace -p [pid] with [command] to trace a specific command.

The output of ktrace is not human readable. Use kdump to decode it.

trace

trace is the system tracing program on Tru64

Usage: trace -fPp [pid]

-f follows fork()ed child processes

-P prints process id of process being traced before each system call

-p process id to be traced

Replace -p [pid] with [command] to trace a specific command.

par

Use par on Irix to trace.

Usage: par -s -SS -o /tmp/trace.log -p [pid]

-s collects system call and signal data for the process being traced

-SS prints detailed system call trace and summary of system calls and signal counts

-o file in which raw output data is written

-p process id to be traced

Replace -p [pid] with [command] to trace a specific command.

Content Manager [Administrator] 19 September 2005 Bookmark with del.icio.us Post this article to Digg Post this article to reddit Post this article to Facebook Tweet this article  

Comments are closed for this post.

Recently...

Other Resources