在用 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 2008 Express,Windows 64 位。
最佳答案
只需转到 Analyze -> Profiler -> Attach/Detach
。
关于python - C++ 中的 Cprofile(Python)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27261096/