LoginSignup
8

More than 5 years have passed since last update.

posted at

updated at

linux システムコール straceで確認、調査

straceでシステムコールトレース

strace -p 12345 -o /tmp/strace.txt

straceでシステムコールの統計情報取得 Ctrl + cで止める

strace -p 12345 -c

下記みたいのがでる。

text
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 93.94    0.827378        8530        97           clone
  5.00    0.044060         454        97           wait4
  0.62    0.005423           3      2161        99 read
  0.15    0.001279           1      1769           poll
  0.07    0.000612           0     18949      2648 stat
  0.05    0.000462           0      5082           munmap
  0.04    0.000387           0      8543           getcwd
  0.03    0.000269           0      1548           write
  0.02    0.000205           0      5483       204 open
  0.02    0.000174           0      5695           close

値がおかしそうなsyscallのものを出力したファイルで確認する

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
8