Yanyg - Software Engineer

strace使用示例

目录

1 观察时间分布

~# strace -c dd if=/dev/sda of=/dev/null iflag=direct count=100k bs=4K
102400+0 records in
102400+0 records out
419430400 bytes (419 MB) copied, 4.95506 s, 84.6 MB/s
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 94.88    0.006669           0    102403           read
  5.12    0.000360           0    102403           write
  0.00    0.000000           0        10         4 open
  0.00    0.000000           0         9           close
  0.00    0.000000           0         4           fstat
  0.00    0.000000           0         1           lseek
  0.00    0.000000           0        10           mmap
  0.00    0.000000           0         4           mprotect
  0.00    0.000000           0         2           munmap
  0.00    0.000000           0         3           brk
  0.00    0.000000           0         4           rt_sigaction
  0.00    0.000000           0         3         3 access
  0.00    0.000000           0         2           dup2
  0.00    0.000000           0         1           execve
  0.00    0.000000           0         1           arch_prctl
------ ----------- ----------- --------- --------- ----------------
100.00    0.007029                204860         7 total