How to use sprof?

2019-03-20 07:36发布

please explain with example?

标签: linux sprof
1条回答
霸刀☆藐视天下
2楼-- · 2019-03-20 08:16

From the emails found here and here, I've extracted the following notes:

Given an application my_app', which links against a shared objectmy_sobj', and has been compiled with the '-g' compile flag:

#set the environment variable LD_PROFILE to the name of the shared obj
export LD_PROFILE=my_obj
#run your application
my_app
#this should create a file /var/tmp/my_sobj.profile
#now run sprof
sprof my_sobj my_sobj.profile

This gives profile information for the shared library, not for my_app

查看更多
登录 后发表回答