CPU性能分析(Callgrind)
valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./example
callgrind_annotate callgrind.out.* --auto=yes > report.txt
- ./example是编译生成的可执行文件
- 第1条命令会让程序执行变长很多,请耐心等待…
- 第2条命令生成的report.txt文件就是最终输出,将内容发给ai让它给你解释就行了
内存占用分析(Massif)
valgrind --tool=massif --massif-out-file=massif.out ./example
ms_print massif.out.* > report.txt
- ./example是编译生成的可执行文件
- 第2条命令生成的report.txt文件就是最终输出,将内容发给ai让它给你解释就行了