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

New FlowController [11831] #1996

Merged
merged 70 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2d18696
Refs #11504. Added FlowController interface
richiware May 10, 2021
f06c78c
Refs #11676. Fix compilation errors
richiware Jun 4, 2021
10f6ade
Refs #11676. Fix compilation errors
richiware Jun 4, 2021
82ca63b
Refs #11676. Fixes for discovery server.
richiware Jun 9, 2021
bfb4751
Refs #11676. Little change
richiware Jun 9, 2021
b77992d
Refs #11676. Fix error not sending heartbeat when matching a reader
richiware Jun 11, 2021
ca649a2
Refs #11676. Fix error on Windows
richiware Jun 11, 2021
ca2340b
Refs #11676. Send initial heartbeat also when history empty
richiware Jun 15, 2021
0337a1d
Refs #11792. Forget uncomment after testing
richiware Jun 17, 2021
8148174
Refs #11676. Fix unprotected access
richiware Jun 17, 2021
e142819
Refs #11676. Maintain old code
richiware Jun 18, 2021
48c0618
Refs #11676. Fix error in intraprocess
richiware Jun 18, 2021
204bcbe
Refs #11676. Fix error in writer destruction
richiware Jun 21, 2021
865da0a
Refs #11676. Fix error with intraprocess.
richiware Jun 21, 2021
f106bab
Refs #11676. Fix bug removing change from FlowControllerImpl
richiware Jun 23, 2021
81abb20
Fix bug using datasharing and intraprocess.
richiware Jun 23, 2021
01b69b9
Refs #11679. Implemented Round Robin
richiware Jun 28, 2021
bdcbe8a
Refs #11680. Add HIGH_PRIORITY scheduler
richiware Jun 29, 2021
934c275
Refs #11681. Implemented Priority with reservation scheduler.
richiware Jun 30, 2021
dfe93e4
Refs #11831. Apply comment suggestions
richiware Jun 30, 2021
86cc326
Refs #11903. Added more blackbox tests
richiware Jun 30, 2021
672ff22
Refs #11903. Changes in location of code
richiware Jun 30, 2021
953a388
Refs #11903. Move code movements
richiware Jun 30, 2021
ad886bc
Refs #11903. Fix error in test after adding assertion
richiware Jun 30, 2021
cfa6e3e
Refs #11903. Add skeleton for unit tests
richiware Jun 30, 2021
e4eb57f
Refs #11903. Add test for FlowControllerFactory
richiware Jun 30, 2021
d26bd1b
Refs #11903. Fix detected old error in test
richiware Jun 30, 2021
1fc9599
Refs #11903. Add unit tests for publish modes
richiware Jul 1, 2021
9d4ecfd
Refs #11903. Change TEST to TYPED_TEST
richiware Jul 2, 2021
43756f2
Refs #11903. Added schedulers unit tests
richiware Jul 5, 2021
139d337
Refs #11903. Fix compilation error.
richiware Jul 6, 2021
52955d6
Refs #11961. Fix rebase
richiware Jul 9, 2021
ad7c18d
Apply suggestions from code review
richiware Jul 9, 2021
ebf94cf
Refs #11831. Move header to private place
richiware Jul 9, 2021
96f9212
Refs #11831. Apply suggestions
richiware Jul 9, 2021
520c3f4
Apply suggestions from code review
richiware Jul 9, 2021
e24763a
Refs #11831. Apply suggestions
richiware Jul 9, 2021
dae798d
Refs #11831. Apply suggestions.
richiware Jul 12, 2021
25db07c
Refs #11831. Removed sending a gap with individually heartbeat.
richiware Jul 12, 2021
e3ab36a
Refs #11831. Fix compilation error on Windows
richiware Jul 12, 2021
9eee7d2
Refs #11831. Remove unnecessary condition in cmake
richiware Jul 12, 2021
40b3903
Refs #11831. Fix uncrustify
richiware Jul 13, 2021
8312bb4
Apply suggestions from code review
richiware Jul 15, 2021
d6886e2
Refs #11831. Fix warning in gtest
richiware Jul 15, 2021
207a334
Refs #11831. Apply suggestion
richiware Jul 15, 2021
c1d171e
Refs #11831. Apply suggestions
richiware Jul 15, 2021
4074bd2
Refs #11831. Fix error found by reviewer.
richiware Jul 15, 2021
926ca35
Apply suggestions from code review
richiware Jul 16, 2021
5645d39
Refs #11831. Fix compilation error after apply suggestion
richiware Jul 16, 2021
7eaa678
Refs #11831. Apply suggestions on StatelessWriter.
richiware Jul 16, 2021
9ddcec1
Refs #11831. Improve unit tests to avoid segfault
richiware Jul 19, 2021
382a71f
Refs #11831. Improve FlowControllerRoundRobinSchedule
richiware Jul 19, 2021
aec5540
Refs #11831. Avoid not discovery when testing intraprocess performance
richiware Jul 20, 2021
a2422c0
Refs #11831. Apply suggestions
richiware Jul 20, 2021
c52809c
Fix build with statistics enabled.
MiguelCompany Jul 20, 2021
c6cd58c
Refs #11831. Factorize common code on FlowQueue.
MiguelCompany Jul 21, 2021
027c7bd
Refs #11831. Uncrustify
richiware Jul 22, 2021
7b8c67c
Refs #11831. Decrease too much large waitings
richiware Jul 22, 2021
38558a5
Refs #11831. Fix exception on mac setting a socket option
richiware Jul 22, 2021
b89d025
Refs #11831. Fix inheritance on FlowControllerSyncPublishMode.
MiguelCompany Jul 22, 2021
59564e6
Refs #11831. Improvements on FlowControllerRoundRobinSchedule.
MiguelCompany Jul 22, 2021
d0471a5
Refs #11831. Fallback setting of priority.
MiguelCompany Jul 22, 2021
28d082a
Refs #11831. Improvements on FlowControllerHighPrioritySchedule.
MiguelCompany Jul 22, 2021
5ba3f06
Refs #11831. Improvements on FlowControllerPriorityWithReservationSch…
MiguelCompany Jul 22, 2021
8df58e0
Refs #11831. Apply suggestion
richiware Jul 22, 2021
d9f9ac8
Refs #11831. Fix random fail of a test
richiware Jul 22, 2021
8e46377
Apply suggestions from code review
richiware Jul 23, 2021
070d731
Refs #11831. Apply suggestions
richiware Jul 23, 2021
1ca9eb4
Update src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp
richiware Jul 23, 2021
7d385db
Refs #11831. Remove assert
richiware Jul 23, 2021
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
7 changes: 5 additions & 2 deletions cmake/common/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ macro(add_gtest)
endif()

foreach(GTEST_SOURCE_FILE ${GTEST_SOURCES})
file(STRINGS ${GTEST_SOURCE_FILE} GTEST_TEST_NAMES REGEX ^TEST)
# Normal tests
file(STRINGS ${GTEST_SOURCE_FILE} GTEST_TEST_NAMES REGEX "^([T][Y][P][E][D][_])?TEST")
foreach(GTEST_TEST_NAME ${GTEST_TEST_NAMES})
string(REGEX REPLACE ["\) \(,"] ";" GTEST_TEST_NAME ${GTEST_TEST_NAME})
list(GET GTEST_TEST_NAME 1 GTEST_GROUP_NAME)
list(GET GTEST_TEST_NAME 3 GTEST_TEST_NAME)
add_test(NAME ${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}
COMMAND ${command} --gtest_filter=${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}:*/${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}/*)
COMMAND ${command}
--gtest_filter=${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}:*/${GTEST_GROUP_NAME}.${GTEST_TEST_NAME}/*:${GTEST_GROUP_NAME}/*.${GTEST_TEST_NAME})

# Add environment
set(GTEST_ENVIRONMENT "")
Expand All @@ -84,6 +86,7 @@ macro(add_gtest)
set_property(TEST ${GTEST_GROUP_NAME}.${GTEST_TEST_NAME} PROPERTY LABELS "${GTEST_LABELS}")

endforeach()

endforeach()
else()
add_test(NAME ${test} COMMAND ${command})
Expand Down
9 changes: 5 additions & 4 deletions examples/C++/RTPSTest_as_socket/TestWriterSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,17 @@ void TestWriterSocket::run(
{
for (int i = 0; i < nmsgs; ++i )
{
CacheChange_t* ch = mp_writer->new_change([]() -> uint32_t {
return 255;
}, ALIVE);
CacheChange_t* ch = mp_writer->new_change([]() -> uint32_t
{
return 255;
}, ALIVE);
#if defined(_WIN32)
ch->serializedPayload.length =
sprintf_s((char*)ch->serializedPayload.data, 255, "My example string %d", i) + 1;
#else
ch->serializedPayload.length =
sprintf((char*)ch->serializedPayload.data, "My example string %d", i) + 1;
#endif
#endif // if defined(_WIN32)
printf("Sending: %s\n", (char*)ch->serializedPayload.data);
mp_history->add_change(ch);
}
Expand Down
11 changes: 9 additions & 2 deletions include/fastdds/rtps/attributes/RTPSParticipantAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <fastrtps/utils/fixed_size_string.hpp>
#include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp>
#include <fastdds/rtps/attributes/ServerAttributes.h>
#include <fastdds/rtps/flowcontrol/FlowControllerDescriptor.hpp>

#include <memory>
#include <sstream>
Expand Down Expand Up @@ -438,6 +439,8 @@ class BuiltinAttributes
*/
class RTPSParticipantAttributes
{
using FlowControllerDescriptorList = std::vector<std::shared_ptr<fastdds::rtps::FlowControllerDescriptor>>;

public:

RTPSParticipantAttributes()
Expand Down Expand Up @@ -467,8 +470,9 @@ class RTPSParticipantAttributes
(this->participantID == b.participantID) &&
(this->throughputController == b.throughputController) &&
(this->useBuiltinTransports == b.useBuiltinTransports) &&
(this->properties == b.properties &&
(this->prefix == b.prefix));
(this->properties == b.properties) &&
(this->prefix == b.prefix) &&
(this->flow_controllers == b.flow_controllers);
}

/**
Expand Down Expand Up @@ -542,6 +546,9 @@ class RTPSParticipantAttributes
return name.c_str();
}

//! Flow controllers.
FlowControllerDescriptorList flow_controllers;

private:

//!Name of the participant.
Expand Down
4 changes: 4 additions & 0 deletions include/fastdds/rtps/attributes/WriterAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <fastdds/rtps/common/Guid.h>
#include <fastdds/rtps/flowcontrol/ThroughputControllerDescriptor.h>
#include <fastdds/rtps/attributes/EndpointAttributes.h>
#include <fastdds/rtps/flowcontrol/FlowControllerConsts.hpp>
#include <fastrtps/utils/collections/ResourceLimitedContainerConfig.hpp>
#include <fastrtps/qos/QosPolicies.h>

Expand Down Expand Up @@ -138,6 +139,9 @@ class WriterAttributes

//! Keep duration to keep a sample before considering it has been acked
Duration_t keep_duration;

//! Flow controller name. Default: fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT.
const char* flow_controller_name = fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT;
};

} /* namespace rtps */
Expand Down
34 changes: 28 additions & 6 deletions include/fastdds/rtps/common/CacheChange.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@ namespace eprosima {
namespace fastrtps {
namespace rtps {

/*!
* Specific information for a writer.
*/
struct CacheChangeWriterInfo_t
{
//!Number of DATA / DATA_FRAG submessages sent to the transport (only used in Writers)
size_t num_sent_submessages = 0;
//! Used to link with previous node in a list. Used by FlowControllerImpl.
//! Cannot be cached because there are several comparisons without locking.
CacheChange_t* volatile previous = nullptr;
//! Used to link with next node in a list. Used by FlowControllerImpl.
//! Cannot be cached because there are several comparisons without locking.
CacheChange_t* volatile next = nullptr;
};

/*!
* Specific information for a reader.
*/
struct CacheChangeReaderInfo_t
{
//!Reception TimeStamp (only used in Readers)
Time_t receptionTimestamp;
};

/**
* Structure CacheChange_t, contains information on a specific CacheChange.
* @ingroup COMMON_MODULE
Expand All @@ -57,10 +81,8 @@ struct RTPS_DllAPI CacheChange_t
Time_t sourceTimestamp{};
union
{
//!Reception TimeStamp (only used in Readers)
Time_t receptionTimestamp;
//!Number of DATA / DATA_FRAG submessages sent to the transport (only used in Writers)
size_t num_sent_submessages = 0;
CacheChangeReaderInfo_t reader_info;
CacheChangeWriterInfo_t writer_info;
};

WriteParams write_params{};
Expand Down Expand Up @@ -105,7 +127,7 @@ struct RTPS_DllAPI CacheChange_t
instanceHandle = ch_ptr->instanceHandle;
sequenceNumber = ch_ptr->sequenceNumber;
sourceTimestamp = ch_ptr->sourceTimestamp;
receptionTimestamp = ch_ptr->receptionTimestamp;
reader_info.receptionTimestamp = ch_ptr->reader_info.receptionTimestamp;
write_params = ch_ptr->write_params;
isRead = ch_ptr->isRead;
fragment_size_ = ch_ptr->fragment_size_;
Expand All @@ -128,7 +150,7 @@ struct RTPS_DllAPI CacheChange_t
instanceHandle = ch_ptr->instanceHandle;
sequenceNumber = ch_ptr->sequenceNumber;
sourceTimestamp = ch_ptr->sourceTimestamp;
receptionTimestamp = ch_ptr->receptionTimestamp;
reader_info.receptionTimestamp = ch_ptr->reader_info.receptionTimestamp;
write_params = ch_ptr->write_params;
isRead = ch_ptr->isRead;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ enum class FlowControllerSchedulerPolicy : int32_t
{
//! FIFO scheduler policy: first written sample by user, first sample scheduled to be sent to network.
FIFO,
//! Round Robind scheduler policy: schedules one sample of each DataWriter in circular order.
ROUND_ROBLIN,
//! Round Robin scheduler policy: schedules one sample of each DataWriter in circular order.
ROUND_ROBIN,
//! High priority scheduler policy: samples with highest priority are scheduled first to be sent to network.
HIGH_PRIORITY,
//! Priority with reservation scheduler policy: guarantee each DataWriter's minimum reservation of throughput.
Expand Down
8 changes: 8 additions & 0 deletions include/fastdds/rtps/history/WriterHistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class WriterHistory : public rtps::History
{
friend class RTPSWriter;
friend class PersistentWriter;
friend class IPersistenceService;

WriterHistory(
WriterHistory&&) = delete;
Expand Down Expand Up @@ -133,6 +134,13 @@ class WriterHistory : public rtps::History
SequenceNumber_t m_lastCacheChangeSeqNum;
//!Pointer to the associated RTPSWriter;
RTPSWriter* mp_writer;

uint32_t high_mark_for_frag_ = 0;

private:

void set_fragments(
CacheChange_t* change);
};

} // namespace rtps
Expand Down
Loading