1.3. Clearing dataΒΆ
eProsima Fast DDS Statistics Backend monitors both the entities discovered in a certain DDS domain or Fast DDS
Discovery Server network, and the statistic data related to these entities.
StatisticsBackend
provides several methods to clear the data contained in the internal database:
clear_statistics_data()
commands the deletion of old statistics data contained within the database. The timestamp refers to the time from where to keep data. Usethe_end_of_time()
to remove all data efficiently (used by default).clear_inactive_entities()
deletes from the database those entities that are no longer alive and communicating (see Check whether an entity is active for more information).
// Init a monitor in DDS domain 0 with no listener associated
EntityId domain_monitor_id = StatisticsBackend::init_monitor(0);
// Clear statistics data previous to time given (in this case it removes everything older than 5 minutes)
StatisticsBackend::clear_statistics_data(
std::chrono::system_clock::now() - std::chrono::minutes(5));
// Clear all statistics data
StatisticsBackend::clear_statistics_data();
// Clear inactive entities
StatisticsBackend::clear_inactive_entities();
// Stop the monitor
StatisticsBackend::stop_monitor(domain_monitor_id);