Modify the command to start Copter in autotest.py

I want to use callgrind to obtain the method call graph of arduopter. Originally, running the following command could start the copter, and callgrind could monitor the method call graph when the binary file is running.

valgrind --tool=callgrind ./arducopter -S --model + --speedup 1 --defaults …/…/…/Tools/autotest/default_params/copter.parm -IO

Considering autotest.py can cover all the codes. I want to combine callgrind with autotest. However, if you run the autotest.py directly, callgrind cannot monitor the Copter. So I want to add callgrind before the command to start the copter binary file in autotest.py, but I don’t know how to modify the python code.
Can someone guide me,thank you very much!

hello,

We already have an option on autotest.py to run valgrind or callgrind : see ardupilot/autotest.py at master · ArduPilot/ardupilot · GitHub and Autotest Framework — Dev documentation

Say us if more info is needed to make it run !

2 Likes

Thank you very much! It helped me a lot

Sorry to bother you again. I tried to run autotest.py --callgrind test. Copter
[Errno2] No such file or directory: ‘arducopter-±valgrind.log’