博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
简介Valgrind工具包功能
阅读量:7236 次
发布时间:2019-06-29

本文共 3383 字,大约阅读时间需要 11 分钟。

我就不班门弄斧了。不过呢,有可能有些同学可能不知道Valgrind有哪些功能,那么我就从Valgrind的官方网站处,摘几段文字吧。
Memcheck

Memcheck detects memory-management problems, and is aimed primarily at C and C++ programs. When a program is run under Memcheck's supervision, all reads and writes of memory are checked, and calls to malloc/new/free/delete are intercepted. As a result, Memcheck can detect if your program:

  • Accesses memory it shouldn't (areas not yet allocated, areas that have been freed, areas past the end of heap blocks, inaccessible areas of the stack).
  • Uses uninitialised values in dangerous ways.
  • Leaks memory.
  • Does bad frees of heap blocks (double frees, mismatched frees).
  • Passes overlapping source and destination memory blocks to memcpy() and related functions.

Memcheck reports these errors as soon as they occur, giving the source line number at which it occurred, and also a stack trace of the functions called to reach that line. Memcheck tracks addressability at the byte-level, and initialisation of values at the bit-level. As a result, it can detect the use of single uninitialised bits, and does not report spurious errors on bitfield operations. Memcheck runs programs about 10--30x slower than normal.

Cachegrind

Cachegrind is a cache profiler. It performs detailed simulation of the I1, D1 and L2 caches in your CPU and so can accurately pinpoint the sources of cache misses in your code. It identifies the number of cache misses, memory references and instructions executed for each line of source code, with per-function, per-module and whole-program summaries. It is useful with programs written in any language. Cachegrind runs programs about 20--100x slower than normal.

Callgrind
Callgrind, by Josef Weidendorfer, is an extension to 
. It provides all the information that Cachegrind does, plus extra information about callgraphs. It was folded into the main Valgrind distribution in version 3.2.0. Available separately is an amazing visualisation tool, 
, which gives a much better overview of the data that Callgrind collects; it can also be used to visualise Cachegrind's output.

Massif

Massif is a heap profiler. It performs detailed heap profiling by taking regular snapshots of a program's heap. It produces a graph showing heap usage over time, including information about which parts of the program are responsible for the most memory allocations. The graph is supplemented by a text or HTML file that includes more information for determining where the most memory is being allocated. Massif runs programs about 20x slower than normal.

Helgrind

Helgrind is a thread debugger which finds data races in multithreaded programs. It looks for memory locations which are accessed by more than one (POSIX p-)thread, but for which no consistently used (pthread_mutex_) lock can be found. Such locations are indicative of missing synchronisation between threads, and could cause hard-to-find timing-dependent problems. It is useful for any program that uses pthreads. It is a somewhat experimental tool, so your feedback is especially welcome here.

DRD

DRD is a tool for detecting errors in multithreaded C and C++ programs. The tool works for any program that uses the POSIX threading primitives or that uses threading concepts built on top of the POSIX threading primitives. While Helgrind can detect locking order violations, for most programs DRD needs less memory to perform its analysis.

原文:

转载地址:http://mggfm.baihongyu.com/

你可能感兴趣的文章
C语言之基本算法11—牛顿迭代法求平方根
查看>>
Concurrency and Application Design
查看>>
vuethink 在本地没问题,在服务器报错 , php5.6与php5.5之间的大坑
查看>>
11.使用 package.json
查看>>
idea如何设置类头注释和方法注释
查看>>
白盒测试目录导航
查看>>
linux过滤旧文件中的空行和注释行剩余内容组成新文件
查看>>
[LeetCode] Preimage Size of Factorial Zeroes Function 阶乘零的原像个数函数
查看>>
GraphQL入门1
查看>>
C#委托的介绍(delegate、Action、Func、predicate)
查看>>
巧用Scrum与Kanban
查看>>
质量报告之我见
查看>>
微信域名weixin.com天价成交!是腾讯吗?
查看>>
C#实现远程机器管理
查看>>
Android生成带图片的二维码
查看>>
jQuery对表单、表格的操作及更多应用(下:其他应用)
查看>>
[.net 面向对象编程基础] (21) 委托
查看>>
阶乘相关问题
查看>>
ASP.NET MVC导出excel(数据量大,非常耗时的,异步导出)
查看>>
Java引用类型变量
查看>>