gpt4 book ai didi

profiling - 带有堆分析的 google-perftools/pprof 格式

转载 作者:行者123 更新时间:2023-12-04 06:08:17 24 4
gpt4 key购买 nike

在 google-perftools 包中有一个 pprof 实用程序。它是将配置文件从 google-perftools cpuprofiler 和 heapprofiler 转换为漂亮图像的实用程序:如 https://github.com/gperftools/gperftools/tree/master/doc/pprof-test-big.gifhttps://github.com/gperftools/gperftools/tree/master/doc/heap-example1.png

此处为 cpu 配置文件描述了 pprof 输入文件的格式:https://github.com/gperftools/gperftools/tree/master/doc/cpuprofile-fileformat.html

但是 heap profile 输入文件的格式没有在 svn 中描述。

什么是“heapprofiling”格式,我如何从我的代码中生成这样的文件?我已经可以生成 cpuprofiler 格式,所以我对这两种格式之间的区别很感兴趣。

最佳答案

对于 cpu profiler,格式似乎不是二进制的,而是文本的:

第一行:

 heap profile:   1:   2 [ 3:  4] @ heapprofile

正则表达式(不完整)

 (\d+): (\d+) \[(\d+): (\d+)\] @ ([^/]*)(/(\d+))?)?

在哪里

  • 1 & 2 是“使用中的统计数据”;第一个数字是分配数,第二个是字节数
  • 3 & 4 是“分配的总统计数据”;第一第二同义
  • heapprofile 是类型

然后配置文件本身遵循很多行:

 1: 2 [ 3: 4] @ 0x00001 0x00002 0x00003

其中“1:2”和“3:4”与第一行含义相同;但仅从给定的调用点分配; 0x00001 0x00002 是调用点的调用栈。

然后是空行和“MAPPED_LIBRARIES:”。从下一行开始,一些非常类似于/proc/pid/maps 的副本。

关于profiling - 带有堆分析的 google-perftools/pprof 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8083112/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com