use oprofile to analyse postgres

a. 启动后台进程,不profile linux内核

opcontrol --start-daemon --no-vmlinux

b. 设置参数

opcontrol -c 1000

opcontrol -p all

c. profile postgres进程

opcontrol -I postgres

d. 准备开始

opcontrol --status   查看当前状态

opcontrol -s        start

opcontrol --reset    将之前的内容清空

e. pg运行

这时可以跑想跑的实验,oprofile的后台进程正在收集关于postgres的信息。

f. profile结束

opcontrol --dump           导出数据

opcontrol -t                结束profile

opcontrol --shutdown        关闭进程

g. 获得结果,仍用重定向的方法

opreport -l -x | more > 重定向位置

opreport --callgrapg > 重定向位置

h. opreport报错opreport error: No sample file found解决方法

opcontrol --deinit

rm ~/.oprofile/daemonrc

之后重启oprfile即可。

posted @ 2013-04-18 15:45  立春了  Views(205)  Comments(0)    收藏  举报