linux 如何在程序执行时查看Valgrind Massif输出(或其他堆分析器)?

noj0wjuj  于 2023-01-12  发布在  Linux
关注(0)|答案(3)|浏览(246)

当在LINUX中使用Valgrind Massif时,我试图实时查看www.example.com文件,但它在Massif完成执行后生成此文件。我想在代码中放置断点,以观察某些指令对堆的影响,因为只有几个感兴趣的点。我知道我可以重写一些代码来管理这一点,但这意味着以一种不会"massif.out.pid file in real time but it produces this file after Massif finished executing. I want to place breakpoints in the code to watch the effect certain instructions have on the heap as there are only a few points of interest. I know I could rewrite some of the code to manage this but this means influencing the subject code in a way that won't be the final result as well that their is numerous programs I want to do this on. Is there a way to watch points in the code while watching the profiler profile the heap at the same time, so I can distinguish between points of execution?

km0tfn4u

km0tfn4u1#

显然Linux中有一个工具可以给予真实的数据,我还没有尝试过,但在谷歌搜索后发现了它。它被称为heaptrack,显然它可以在程序运行时跟踪堆:
http://milianw.de/blog/heaptrack-a-heap-memory-profiler-for-linux

wyyhbhjk

wyyhbhjk2#

在您想要查看内存堆使用情况的代码中写入sleep(0.5)。然后使用heaptrack ./app执行应用程序,然后使用heaptrack_gui app. heaptrack. gz打开结果文件
转到consumed tap并按时间线检查内存使用情况。

t3irkdon

t3irkdon3#

也许有点晚了,但massif-visualizer正是您正在寻找的工具:massif-visualizer

相关问题