关于erlang:使用fprof-profile-erlang

概述

不谈profile tools的重要性. erlang profile肯定要看看上面这篇.
http://erlang.org/doc/efficie…
这篇blog记录一些实操.

步骤

fprof采集数据

在程序中, 或者间接remote_console触发采集.

:fprof.trace(:start)
# 一段时间后, 留神不要在线上采集, fprof时对性能影响最大的profile形式, 也有最全的信息
:fprof.trace(:stop)

不传递参数状况下, 默认会将fprof信息写入fprof.trace文件.

应用kcachegrind 查看fprof的后果

应用erlgrind转化为callgrind格局

~/install » wget https://raw.githubusercontent.com/isacssouza/erlgrind/master/src/erlgrind
~/install » chmod a+x erlgrind                             
~/install » sudo mv erlgrind /usr/local/bin
~/platform/xxxxx(xxxx*) » erlgrind fprof.trace
Reading trace data...
..................................................
.................................................,
..................................................
.................................................,
..................................................
.................................................,
..................................................
..............................
End of trace!
Processing data...
Creating output...
Done!

装置kcachegrind

能够间接用包管理器装置

sudo apt-get install -y kcachegrind
~/platform/xxxxx(xxxxx*) » kcachegrind xxx.cgrind

成果如图:

flame graph

todo

参考

http://erlang.org/doc/efficie…
http://blog.equanimity.nl/blo…

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理