gpt4 book ai didi

c++ - 如何在 Valgrind 上设置分析的开始和结束

转载 作者:行者123 更新时间:2023-11-28 06:22:06 25 4
gpt4 key购买 nike

要在 valgrind 上创建配置文件转储,可以这样做:

valgrind --tool=callgrind 程序 [程序选项]

[来自http://valgrind.org/docs/manual/cl-manual.html ]

我想在一些源文件中设置分析的开始和结束。例如

开始main.cpp:30停止 main.cpp:44

我认为这已经在 Android 上使用这种技术进行了概要分析。这在 Valgrind 上可行吗?

最佳答案

根据引用手册http://valgrind.org/docs/manual/cl-manual.html#cl-manual.basics您至少可以根据自己的客户请求开始和停止分析:

If the program section you want to profile is somewhere in the middle of the run, it is beneficial to fast forward to this section without any profiling, and then enable profiling. This is achieved by using the command line option --instr-atstart=no and running, in a shell: callgrind_control -i on just before the interesting code section is executed. To exactly specify the code position where profiling should start, use the client request CALLGRIND_START_INSTRUMENTATION.

http://valgrind.org/docs/manual/cl-manual.html#cr.start-instr

CALLGRIND_START_INSTRUMENTATION Start full Callgrind instrumentation if not already enabled. When cache simulation is done, this will flush the simulated cache and lead to an artifical cache warmup phase afterwards with cache misses which would not have happened in reality. See also option --instr-atstart.

CALLGRIND_STOP_INSTRUMENTATION Stop full Callgrind instrumentation if not already disabled. This flushes Valgrinds translation cache, and does no additional instrumentation afterwards: it effectivly will run at the same speed as Nulgrind, i.e. at minimal slowdown. Use this to speed up the Callgrind run for uninteresting code parts. Use CALLGRIND_START_INSTRUMENTATION to enable instrumentation again. See also option --instr-atstart.

关于c++ - 如何在 Valgrind 上设置分析的开始和结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29159470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com