2

Is there a way to measure the CPU usage or the processor loading per simulation time step? I essentially want a way to compare the computational cost of different controller implementations

I reckon I can get an indication of CPU usage on my Mac's Activity Monitor, but was wondering if there's a better and more quantitative way

For context, I am simulating different kinds of controllers for a swarm robot system consisting of ~40 e-puck robots

ssk255
  • 23
  • 3

1 Answers1

1

You can use the --log-performance command line option of Webots. According to the Webots user guide:

  --log-performance=<file>[,<steps>]
    Measure the performance of Webots and log it in the file specified in the
    <file> argument. The optional <steps> argument is an integer value that
    specifies how many steps are logged. If the --sysinfo option is used, the
    system information is prepended into the log file.

If that is not sufficient, I would recommend you to recompile Webots from the source and add your own timers inside the code of Webots.

Disclaimer: I am a Webots developer working at Cyberbotics.

Olivier Michel
  • 642
  • 5
  • 14
  • I can't find the log file saved anywhere, I tried webots --mode=fast --no-rendering --stderr --stdout --minimize --log-performance=perflog e-puck2.wbt &> log.txt & and also with perflog.txt... Could the redirection of terminal output to log.txt be causing any issues? – ssk255 Apr 17 '23 at 19:44
  • Did you try to use an absolute path instead? E.g., webots --log-performance=/Users/username/Documents/perflog.txt? – Olivier Michel Apr 18 '23 at 06:45
  • 1
    That made it work - thanks very much! – ssk255 Apr 19 '23 at 09:40