- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我试图在我的程序中找到性能问题,因此通过分析来检测代码。 gprof 创建一个像这样的平面配置文件:
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
27.97 4.10 4.10 std::_Deque_iterator<char, char&, char*>::_Deque_iterator(std::_Deque_iterator<char, char&, char*> const&)
6.96 5.12 1.02 std::_Deque_iterator<char, char&, char*>::difference_type std::operator-<char, char&, char*>(std::_Deque_iterator<char, char&, char*> const&, std::_Deque_iterator<char, char&, char*> const&)
5.12 5.87 0.75 std::__deque_buf_size(unsigned int)
4.23 6.49 0.62 std::_Deque_iterator<char, char&, char*>::operator+=(int)
3.41 6.99 0.50 std::deque<char, std::allocator<char> >::begin()
1.91 7.27 0.28 7896 0.04 0.04 std::vector<MyClass, std::allocator<MyClass> >::_M_insert_aux(__gnu_cxx::__normal_iterator<MyClass*, std::vector<MyClass, MyClasst> > >, MyClassconst&)
1.91 7.55 0.28 std::deque<char, std::allocator<char> >::size() const
1.91 7.83 0.28 std::_Deque_iterator<char, char&, char*>::_S_buffer_size()
紧随其后的是许多行,时间更短。
第一个问题:相信 std::deque 似乎存在问题是否是一个有效的假设?问题是:我知道我们正在使用 std::deque,但我不知道 <char>
的用法.
如果这个假设成立,那么查看调用堆栈并查看使用此双端队列的位置似乎是有意义的。然而所有关于 deque<char>
的条目东西只被 <spontaneous>
调用!
举个例子:
index % time self children called name
<spontaneous>
[1] 28.0 4.10 0.00 std::_Deque_iterator<char, char&, char*>::_Deque_iterator(std::_Deque_iterator<char, char&, char*> const&) [1]
有什么办法可以找到更多关于这个双端队列的信息吗?
感谢任何提示!
最佳答案
显然,自发是 gprof 在无法计算出调用函数时使用的方法。我会尝试使用 -pg 重新编译所有代码(您是否可能遗漏了一些文件?)。另外,请确保您已打开优化。内联通常会使这些小函数消失在通常更有用的调用函数中。
关于c++ - 使用 <spontaneous> 解释 gprof 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7606408/
这个问题在这里已经有了答案: Time Sampling Problems with gprof (1 个回答) 关闭 6 年前。 我有一个简单的排序程序,我正在对它进行分析,以便有一个案例来研究
我正在尝试分析一些 C 代码,但最直观的昂贵函数之一并未显示在 GProf 输出中。 int main() { initialise... haloSwap(); for(..
我正在尝试使用 gprof 来分析我正在开发的一些数字代码,但是 gprof 似乎无法从我的程序中收集数据。这是我的命令行: g++ -Wall -O3 -g -pg -o fftw_test fft
在各种示例程序上使用 Ubuntu 17.04 中的 gprof 2.28 和 gcc 6.3.0 我得到每个类别的空输出。如果我在一个示例程序上运行 gprof -i,我得到: 1 histogra
我知道以前有人问过类似的问题,但是: 关于 gprof produces empty output 我在 Windows 10 上使用来自 MSYS2 的 GCC 10.2.0,即它是 MingW64
我们正在开发一个多线程项目。我的同事说 gprof 可以完美地工作,无需处理多线程程序。我前段时间读过其他内容。 http://sam.zoy.org/writings/programming/gpr
我在我的可执行文件上运行 gprof,但该可执行文件花费了大量时间 wait() ing 以完成子进程。等待时间是否计入 gprof 时间? 最佳答案 我没有经常使用 gprof,但据我所知,wait
这是一个臃肿的问题,所以我提前道歉。我很好奇 gprof 在低技术水平上工作。我知道它是由计时器完成的,但是为什么需要专门编译可执行文件才能对其进行分析?编译是否会导致为统计分配空间? 另外,时间是如
我正在使用 -pg 选项运行我的程序。当我打开输出 gmon.out 它只是累积列表而不是调用图。我该如何解决? 我知道这里之前有人问过这个问题:gprof - File is missing cal
我正在尝试使用 gprof 命令:gprof -s executable.exe gmon.out gmon.sum合并从我的程序的 2 次运行中收集的分析数据。但是出现以下错误: gprof: ou
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我尝试使用 gprof(我必须使用 gprof - 没有其他选项可用)当我得到平面文件时,结果是空的,尽管一切正常。 顺便说一下,代码是用 c 写的,所以我使用的是 gcc。 结果: Each sam
我正在尝试 2 配置一个 cpp 代码。我使用 -pg 标志进行编译,在分析它以获得输出后,我得到了一些非常奇怪的函数名称。这是我正在使用的 make 文件: # Makefile for paral
问题在于 gmon.out 文件没有显示正确的数据。所有时间都为 0,没有任何测量。gmon.out 文件通常生成。我正在使用 C++ 的 eclipse ide,并像往常一样链接、编译和运行程序。
我创建了一个简单的程序: #include void ssleep(unsigned int s) { usleep(1000000*s); } int main(int, char**) {
我正在尝试使用 gprof分析我编写的程序,并收到难以理解的结果。大多数函数名称都以 _abfcd96687bed377dcecdf193c89698 的形式出现。我相信它们来 self 链接的第三方
我对分析函数 grep_source_is_binary()[1] 很感兴趣,它的代码如下: static int grep_source_is_binary(struct grep_source *
我在 GPROF Automating the profling of C program using GPROF 上问了一个问题 看来我已经找到了一半的解决方案(我现在知道如何使用 bash 脚本自
我正在运行 Ubuntu 16.10 并尝试使用 gprof 分析程序。我用标志 -pg 编译,程序是单线程的。实际的编译命令是: g++ -I. -std=c++11 -Wall -Wextra -
我刚开始使用 gprof 并尝试生成一个调用图。我正在使用 cmake 来设置我的 makefile,我正在设置 CMAKE_EXE_LINKER_FLAGS = -gp 以启用分析。我启用的唯一 c
我是一名优秀的程序员,十分优秀!