Microsoft VC++中prep/profile/plist的使用
A 命令行方式
需要在Build时产生map文件,它可以在项目设置的Link中修改。Steps:
1. Prepare executable for profiling.
C:\Profile> prep /ft /fc /fv foo.exe
2. Start executable with profile.
C:\Profile> profile foo.exe <arguments>
3. Preprocess gathered information.
C:\Profile> prep /io foo.pbi /it foo.pbt /ot foo2.pbt
4. Show the results.
C:\Profile> plist foo2.pbt
B IDE方式
设置:Project->Settings->Link->General->Enable profiling
编译连接:Build整个项目
执行:Build->Profile...
注意:
1. 默认情况下.map文件在Debug目录下,可执行程序也放在该处
2. 不是所有的项目都要进行设置,有些项目是没有Link选项的,比如一些静态链接库。
3. profile支持Release版本,测试性能瓶颈的时候建议使用Release。
4. 在某些机器上,菜单项“Build->Profile...”是灰色的(禁用状态),请参考: Tips and tricks for Visual C++
中的问题8。