将 Valgrind 限制为特定功能 [英] Restricting Valgrind to a specific function

查看:33
本文介绍了将 Valgrind 限制为特定功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大程序要运行.使用 valgrind 需要几个小时才能运行.我听说有一些东西可以让我们为程序中的特定函数调用 valgrind.其余程序将正常执行(没有 valgrind env).任何人都可以帮我解决这个问题.我尝试通过互联网搜索它,可能是我错过了要搜索的词.

I have a big program to run. Using valgrind it takes hours and hours to run. I heard that there is something where we can call valgrind for a specific function in the program. And rest of program will be executed normally(without valgrind env). Can anybody help me with this. I tried searching it over internet , May be I am missing the term to search.

推荐答案

这完全取决于您要使用的工具.对于 callgrind(valgrind 中的分析器),有一个选项 --toggle-collect=function 允许您收集特定函数及其所有子函数中的信息.

It all depends on what tool you're wanting to use. For callgrind (the profiler in valgrind) there is an option --toggle-collect=function to allow you to collect information inside a particular function and all its children.

但是,如果您感兴趣的工具是 memcheck(用于捕获泄漏/内存错误),则没有可用的命令行选项.

However if the tool you're interested in is memcheck (for capturing leaks / memory errors) then there is no available command line option.

这篇关于将 Valgrind 限制为特定功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆