Error when profiling ROS2 with perf record

asked 2020-03-12 06:27:24 -0600

Sapodilla gravatar image

Hi everyone,

As stated in the title, I would like to do some profiling with perf tool, especially, using perf recordand generate a Flame Graph afterward (Flame graph link here for who is interested: http://www.brendangregg.com/flamegrap...).

However, I have run into an error while using perf record (I am also new to perf). Firstly, I tried to run following command:

sudo perf record -g ros2 run cpp_pubsub talker

It gave me an error:

Workload failed: No such file or directory

Then, I tried another way by running directly executable file:

sudo perf recodr -g ./build/cpp_pubsub/talker

This time I had another error:

./talker: error while loading shared libraries: librcl_interfaces__rosidl_typesupport_cpp.so: cannot open shared object file: No such file or directory

After spending some times to figure it out and also search on google, I still cannot find the solution. The library file: librcl_interfaces__rosidl_typesupport_cpp.so still can be found in directory /opt/ros/eloquent/lib. The talker runs fine without perf record.

Any help, suggestion or hint is welcomed :).

Cheers!

edit retag flag offensive close merge delete

Comments

sudo will "sanatise" your environment, leading to things like LD_LIBRARY_PATH being reset. ROS (both 1 and 2) nodes need the environment to be correctly configured, or they won't be able to find libraries and other runtime artefacts they need (such as the interfaces typesupport library you see mentioned in the error).

You could try with sudo -E, which carries the environment of the caller over into the sudo session.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-12 06:39:51 -0600 )edit