1.4. Reset Fast DDS Statistics Backend¶

If the user needs to restart Fast DDS Statistics Backend returning to the initial conditions, reset() is provided. Calling this method clears all the data collected since the first monitor was initialized, erases all monitors (not being available for restarting afterwards), and removes the physical listener (see Set listeners for more information). In order to call reset(), all monitors have to be stopped (inactive). Otherwise it throws PreconditionNotMet.

// Init a monitor in DDS domain 0 with no listener associated
EntityId domain_monitor_id = StatisticsBackend::init_monitor(0);
// Stop the monitor
StatisticsBackend::stop_monitor(domain_monitor_id);
// Reset Fast DDS Statistics Backend
StatisticsBackend::reset();