【问题标题】:valgrind massif heap profiler no detailed snapshot view - how do you zoom in/out?valgrind massif heap profiler 没有详细的快照视图 - 你如何放大/缩小?
【发布时间】:2018-08-01 05:31:17
【问题描述】:

所以我试图在 Ubuntu 18 中查看我的 c++ 程序的堆内存使用情况

我已经使用:

valgrind --tool=massif --smc-check=all ./myprogram

我得到了相当大的输出,这没关系。我使用 massif-visualizer 查看它。

我得到了一个漂亮的图表等等。但我想在我的程序结束时详细查看它的关闭情况。但我似乎无法放大图表视图,而且我看不到这样做的选项。

手册页(here)这样说:

Massif 生成了一些详细的快照,这些快照基本上构成了 那个树。如果你想 要以比简单树视图更舒适的方式获得概览,请切换到 详细的快照选项卡并查看可视化为调用图的树。放大、缩小、使用 鸟瞰图,看看是什么促成了给定的快照。注意函数调用 具有相同内存成本的分组以轻松找到有趣的部分。

但我看不到“switch over to the detailed snapshot tab”的选项...还有其他人知道怎么做吗?

Ubuntu 18

massif-visualizer 0.7

【问题讨论】:

    标签: ubuntu valgrind massif


    【解决方案1】:

    您可以使用 kcachegrind 代替 massif 可视化器来可视化内存 使用 valgrind 3.13 中出现的新“xtree 功能”。

    这是 valgrind --help 的摘录:

      user options for Valgrind tools that replace malloc:
        --alignment=<number>      set minimum alignment of heap allocations [16]
        --redzone-size=<number>   set minimum size of redzones added before/after
                                  heap blocks (in bytes). [16]
        --xtree-memory=none|allocs|full   profile heap memory in an xtree [none]
                                  and produces a report at the end of the execution
                                  none: no profiling, allocs: current allocated
                                  size/blocks, full: profile current and cumulative
                                  allocated size/blocks and freed size/blocks.
        --xtree-memory-file=<file>   xtree memory report file [xtmemory.kcg.%p]
    

    http://www.valgrind.org/docs/manual/manual-core.html#manual-core.xtree 了解更多信息。

    【讨论】:

    • 感谢博士,我试过这个并阅读了文档。但我不太明白如何使用 kcachegrind 轻松可视化堆内存。我可以查看每条“线”以了解发生了什么-但这需要数年时间!...您能否扩展一下如何随着时间的推移可视化内存,然后“放大”以查看特定的增加/减少? ...虽然我不知道 xree,但现在加 1 :)
    • 在您的问题中,您指出“但我想在我的程序结束时详细查看”。为此,您可以例如使用地块,但另外添加--xtree-memory=full。使用此选项,您将获得一个 xtree 内存文件,您可以将其加载到 kcachegrind 中。然后你可以使用例如kcachegrind 的图形视图,用于扫描在关机时仍分配大量内存的函数调用序列。如果要搜索已分配大量已释放内存的调用序列,请切换到 kcachegrind 中的“总分配”事件。
    • 您可能也有兴趣查看 archive.fosdem.org/2017/schedule/event/valgrind_features 的 fosdem 演示文稿/幻灯片。对于 kcachegrind 格式的地块详细快照或峰值快照有什么顾虑:这种功能在地块中不可用(还没有?)。
    • 非常感谢您提供的信息:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-01
    • 2013-02-24
    • 1970-01-01
    • 2015-06-09
    相关资源
    最近更新 更多