I am trying to evaluate the computational time using gprof. I compiled my code using the following command and then ran it, worked fine. But while trying to evaluate, its showing 0 cpu time.
a) gcc -pg -o process_basic process_basic.c
b) ./process_basic
c) gprof -b process_basic
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 5 0.00 0.00 display_int_var
0.00 0.00 0.00 5 0.00 0.00 increment
Call graph
granularity: each sample hit covers 2 byte(s) no time propagated
index % time self children called name
0.00 0.00 5/5 main [10]
[1] 0.0 0.00 0.00 5 display_int_var [1]
0.00 0.00 5/5 increment [2]
-----------------------------------------------
0.00 0.00 5/5 display_int_var [1]
[2] 0.0 0.00 0.00 5 increment [2]
-----------------------------------------------
Index by function name
[1] display_int_var [2] increment
It also generated gmon.out and size was 601 bytes. I am using Ubuntu 18.04.2 LTS.
Any idea why the values are 0?