Using Timing and StatisticsΒΆ

To enable for a certain package, compile with

catkin build --no-deps --force-cmake <package_name> -DENABLE_TIMING=1 -DENABLE_STATISTICS=1

To disable it again, run

catkin build --no-deps --force-cmake <package_name> -DENABLE_TIMING=0 -DENABLE_STATISTICS=0

To time part of your code, you can use

#include <aslam/common/timer.h>

timing::Timer my_timer("My Operation");
// Some expensive operation that should be timed.

// Print all values.

For statistics collection, you can do

#include <aslam/common/statistics/statistics.h>

statistics::StatsCollector my_statistics("My Statistics");
// Add a given value to the collection of statistical samples.
// Add the value 1 to the statistics (mostly useful to count certain events and their frequency).

// Printing similar to timing.

You can also use the timing or statistics command in the console to see the data.