Skip to content

Commit

Permalink
Refs #3092. Added memory policy conf to builtin entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
richiware committed Jul 20, 2018
1 parent 54f563a commit bf1715d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
10 changes: 9 additions & 1 deletion include/fastrtps/rtps/attributes/RTPSParticipantAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "PropertyPolicy.h"
#include "../flowcontrol/ThroughputControllerDescriptor.h"
#include "../../transport/TransportInterface.h"
#include "../resources/ResourceManagement.h"

#include <memory>

Expand Down Expand Up @@ -162,6 +163,12 @@ class BuiltinAttributes{
//! Initial peers.
LocatorList_t initialPeersList;

//! Memory policy for builtin readers
MemoryManagementPolicy_t readerHistoryMemoryPolicy;

//! Memory policy for builtin writers
MemoryManagementPolicy_t writerHistoryMemoryPolicy;

BuiltinAttributes()
{
use_SIMPLE_RTPSParticipantDiscoveryProtocol = true;
Expand All @@ -172,7 +179,8 @@ class BuiltinAttributes{
leaseDuration.seconds = 500;
leaseDuration_announcementperiod.seconds = 250;
use_WriterLivelinessProtocol = true;

readerHistoryMemoryPolicy = MemoryManagementPolicy_t::PREALLOCATED_MEMORY_MODE;
writerHistoryMemoryPolicy = MemoryManagementPolicy_t::PREALLOCATED_MEMORY_MODE;
};
virtual ~BuiltinAttributes(){};
/**
Expand Down
18 changes: 9 additions & 9 deletions src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,19 @@

#include <fastrtps/rtps/builtin/discovery/endpoint/EDPSimple.h>
#include "EDPSimpleListeners.h"


#include <fastrtps/rtps/builtin/discovery/participant/PDPSimple.h>

#include "../../../participant/RTPSParticipantImpl.h"

#include <fastrtps/rtps/writer/StatefulWriter.h>
#include <fastrtps/rtps/reader/StatefulReader.h>

#include <fastrtps/rtps/attributes/HistoryAttributes.h>
#include <fastrtps/rtps/attributes/WriterAttributes.h>
#include <fastrtps/rtps/attributes/ReaderAttributes.h>


#include <fastrtps/rtps/history/ReaderHistory.h>
#include <fastrtps/rtps/history/WriterHistory.h>


#include <fastrtps/rtps/builtin/data/WriterProxyData.h>
#include <fastrtps/rtps/builtin/data/ReaderProxyData.h>
#include <fastrtps/rtps/builtin/data/ParticipantProxyData.h>
#include <fastrtps/rtps/builtin/BuiltinProtocols.h>


#include <fastrtps/log/Log.h>
Expand Down Expand Up @@ -152,6 +144,7 @@ bool EDPSimple::createSEDPEndpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 5000;
hatt.payloadMaxSize = DISCOVERY_PUBLICATION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.writerHistoryMemoryPolicy;
mp_PubWriter.second = new WriterHistory(hatt);
//Wparam.pushMode = true;
watt.endpoint.reliabilityKind = RELIABLE;
Expand Down Expand Up @@ -183,6 +176,7 @@ bool EDPSimple::createSEDPEndpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 1000000;
hatt.payloadMaxSize = DISCOVERY_SUBSCRIPTION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.readerHistoryMemoryPolicy;
mp_SubReader.second = new ReaderHistory(hatt);
//Rparam.historyMaxSize = 100;
ratt.expectsInlineQos = false;
Expand Down Expand Up @@ -218,6 +212,7 @@ bool EDPSimple::createSEDPEndpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 1000000;
hatt.payloadMaxSize = DISCOVERY_PUBLICATION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.readerHistoryMemoryPolicy;
mp_PubReader.second = new ReaderHistory(hatt);
//Rparam.historyMaxSize = 100;
ratt.expectsInlineQos = false;
Expand Down Expand Up @@ -251,6 +246,7 @@ bool EDPSimple::createSEDPEndpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 5000;
hatt.payloadMaxSize = DISCOVERY_SUBSCRIPTION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.writerHistoryMemoryPolicy;
mp_SubWriter.second = new WriterHistory(hatt);
//Wparam.pushMode = true;
watt.endpoint.reliabilityKind = RELIABLE;
Expand Down Expand Up @@ -300,6 +296,7 @@ bool EDPSimple::create_sedp_secure_endpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 5000;
hatt.payloadMaxSize = DISCOVERY_PUBLICATION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.writerHistoryMemoryPolicy;
sedp_builtin_publications_secure_writer_.second = new WriterHistory(hatt);
//Wparam.pushMode = true;
watt.endpoint.reliabilityKind = RELIABLE;
Expand Down Expand Up @@ -332,6 +329,7 @@ bool EDPSimple::create_sedp_secure_endpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 1000000;
hatt.payloadMaxSize = DISCOVERY_SUBSCRIPTION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.readerHistoryMemoryPolicy;
sedp_builtin_subscriptions_secure_reader_.second = new ReaderHistory(hatt);
//Rparam.historyMaxSize = 100;
ratt.expectsInlineQos = false;
Expand Down Expand Up @@ -366,6 +364,7 @@ bool EDPSimple::create_sedp_secure_endpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 1000000;
hatt.payloadMaxSize = DISCOVERY_PUBLICATION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.readerHistoryMemoryPolicy;
sedp_builtin_publications_secure_reader_.second = new ReaderHistory(hatt);
//Rparam.historyMaxSize = 100;
ratt.expectsInlineQos = false;
Expand Down Expand Up @@ -397,6 +396,7 @@ bool EDPSimple::create_sedp_secure_endpoints()
hatt.initialReservedCaches = 100;
hatt.maximumReservedCaches = 5000;
hatt.payloadMaxSize = DISCOVERY_SUBSCRIPTION_DATA_MAX_SIZE;
hatt.memoryPolicy = mp_PDP->mp_builtin->m_att.writerHistoryMemoryPolicy;
sedp_builtin_subscriptions_secure_writer_.second = new WriterHistory(hatt);
//Wparam.pushMode = true;
watt.endpoint.reliabilityKind = RELIABLE;
Expand Down
2 changes: 2 additions & 0 deletions src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ bool PDPSimple::createSPDPEndpoints()
hatt.payloadMaxSize = DISCOVERY_PARTICIPANT_DATA_MAX_SIZE;
hatt.initialReservedCaches = 20;
hatt.maximumReservedCaches = 100;
hatt.memoryPolicy = mp_builtin->m_att.writerHistoryMemoryPolicy;
mp_SPDPWriterHistory = new WriterHistory(hatt);
WriterAttributes watt;
watt.endpoint.endpointKind = WRITER;
Expand Down Expand Up @@ -480,6 +481,7 @@ bool PDPSimple::createSPDPEndpoints()
hatt.payloadMaxSize = DISCOVERY_PARTICIPANT_DATA_MAX_SIZE;
hatt.initialReservedCaches = 250;
hatt.maximumReservedCaches = 5000;
hatt.memoryPolicy = mp_builtin->m_att.readerHistoryMemoryPolicy;
mp_SPDPReaderHistory = new ReaderHistory(hatt);
ReaderAttributes ratt;
ratt.endpoint.multicastLocatorList = mp_builtin->m_metatrafficMulticastLocatorList;
Expand Down

0 comments on commit bf1715d

Please sign in to comment.