Hi all, your friendly neighborhood navigator here,
I wanted to bring to the community’s attention a new tutorial I wrote this afternoon for how to profile applications in ROS 2 with
valgrind. This subject has come up a few times in the Nav2 working group while trying to analyze run-time performance and identify locations for improvements.
This tutorial focuses on the ROS-y aspects of profiling including how to profile from a launch file,
ros2 run commandline, and with servers with plugins that you’d like to also profile. It ends briefly with using the profiler results in
kcachegrind to see the Call Graph and analyze where in your server the time is being mostly spent.
This is certainly not an exhaustive tutorial about all the things you can do with profilers and analysis you can derive from the results, but its a good starting point for new developers that haven’t used this technology before or are just looking to bridge their existing skills into ROS 2-based projects.
This compliments the Backtrace Tutorial I made 2 years ago (wow, I feel old now ) for our to get backtraces with ROS 2.