Issues in the gprof output report

Pavankumar S V pavankumarsv96 at gmail.com
Sat Jun 24 11:51:48 UTC 2023


Hello,
I have followed these steps to generate a profiling data from 
gprof:
1) -pg flag added for both compiler and linker while compiling.
    Also added compiler flags like -fno-inline-functions, 
-fno-builtin,
    -no-pie as suggested in many online forums.
2) Executed the program and got the gmon.out file generated.
3) Using gprof to read the profiling data:
    ```gprof app_name gmon.out > analysis.txt```

Note:
My embedded application is multithreaded running on Linux 
platform. It has infinite 'for' loop to keep the main thread 
alive. But I am limiting this 'for' loop to few thousands of 
iterations and returning from the main() function to get the 
gmon.out file generated.

The below points made me doubt the correctness of the profiling 
data:

*) main() function and its details is not shown in the gprof 
output file.

*) There is a function that gets called inside the 'for' loop in 
my application which I know is taking a lot of time(as it is 
using ioctl() calls everytime and confirmed that it takes too 
much time with testing). But gprof output file shows that it is 
taking very less time to get executed.

1) Please let me know where I'm going wrong or should I do 
anything more to get correct profiling data from gprof.
2) The default sampling rate of gprof is 0.01 seconds. Is there a 
way to increase this sampling rate of gprof? I want to try by 
increasing the sampling rate because 0.01 seconds seems to be 
very less.


More information about the Digitalmars-d-learn mailing list