2

valgrind --tool=massif benchmark1 --massif-out-file=test.out在版本为 的 MacOS (10.12.6) 上运行时valgrind-3.13.0,会生成输出,但仅以默认文件名格式,即massif.out.\d+. 不test.out生成文件。示例输出是:

==32233== Massif, a heap profiler
==32233== Copyright (C) 2003-2017, and GNU GPL'd, by Nicholas Nethercote
==32233== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==32233== Command: benchmark1 --massif-out-file=./test.out
==32233==

我缺少什么,或者 MacOS 版本忽略了此功能?我还尝试将文件名放在引号中,但没有成功。

4

2 回答 2

3

根据上面的跟踪,您已将 valgrind --massif-out-file=./test.out 选项提供给 benchmark1,它可能默默地忽略了它。

你所要做的:

   valgrind ...valgrind options...   your_program ....your program options....

因此,请尝试以下操作:

valgrind --tool=massif --massif-out-file=./test.out benchmark1
于 2018-08-28T21:45:21.353 回答
1

在使用了一些 valgrind 工具(memcheck 和 massif)之后,我发现我们必须遵循它的规则:

valgrind --tool=... valgrind_option=... your_program program_argument
于 2019-01-07T03:43:34.023 回答