From 7219e6b34ebc21256dacb20c150a6e5af9d10f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ferreira=20Gonz=C3=A1lez?= Date: Thu, 11 Sep 2025 08:50:13 +0200 Subject: [PATCH] Improve latency tests (#5998) * Refs #23482: Remove Log filter Signed-off-by: cferreiragonz * Refs #23482: Fix destruction of latency tests Signed-off-by: cferreiragonz * Refs #23482: Make reliable tests keep_all with allocated resources Signed-off-by: cferreiragonz Use keep_all history Signed-off-by: cferreiragonz Alloc resources Signed-off-by: cferreiragonz * Refs #23482: Apply changes to udp too Signed-off-by: cferreiragonz --------- Signed-off-by: cferreiragonz (cherry picked from commit b39ed87809960539537e1aef105c6cb42475947d) --- .../latency/LatencyTestPublisher.cpp | 30 ++------------ .../latency/LatencyTestSubscriber.cpp | 30 ++------------ test/performance/latency/main_LatencyTest.cpp | 6 --- ...ency_interprocess_reliable_shm_profile.xml | 40 +++++++++++++++++++ ...ency_interprocess_reliable_udp_profile.xml | 40 +++++++++++++++++++ .../latency_intraprocess_reliable_profile.xml | 24 +++++++++++ 6 files changed, 112 insertions(+), 58 deletions(-) diff --git a/test/performance/latency/LatencyTestPublisher.cpp b/test/performance/latency/LatencyTestPublisher.cpp index 7d0d3df48c3..b108a879253 100644 --- a/test/performance/latency/LatencyTestPublisher.cpp +++ b/test/performance/latency/LatencyTestPublisher.cpp @@ -57,11 +57,6 @@ LatencyTestPublisher::LatencyTestPublisher() LatencyTestPublisher::~LatencyTestPublisher() { - std::string TestCommandType("TestCommandType"); - participant_->unregister_type(TestCommandType); - - DomainParticipantFactory::get_instance()->delete_participant(participant_); - EPROSIMA_LOG_INFO(LatencyTest, "Pub: Participant removed"); } @@ -661,28 +656,11 @@ void LatencyTestPublisher::run() void LatencyTestPublisher::destroy_user_entities() { - // Static type endpoints should have been removed for each payload iteration - if (dynamic_types_) - { - destroy_data_endpoints(); - } - else if (nullptr != data_writer_ - || nullptr != data_reader_ - || nullptr != latency_data_pub_topic_ - || nullptr != latency_data_sub_topic_ - || !latency_data_type_) - { - EPROSIMA_LOG_ERROR(LATENCYPUBLISHER, "ERROR unregistering the DATA type and/or removing the endpoints"); - } - - subscriber_->delete_datareader(command_reader_); - participant_->delete_subscriber(subscriber_); + // Delete DDS entities contained within the DomainParticipant + participant_->delete_contained_entities(); - publisher_->delete_datawriter(command_writer_); - participant_->delete_publisher(publisher_); - - participant_->delete_topic(latency_command_sub_topic_); - participant_->delete_topic(latency_command_pub_topic_); + // Delete DomainParticipant + DomainParticipantFactory::get_instance()->delete_participant(participant_); } void LatencyTestPublisher::export_csv( diff --git a/test/performance/latency/LatencyTestSubscriber.cpp b/test/performance/latency/LatencyTestSubscriber.cpp index 8322444078f..d4eb74bf470 100644 --- a/test/performance/latency/LatencyTestSubscriber.cpp +++ b/test/performance/latency/LatencyTestSubscriber.cpp @@ -51,11 +51,6 @@ LatencyTestSubscriber::LatencyTestSubscriber() LatencyTestSubscriber::~LatencyTestSubscriber() { - std::string TestCommandType("TestCommandType"); - participant_->unregister_type(TestCommandType); - - DomainParticipantFactory::get_instance()->delete_participant(participant_); - EPROSIMA_LOG_INFO(LatencyTest, "Sub: Participant removed"); } @@ -620,28 +615,11 @@ void LatencyTestSubscriber::run() void LatencyTestSubscriber::destroy_user_entities() { - // Static type endpoints should have been remove for each payload iteration - if (dynamic_types_) - { - destroy_data_endpoints(); - } - else if (nullptr != data_writer_ - || nullptr != data_reader_ - || nullptr != latency_data_pub_topic_ - || nullptr != latency_data_sub_topic_ - || !latency_data_type_) - { - EPROSIMA_LOG_ERROR(LATENCYSUBSCRIBER, "ERROR unregistering the DATA type and/or removing the endpoints"); - } - - subscriber_->delete_datareader(command_reader_); - participant_->delete_subscriber(subscriber_); + // Delete DDS entities contained within the DomainParticipant + participant_->delete_contained_entities(); - publisher_->delete_datawriter(command_writer_); - participant_->delete_publisher(publisher_); - - participant_->delete_topic(latency_command_sub_topic_); - participant_->delete_topic(latency_command_pub_topic_); + // Delete DomainParticipant + DomainParticipantFactory::get_instance()->delete_participant(participant_); } bool LatencyTestSubscriber::test( diff --git a/test/performance/latency/main_LatencyTest.cpp b/test/performance/latency/main_LatencyTest.cpp index c87bf782fc2..72eb755c8c1 100644 --- a/test/performance/latency/main_LatencyTest.cpp +++ b/test/performance/latency/main_LatencyTest.cpp @@ -22,7 +22,6 @@ #include #include -#include #include "../optionarg.hpp" #include "LatencyTestPublisher.hpp" @@ -185,11 +184,6 @@ int main( int argc, char** argv) { - - using Log = eprosima::fastdds::dds::Log; - Log::SetVerbosity(Log::Kind::Info); - Log::SetCategoryFilter(std::regex("LatencyTest")); - int columns; #if defined(_WIN32) diff --git a/test/performance/latency/xml/latency_interprocess_reliable_shm_profile.xml b/test/performance/latency/xml/latency_interprocess_reliable_shm_profile.xml index a0be5e11182..ee8a340d4da 100644 --- a/test/performance/latency/xml/latency_interprocess_reliable_shm_profile.xml +++ b/test/performance/latency/xml/latency_interprocess_reliable_shm_profile.xml @@ -19,6 +19,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE @@ -32,6 +42,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE @@ -63,6 +83,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE @@ -76,6 +106,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE diff --git a/test/performance/latency/xml/latency_interprocess_reliable_udp_profile.xml b/test/performance/latency/xml/latency_interprocess_reliable_udp_profile.xml index c81ed2b82ec..96454276e3c 100644 --- a/test/performance/latency/xml/latency_interprocess_reliable_udp_profile.xml +++ b/test/performance/latency/xml/latency_interprocess_reliable_udp_profile.xml @@ -22,6 +22,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE @@ -35,6 +45,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE @@ -60,6 +80,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE @@ -73,6 +103,16 @@ + + + KEEP_ALL + + + 11000 + 11000 + 11000 + + RELIABLE diff --git a/test/performance/latency/xml/latency_intraprocess_reliable_profile.xml b/test/performance/latency/xml/latency_intraprocess_reliable_profile.xml index 322f257c6c4..ec522cd8065 100644 --- a/test/performance/latency/xml/latency_intraprocess_reliable_profile.xml +++ b/test/performance/latency/xml/latency_intraprocess_reliable_profile.xml @@ -23,6 +23,12 @@ + + + KEEP_LAST + 2500 + + RELIABLE @@ -36,6 +42,12 @@ + + + KEEP_LAST + 2500 + + RELIABLE @@ -71,6 +83,12 @@ + + + KEEP_LAST + 2500 + + RELIABLE @@ -84,6 +102,12 @@ + + + KEEP_LAST + 2500 + + RELIABLE