在CentOS Linux下分析C程序

时间:2012-10-11 20:13:23

标签: profiling centos

在CentOS下,什么命令行将描述我的C程序,包括在系统调用中花费的时间?我需要用yum安装哪些程序?

1 个答案:

答案 0 :(得分:1)

安装oprofile:yum install oprofile

初始化oprofile:

opcontrol --no-vmlinux #If you have vmlinux set this option differently
opcontrol --init
opcontrol --reset
opcontrol --separate=lib
opcontrol --callgraph=0    # clear callgraph in case it was used recently
opcontrol --start

现在运行要分析的程序。一旦运行足够长时间,请执行以下操作:

opcontrol --dump
opreport --symbols /path/to/executable

有关其他示例输出,请参阅here

相关问题