我一直在使用gprof分析我的程序,并注意到下面的内容出现在顶部:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
17.50 6.69 6.69 _mcount_private
12.14 11.33 4.64 __cosl_internal
11.02 15.54 4.21 __sinl_internal我大量地使用cmath库中的余弦函数和正弦函数,而且由于cos和sin在这些函数调用的名称中,可能是这些函数调用的名称。但是,在分析器的后面,我也有
% cumulative self self total
time seconds seconds calls s/call s/call name
2.93 23.25 1.12 cos
2.51 24.21 0.96 sin这是令人困惑的,所以我不完全确定__cosl/sinl_ is实际上是什么意思。当试图搜索这个问题时,没有得到有意义的结果。
下面是使用的build命令:
i686-w64-mingw32-g++.exe -Wshadow -Winit-self -Wredundant-decls
-Wcast-align -Wfloat-equal -Wunreachable-code -Wmissing-include-dirs
-pedantic-errors -pedantic -Wall -std=c++14 -fexceptions -O2 -std=c++14
-pg -DSFML_STATIC -std=c++14发布于 2018-11-24 13:55:25
这两个函数是来自cos和sin的实现细节。
如果您查看https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/math/cos.def.h#L51,三角函数在计算实际值之前首先检查该值是NaN还是无穷大。这就是为什么你会得到两次点击:
您可以将内部函数视为cos/sin调用。它们可能不会显示从sin/cos调用它们的事实,这取决于所生成的调试信息以及优化级别。
https://stackoverflow.com/questions/53458717
复制相似问题