HomePage » Linux » LinuxStrace


strace

strace is an important utility to query system call usage.

tracing a running process
strace -p $PID


Get a process's system call category report
Use strace -c

strace -p 3712 -c
Process 3712 attached - interrupt to quit
Process 3712 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 94.27    0.006843           3      2641           poll
  4.16    0.000302           0      7781           gettimeofday
  1.20    0.000087           1        70           futex
  0.37    0.000027           0      5244           ioctl
  0.00    0.000000           0       510           read
  0.00    0.000000           0       233           write
------ ----------- ----------- --------- --------- ----------------
100.00    0.007259                 16479           total


Tracing a hung process

Do a strace -p on the process, if it ends with
read(13,


That means the system is hung on a read system call, to the file descriptor 13. Do a lsof to find out what fd #13 is.


Comments [Hide comments/form]
Great hmmaer of Thor, that is powerfully helpful!
-- t152.1paket.com (2012-04-30 21:23:23)
nWQhN4 <a href="http://pwyzvzzzsjqn.com/&
-- 178.238.187.75 (2012-05-01 08:24:54)
jqMBZj , [url=http://qlqiaddrabwx.com/]qlqiaddrabw
-- 180.131.15.62 (2012-05-02 06:10:10)
d0OUIR <a href="http://miluycqvxdjy.com/&
-- 188.116.250.249 (2012-05-03 06:51:07)
XYwbl3 , [url=http://uzpdkosoyqit.com/]uzpdkosoyqi
-- p1.gapcrawler.com (2012-05-03 10:16:30)
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki