在用Python编写代码时,我通常使用Cprofile,它在控制台中打印概要文件的结果:
import cProfile, pstats, StringIO
pr = cProfile.Profile()
pr.enable()
#do stuff
pr.disable()
s = StringIO.StringIO()
ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
ps.print_stats()
print s.getvalue()在C++?中有没有其他的选择?
编辑-我使用VS 2008Express,Windows 64位。
发布于 2014-12-09 20:04:44
去Analyze -> Profiler -> Attach/Detach吧。
发布于 2014-12-02 23:47:28
在C++中,缬草,特别是回调几乎是实现这一目的的标准方法。但是,它比python要复杂一些,因为python基本上可以对每个方法的所有调用进行猴子补丁,以生成调用图和其他东西。
http://valgrind.org/docs/manual/cl-manual.html
https://stackoverflow.com/questions/27261096
复制相似问题