How to profile Beluga
Generating a flamegraph from recorded perf events
A flamegraph is a convenient tool for understanding how CPU time is being used.
To start, run the docker container in privileged mode:
docker/run.sh -pYour code needs to be built with debug info and may also need frame pointers. For that, use:
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer"
Run the following script to generate the profiling data:
source /ws/install/setup.bash ros2 run beluga_benchmark profile_amcl_with_bagfile
perfwill generate aperf.datafile in the folder it was run.To generate a flamegraph from the recorded data, run:
source /ws/install/setup.bash ros2 run beluga_benchmark flamegraph # This may take a long time
To visualize the flamegraph and be able to zoom it in or out, open the generated
svgfile in a web-browser.
References
https://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html
https://www.brendangregg.com/perf.html