Summarizing system call activity on Linux systems


Linux has a guadzillion debugging utilities available. One of my favorite tools for debugging problems is strace, which allows you to observe the system calls a process is making in realtime. Strace also has a “-c” option to summarize system call activity:

$ strace -c -p 28009

Process 28009 attached
Process 28009 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
78.17 0.001278 2 643 select
14.80 0.000242 1 322 read
7.03 0.000115 0 322 write
------ ----------- ----------- --------- --------- ----------------
100.00 0.001635 1287 total

The output contains the percentage of time spent in each system call, the total time in seconds, the microseconds per call, the total number of calls, a count of the number of errors and the type of system call that was made. This output has numerous uses, and is a great way to observe how a process is interacting with the kernel. Good stuff!

This article was posted by Matty on 2012-07-20 18:19:00 -0400 EDT