strace

From wikieduonline
Revision as of 07:52, 24 March 2023 by Brave (talk | contribs)
Jump to navigation Jump to search

strace[1] is a diagnostic, debugging and instructional userspace utility for Linux that allows to trace system calls and signals.


strace -c -f -p $PID
 .../...
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 63.56    0.032899         539        61        13 futex
 17.62    0.009118         217        42           epoll_pwait
 11.48    0.005944         104        57           nanosleep
  3.15    0.001628          11       142           madvise
  1.07    0.000553          79         7           read
  0.87    0.000452          64         7           write
  0.72    0.000374         374         1         1 restart_syscall
  0.59    0.000307          51         6           sched_yield
  0.56    0.000291         145         2           getpid
  0.36    0.000184          92         2           rt_sigreturn
  0.01    0.000007           3         2           tgkill
------ ----------- ----------- --------- --------- ----------------
100.00    0.051757                   329        14 total

Examples

  • Strace ps command:
strace -e open ps
  • strace -p MY_PID_NUMBER

See also

  • http://man7.org/linux/man-pages/man1/strace.1.html
  • Advertising: