Skip to content

Commit

Permalink
Add ThreadSettings to Qos (#3848)
Browse files Browse the repository at this point in the history
* Refs #19377: Add ThreadSettings struct

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to Log API

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to DomainParticipantFactoryQos

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to DomainParticipantQos

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to TransportConfigQos

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to TransportDescriptorInterface

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to SharedMemTransportDescriptor

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to FlowControllerDescriptor

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to DataReaderQos

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Add ThreadSetting to DomainParticipantQos for builtin flow controllers

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19377: Address Miguel's comments in DomainParticipant

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Address Miguel's comments in DataReader

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Address Miguel's comments in ParticipantTests

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Address Miguel's comments in QosConverters

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Address Miguel's comments in Transport descriptors

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Address Miguel's comments in DataReaderTests

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Address Miguel's comments in RTPSParticipantAttibutes

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Address Miguel's comments in PortBasedTransportDescriptor

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Add builtin_controllers_sender_thread to UpdatableDomainParticipantQos

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Refactor PortBasedTransportDescriptor accessors

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Add TCP related thread settings

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Add data_sharing_listener_thread to ReaderAttributes

Signed-off-by: EduPonz <[email protected]>

* Refs #19377: Fix windows warning

Signed-off-by: EduPonz <[email protected]>

---------

Signed-off-by: Eduardo Ponz <[email protected]>
Signed-off-by: EduPonz <[email protected]>
  • Loading branch information
EduPonz committed Nov 20, 2023
1 parent 50c0787 commit 2e317a3
Show file tree
Hide file tree
Showing 45 changed files with 1,837 additions and 310 deletions.
11 changes: 7 additions & 4 deletions include/fastdds/dds/core/policy/QosPolicies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@
#include <vector>

#include <fastdds/dds/core/policy/ParameterTypes.hpp>

#include <fastdds/rtps/attributes/ExternalLocators.hpp>
#include <fastdds/rtps/attributes/PropertyPolicy.h>
#include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp>
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
#include <fastdds/rtps/common/LocatorList.hpp>
#include <fastdds/rtps/common/Types.h>
#include <fastdds/rtps/common/Time_t.h>
#include <fastdds/rtps/resources/ResourceManagement.h>
#include <fastdds/rtps/common/Types.h>
#include <fastdds/rtps/flowcontrol/FlowControllerConsts.hpp>

#include <fastdds/rtps/resources/ResourceManagement.h>
#include <fastrtps/types/TypeObject.h>
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>

Expand Down Expand Up @@ -2763,6 +2762,7 @@ class TransportConfigQos : public QosPolicy
(this->use_builtin_transports == b.use_builtin_transports) &&
(this->send_socket_buffer_size == b.send_socket_buffer_size) &&
(this->listen_socket_buffer_size == b.listen_socket_buffer_size) &&
(this->builtin_transports_reception_threads_ == b.builtin_transports_reception_threads_) &&
QosPolicy::operator ==(b);
}

Expand All @@ -2788,6 +2788,9 @@ class TransportConfigQos : public QosPolicy
* By default, 0.
*/
uint32_t listen_socket_buffer_size;

//! Thread settings for the builtin transports reception threads
rtps::ThreadSettings builtin_transports_reception_threads_;
};

//! Qos Policy to configure the endpoint
Expand Down
76 changes: 74 additions & 2 deletions include/fastdds/dds/domain/qos/DomainParticipantFactoryQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#ifndef _FASTDDS_PARTICIPANTFACTORYQOS_HPP_
#define _FASTDDS_PARTICIPANTFACTORYQOS_HPP_

#include <fastrtps/fastrtps_dll.h>
#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
#include <fastrtps/fastrtps_dll.h>

namespace eprosima {
namespace fastdds {
Expand Down Expand Up @@ -53,7 +54,9 @@ class DomainParticipantFactoryQos
bool operator ==(
const DomainParticipantFactoryQos& b) const
{
return (this->entity_factory_ == b.entity_factory());
return (this->shm_watchdog_thread_ == b.shm_watchdog_thread()) &&
(this->file_watch_threads_ == b.file_watch_threads()) &&
(this->entity_factory_ == b.entity_factory());
}

/**
Expand Down Expand Up @@ -84,10 +87,79 @@ class DomainParticipantFactoryQos
entity_factory_ = entity_factory;
}

/**
* Getter for SHM watchdog ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& shm_watchdog_thread()
{
return shm_watchdog_thread_;
}

/**
* Getter for SHM watchdog ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& shm_watchdog_thread() const
{
return shm_watchdog_thread_;
}

/**
* Setter for the SHM watchdog ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void shm_watchdog_thread(
const rtps::ThreadSettings& value)
{
shm_watchdog_thread_ = value;
}

/**
* Getter for file watch related ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& file_watch_threads()
{
return file_watch_threads_;
}

/**
* Getter for file watch related ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& file_watch_threads() const
{
return file_watch_threads_;
}

/**
* Setter for the file watch related ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void file_watch_threads(
const rtps::ThreadSettings& value)
{
file_watch_threads_ = value;
}

private:

//!EntityFactoryQosPolicy, implemented in the library.
EntityFactoryQosPolicy entity_factory_;

//! Thread settings for the SHM watchdog thread
rtps::ThreadSettings shm_watchdog_thread_;

//! Thread settings for the file watch related threads
rtps::ThreadSettings file_watch_threads_;

};

} /* namespace dds */
Expand Down
150 changes: 149 additions & 1 deletion include/fastdds/dds/domain/qos/DomainParticipantQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

#include <string>

#include <fastrtps/fastrtps_dll.h>
#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
#include <fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp>
#include <fastrtps/fastrtps_dll.h>

namespace eprosima {
namespace fastdds {
Expand Down Expand Up @@ -81,6 +82,12 @@ class DomainParticipantQos
(this->wire_protocol_ == b.wire_protocol()) &&
(this->transport_ == b.transport()) &&
(this->name_ == b.name()) &&
(this->builtin_controllers_sender_thread_ == b.builtin_controllers_sender_thread()) &&
(this->timed_events_thread_ == b.timed_events_thread()) &&
(this->discovery_server_thread_ == b.discovery_server_thread()) &&
#if HAVE_SECURITY
(this->security_log_thread_ == b.security_log_thread()) &&
#endif // if HAVE_SECURITY
(this->flow_controllers_ == b.flow_controllers());
}

Expand Down Expand Up @@ -321,6 +328,133 @@ class DomainParticipantQos
return flow_controllers_;
}

/**
* Getter for builtin flow controllers sender threads ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& builtin_controllers_sender_thread()
{
return builtin_controllers_sender_thread_;
}

/**
* Getter for builtin flow controllers sender threads ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& builtin_controllers_sender_thread() const
{
return builtin_controllers_sender_thread_;
}

/**
* Setter for the builtin flow controllers sender threads ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void builtin_controllers_sender_thread(
const rtps::ThreadSettings& value)
{
builtin_controllers_sender_thread_ = value;
}

/**
* Getter for timed event ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& timed_events_thread()
{
return timed_events_thread_;
}

/**
* Getter for timed event ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& timed_events_thread() const
{
return timed_events_thread_;
}

/**
* Setter for the timed event ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void timed_events_thread(
const rtps::ThreadSettings& value)
{
timed_events_thread_ = value;
}

/**
* Getter for discovery server ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& discovery_server_thread()
{
return discovery_server_thread_;
}

/**
* Getter for discovery server ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& discovery_server_thread() const
{
return discovery_server_thread_;
}

/**
* Setter for the discovery server ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void discovery_server_thread(
const rtps::ThreadSettings& value)
{
discovery_server_thread_ = value;
}

#if HAVE_SECURITY
/**
* Getter for security log ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& security_log_thread()
{
return security_log_thread_;
}

/**
* Getter for security log ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& security_log_thread() const
{
return security_log_thread_;
}

/**
* Setter for the security log ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void security_log_thread(
const rtps::ThreadSettings& value)
{
security_log_thread_ = value;
}

#endif // if HAVE_SECURITY

private:

//!UserData Qos, implemented in the library.
Expand Down Expand Up @@ -350,6 +484,20 @@ class DomainParticipantQos
*/
FlowControllerDescriptorList flow_controllers_;

//! Thread settings for the builtin flow controllers sender threads
rtps::ThreadSettings builtin_controllers_sender_thread_;

//! Thread settings for the timed events thread
rtps::ThreadSettings timed_events_thread_;

//! Thread settings for the discovery server thread
rtps::ThreadSettings discovery_server_thread_;

#if HAVE_SECURITY
//! Thread settings for the security log thread
rtps::ThreadSettings security_log_thread_;
#endif // if HAVE_SECURITY

};

RTPS_DllAPI extern const DomainParticipantQos PARTICIPANT_QOS_DEFAULT;
Expand Down
12 changes: 9 additions & 3 deletions include/fastdds/dds/log/Log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
#ifndef _FASTDDS_DDS_LOG_LOG_HPP_
#define _FASTDDS_DDS_LOG_LOG_HPP_

#include <fastrtps/fastrtps_dll.h>
#include <thread>
#include <sstream>
#include <atomic>
#include <regex>
#include <sstream>
#include <thread>

#include <fastdds/rtps/attributes/ThreadSettings.hpp>
#include <fastrtps/fastrtps_dll.h>

/**
* eProsima log layer. Logging categories and verbosity can be specified dynamically at runtime.
Expand Down Expand Up @@ -131,6 +133,10 @@ class Log
RTPS_DllAPI static void SetErrorStringFilter(
const std::regex&);

//! Sets thread configuration for the logging thread.
RTPS_DllAPI static void SetThreadConfig(
const rtps::ThreadSettings&);

//! Returns the logging engine to configuration defaults.
RTPS_DllAPI static void Reset();

Expand Down
Loading

0 comments on commit 2e317a3

Please sign in to comment.