Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly enable/disable datasharing on Throughtput test [11646] #1987

Merged
merged 6 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/performance/latency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ if(PYTHONINTERP_FOUND)
--xml_file ${CMAKE_CURRENT_SOURCE_DIR}/xml/${latency_test_name}.xml
--demands_file ${CMAKE_CURRENT_SOURCE_DIR}/payloads_demands.csv
${interproces_flag}
--data_sharing
--data_sharing=on
${reliability_flag}
)

Expand Down Expand Up @@ -267,7 +267,7 @@ if(PYTHONINTERP_FOUND)
--demands_file ${CMAKE_CURRENT_SOURCE_DIR}/payloads_demands.csv
${interproces_flag}
--data_loans
--data_sharing
--data_sharing=on
${reliability_flag}
)

Expand Down
38 changes: 32 additions & 6 deletions test/performance/latency/LatencyTestPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <fastdds/dds/publisher/DataWriterListener.hpp>
#include <fastdds/dds/subscriber/DataReader.hpp>
#include <fastrtps/xmlparser/XMLProfileManager.h>
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>
#include <fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h>


#define TIME_LIMIT_US 10000
Expand Down Expand Up @@ -96,8 +98,9 @@ bool LatencyTestPublisher::init(
const PropertyPolicy& property_policy,
const std::string& xml_config_file,
bool dynamic_data,
bool data_sharing,
Arg::EnablerValue data_sharing,
bool data_loans,
Arg::EnablerValue shared_memory,
int forced_domain,
LatencyDataSizes& latency_data_sizes)
{
Expand All @@ -111,6 +114,7 @@ bool LatencyTestPublisher::init(
dynamic_types_ = dynamic_data;
data_sharing_ = data_sharing;
data_loans_ = data_loans;
shared_memory_ = shared_memory;
forced_domain_ = forced_domain;
raw_data_file_ = raw_data_file;
pid_ = pid;
Expand Down Expand Up @@ -185,6 +189,25 @@ bool LatencyTestPublisher::init(
pqos.properties(part_property_policy);
}

// Set shared memory transport if it was enable/disable explicitly.
if (Arg::EnablerValue::ON == shared_memory_)
{
std::shared_ptr<eprosima::fastdds::rtps::SharedMemTransportDescriptor> shm_transport =
std::make_shared<eprosima::fastdds::rtps::SharedMemTransportDescriptor>();
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_transport =
std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
pqos.transport().user_transports.push_back(shm_transport);
pqos.transport().user_transports.push_back(udp_transport);
pqos.transport().use_builtin_transports = false;
}
else if (Arg::EnablerValue::OFF == shared_memory_)
{
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_transport =
std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
pqos.transport().user_transports.push_back(udp_transport);
pqos.transport().use_builtin_transports = false;
}

// Create the participant
participant_ =
DomainParticipantFactory::get_instance()->create_participant(domainId, pqos);
Expand Down Expand Up @@ -265,17 +288,20 @@ bool LatencyTestPublisher::init(
}

// Set data sharing according with cli.
DataSharingQosPolicy dsp;
if (data_sharing_)
if (Arg::EnablerValue::ON == data_sharing_)
{
DataSharingQosPolicy dsp;
dsp.on("");
dw_qos_.data_sharing(dsp);
dr_qos_.data_sharing(dsp);
}
else
else if (Arg::EnablerValue::OFF == data_sharing_)
{
DataSharingQosPolicy dsp;
dsp.off();
dw_qos_.data_sharing(dsp);
dr_qos_.data_sharing(dsp);
}
dw_qos_.data_sharing(dsp);
dr_qos_.data_sharing(dsp);

// Increase payload pool size to prevent loan failures due to outages
if (data_loans_)
Expand Down
8 changes: 6 additions & 2 deletions test/performance/latency/LatencyTestPublisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include <fastrtps/types/TypeDescriptor.h>
#include "LatencyTestTypes.hpp"

#include "../optionarg.hpp"

class TimeStats
{
public:
Expand Down Expand Up @@ -97,8 +99,9 @@ class LatencyTestPublisher
const eprosima::fastrtps::rtps::PropertyPolicy& property_policy,
const std::string& xml_config_file,
bool dynamic_data,
bool data_sharing,
Arg::EnablerValue data_sharing,
bool data_loans,
Arg::EnablerValue shared_memory,
int forced_domain,
LatencyDataSizes& latency_data_sizes);

Expand Down Expand Up @@ -199,8 +202,9 @@ class LatencyTestPublisher
bool export_csv_ = false;
bool reliable_ = false;
bool dynamic_types_ = false;
bool data_sharing_ = false;
Arg::EnablerValue data_sharing_ = Arg::EnablerValue::NO_SET;
bool data_loans_ = false;
Arg::EnablerValue shared_memory_ = Arg::EnablerValue::NO_SET;
int forced_domain_ = -1;
int subscribers_ = 0;
unsigned int samples_ = 0;
Expand Down
38 changes: 32 additions & 6 deletions test/performance/latency/LatencyTestSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <fastdds/dds/subscriber/DataReader.hpp>
#include <fastrtps/xmlparser/XMLProfileManager.h>
#include <fastdds/rtps/common/Time_t.h>
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>
#include <fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h>

using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastrtps::types;
Expand Down Expand Up @@ -85,8 +87,9 @@ bool LatencyTestSubscriber::init(
const PropertyPolicy& property_policy,
const std::string& xml_config_file,
bool dynamic_data,
bool data_sharing,
Arg::EnablerValue data_sharing,
bool data_loans,
Arg::EnablerValue shared_memory,
int forced_domain,
LatencyDataSizes& latency_data_sizes)
{
Expand All @@ -97,6 +100,7 @@ bool LatencyTestSubscriber::init(
dynamic_types_ = dynamic_data;
data_sharing_ = data_sharing;
data_loans_ = data_loans;
shared_memory_ = shared_memory;
forced_domain_ = forced_domain;
pid_ = pid;
hostname_ = hostname;
Expand Down Expand Up @@ -139,6 +143,25 @@ bool LatencyTestSubscriber::init(
pqos.properties(part_property_policy);
}

// Set shared memory transport if it was enable/disable explicitly.
if (Arg::EnablerValue::ON == shared_memory_)
{
std::shared_ptr<eprosima::fastdds::rtps::SharedMemTransportDescriptor> shm_transport =
std::make_shared<eprosima::fastdds::rtps::SharedMemTransportDescriptor>();
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_transport =
std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
pqos.transport().user_transports.push_back(shm_transport);
pqos.transport().user_transports.push_back(udp_transport);
pqos.transport().use_builtin_transports = false;
}
else if (Arg::EnablerValue::OFF == shared_memory_)
{
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_transport =
std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
pqos.transport().user_transports.push_back(udp_transport);
pqos.transport().use_builtin_transports = false;
}

// Create the participant
participant_ = DomainParticipantFactory::get_instance()->create_participant(domainId, pqos);
if (participant_ == nullptr)
Expand Down Expand Up @@ -217,17 +240,20 @@ bool LatencyTestSubscriber::init(
}

// Set data sharing according with cli.
DataSharingQosPolicy dsp;
if (data_sharing_)
if (Arg::EnablerValue::ON == data_sharing_)
{
DataSharingQosPolicy dsp;
dsp.on("");
dw_qos_.data_sharing(dsp);
dr_qos_.data_sharing(dsp);
}
else
else if (Arg::EnablerValue::OFF == data_sharing_)
{
DataSharingQosPolicy dsp;
dsp.off();
dw_qos_.data_sharing(dsp);
dr_qos_.data_sharing(dsp);
}
dw_qos_.data_sharing(dsp);
dr_qos_.data_sharing(dsp);

// Increase payload pool size to prevent loan failures due to outages
if (data_loans_)
Expand Down
8 changes: 6 additions & 2 deletions test/performance/latency/LatencyTestSubscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include <fastrtps/types/TypeDescriptor.h>
#include "LatencyTestTypes.hpp"

#include "../optionarg.hpp"

class LatencyTestSubscriber
{
public:
Expand All @@ -58,8 +60,9 @@ class LatencyTestSubscriber
const eprosima::fastrtps::rtps::PropertyPolicy& property_policy,
const std::string& xml_config_file,
bool dynamic_data,
bool data_sharing,
Arg::EnablerValue data_sharing,
bool data_loans,
Arg::EnablerValue shared_memory,
int forced_domain,
LatencyDataSizes& latency_data_sizes);

Expand Down Expand Up @@ -128,8 +131,9 @@ class LatencyTestSubscriber
bool echo_ = true;
int samples_ = 0;
bool dynamic_types_ = false;
bool data_sharing_ = false;
Arg::EnablerValue data_sharing_ = Arg::EnablerValue::NO_SET;
bool data_loans_ = false;
Arg::EnablerValue shared_memory_ = Arg::EnablerValue::NO_SET;
int forced_domain_ = -1;
bool hostname_ = false;
uint32_t pid_ = 0;
Expand Down
33 changes: 24 additions & 9 deletions test/performance/latency/latency_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,35 @@
'--interprocess',
action='store_true',
help='Publisher and subscribers in separate processes. Defaults:False',
required=False,
required=False
)
parser.add_argument(
'-d',
'--data_sharing',
action='store_true',
help='Enable data sharing (Defaults: disable)',
required=False,
choices=['on', 'off'],
help='Explicitly enable/disable data sharing. (Defaults: Fast-DDS default settings)',
required=False
)
parser.add_argument(
'-l',
'--data_loans',
action='store_true',
help='Enable the use of the loan sample API (Defaults: disable)',
required=False,
required=False
)
parser.add_argument(
'-r',
'--reliability',
action='store_true',
help='Run with RELIABLE reliability (Defaults: disable)',
required=False,
required=False
)
parser.add_argument(
'--shared_memory',
choices=['on', 'off'],
help='Explicitly enable/disable shared memory transport. (Defaults: Fast-DDS default settings)',
required=False
)

# Parse arguments
args = parser.parse_args()
Expand Down Expand Up @@ -125,9 +131,9 @@

# Data sharing and loans options
# modify output file names
if args.data_sharing and args.data_loans:
if args.data_sharing and 'on' == args.data_sharing and args.data_loans:
filename_options += '_data_loans_and_sharing'
elif args.data_sharing:
elif args.data_sharing and 'on' == args.data_sharing:
filename_options += '_data_sharing'
elif args.data_loans:
filename_options += '_data_loans'
Expand All @@ -136,7 +142,10 @@
data_options = []

if args.data_sharing:
data_options += ['--data_sharing']
if 'on' == args.data_sharing:
data_options += ['--data_sharing=on']
else:
data_options += ['--data_sharing=off']

if args.data_loans:
data_options += ['--data_loans']
Expand All @@ -147,6 +156,12 @@
else:
reliability_options = ['--reliability=besteffort']

if args.shared_memory:
if 'on' == args.shared_memory:
data_options += ['--shared_memory=on']
else:
data_options += ['--shared_memory=off']

# Environment variables
executable = os.environ.get('LATENCY_TEST_BIN')
certs_path = os.environ.get('CERTS_PATH')
Expand Down
Loading