Example 1
Add -pg
arm-linux-gnueabihf-g++ -Wall -g -pg hello.cpp -o hello -std=c++17
Test
root@imx6ul7d:~# gprof -b hello
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
100.00 3.45 3.45 1 3.45 3.45 hehe()
0.00 3.45 0.00 4 0.00 0.00 std::_Optional_base, std::allocator > >::_M_is_engaged() const
……