0
$\begingroup$

Rosanswers logo

Hi all,

I am running 12 ROS nodes (ROS kinetic) and starting the system with a roslaunch file. I would like to profile one of the nodes, while the whol system is running. From my search it seems that I can use valgrind.

I set the roslaunch file as below (as shown here):

<launch>
<param name="use_sim_time" value="true"/>
<arg name="seedval"/>
<param name="seed" value="$(arg seedval)"/>

<group ns="robot1">
<node pkg="pkg_name" name="agent" type="agent.py" launch-prefix="valgrind --tool=callgrind --separate-threads=yes --callgrind-out-file='callgrind.sim1.%p'">
<param name="myID" value="1"/>
......
</node>
</group>

.....
</launch>

I build the package in debug mode like so:

catkin_make -DCMAKE_BUILD_TYPE=Debug

Now from what I have read, valgrind will dump the data when the program terminates. And the issue might lie here, because the nodes exit with sys.exit(), raising a SystemExit exception. I have tried adding the --dump-before=function option, but to no avail:

launch-prefix="valgrind --tool=callgrind --dump-before=name_of_function_as_in_script --separate-threads=yes --callgrind-out-file='callgrind.sim1.%p'"

Any ideas, I am not quite sure how to proceed.

Thanks!

hW


Originally posted by highWaters on ROS Answers with karma: 176 on 2020-03-26

Post score: 0


Original comments

Comment by Delb on 2020-03-27:
Do you mean you don't have the file ~/.ros/callgrind.sim1.PID_NUMBER ?

Also I'm not sure that vallgrind can be used with python as it's said in the introduction of the tutorial :

This tutorial explains how to use profiling tools for roscpp nodes that you are launching with roslaunch.

Comment by highWaters on 2020-03-27:
Hi, I get the file, but it is empty. From here it seems I might have to do compile python itself in debug mode, such that it is valgrind friendly.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Ok, I had an epiphany and did the following: launch-prefix="pprofile --format callgrind --out out". I will marked this as solved.


Originally posted by highWaters with karma: 176 on 2020-03-27

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.