0

我将一个工具实现为 .so 库,需要将其预加载到可执行文件中。现在,我想估计我的工具在不同基准上的内存使用情况。

LD_PRELOAD=./mytool.so ./executable

我以不同的方式尝试了 valgrind massif 工具,例如

  1. LD_PRELOAD=./mytool.so valgrind --tool=massif ./executable

  2. runVal.sh

    #! /bin/sh
    LD_PRELOAD=./mytool.so ./executable
    

    然后运行: valgrind --tool=massif --trace-children=yes ./runVal.sh

https://valgrind-users.narkive.com/Ui9EDXiq/valgrind-with-ld-preload

https://www.mail-archive.com/valgrind-users@lists.sourceforge.net/msg04782.html

  1. LD_PRELOAD=./mytool.so valgrind ./executable

  2. 使用来自 gdb 的 valgrind。

https://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver

所有这些方法都产生不一致的数据。

是否有任何工具可以与 LD_PRELOAD=./mytool.so ./executable 一起使用来估计内存?

4

0 回答 0