c++profilinggprof

GProf: What are __cosl_internal and __sinl_internal functions?


I've been profiling my program using gprof and noticed the following appear near the top:

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

I use the cosine and sine functions from the cmath library quite heavily, and since cos and sin are in the names of these function calls, perhaps it could be those. However, further down the profiler, I also have

 %   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

which is confusing, so I'm not entirely sure what __cosl/sinl_internal actually means. Got no meaningful results when trying to Google the issue.

Here is the build command used:

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

Solution

  • These two functions are implementation details from cos and sin.

    If you look at https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/math/cos.def.h#L51, the trigonometric functions first check if the value is NaN or infinite before computing the actual value. This is the reason why you get two hits:

    You can consider the internal functions as being cos/sin calls. They may not display the fact that they are called from sin/cos depending on the debug information generated as well as the optimization level.