strace的应用

查看程序在运行中读写哪些文件:
strace -e open 程序 2>&1
寻找不能打开某个文件的原因:
strace -e open,access 2>&1 | grep 文件

查看正在运行的程序:
strace -p 程序ID

分析所花时间:
strace -c -p 程序ID

分析网络连接状况:
strace -e poll,select,connect,recvfrom,sendto nc www.baidu.com 80
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s