c++ - 在 massif 工具中跟踪子进程的命令

标签 c++ valgrind massif

我在 Valgrind 中使用 massif 工具。我需要跟踪子进程的堆内存。我找不到任何命令来获取子进程的堆内存。我的应用程序是一个恶魔服务器。

在 memcheck 工具中,我可以使用

获取子进程的详细信息
--track-children=yes

有什么方法可以使用 massif 跟踪子进程堆内存吗??

该工具为所有子进程创建日志文件,但它仅为主进程生成 massif 文件。

valgrind \
--tool=massif \
--heap=yes \
--time-stamp=yes \
--time-unit=ms \
--max-snapshots=1000 \
--detailed-freq=5 \
--log-file=../Valgrind_%p_massif.log \
--massif-out-file=../masssif_%p_output \
--xtree-memory=full \
<binary_name>

我希望为所有子进程生成 massif 文件。但它只创建一个文件来对抗主进程。

我检查了文件上次访问时间。主进程执行到等待请求的时间。

最佳答案

您缺少选项 --trace-children=yes

--trace-children 不是特定于 memcheck 的选项,它是一个通用的 valgrind 选项,如果您希望子进程在 exec 之后也在 valgrind 下运行,则必须与任何 valgrind 工具一起使用。

关于c++ - 在 massif 工具中跟踪子进程的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57424283/

相关文章:

c++ - 使用 cmake 在多个模块中使用实用程序库(仅 header )

c++ - Win32 从 Window WndProc 获取发送事件的对象的 HWND

c++ - iOS 音频队列 : kAudioQueueErr_InvalidPropertyValue for property kAudioQueueProperty_CurrentLevelMeter

c - Valgrind:无效读取和使用未初始化值

valgrind - Massif 可以增量转储日志吗

Valgrind Massif工具输出图形界面?

c++ - 完美转发STL容器到模板类

c - 为什么 valgrind 在调用 `pcap_open_offline` 时会报告内存泄漏?

c++ - Valgrind 错误 : Syscall param epoll_pwait(sigmask) points to unaddressable byte(s)

profiling - 为什么 valgrind Massif 不报告任何函数名称或代码引用?