From f58f9fb729e365870d1721b340cc073b1826cfb4 Mon Sep 17 00:00:00 2001 From: Joana <joana.plewnia@kit.edu> Date: Mon, 22 Jul 2024 11:01:49 +0200 Subject: [PATCH] changed warning to debug/info and reduced spam if no maxHistorySize is set --- .../server/segment/SpecializedCoreSegment.h | 2 +- .../server/segment/SpecializedProviderSegment.h | 2 +- .../armem/server/wm/detail/MaxHistorySize.cpp | 16 +++++++++++++--- .../armem/server/wm/detail/MaxHistorySize.h | 2 +- .../armem/server/wm/memory_definitions.cpp | 3 ++- .../armem/server/wm/memory_definitions.h | 10 +++++++++- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/source/RobotAPI/libraries/armem/server/segment/SpecializedCoreSegment.h b/source/RobotAPI/libraries/armem/server/segment/SpecializedCoreSegment.h index 5ddca3e7d..e34a65795 100644 --- a/source/RobotAPI/libraries/armem/server/segment/SpecializedCoreSegment.h +++ b/source/RobotAPI/libraries/armem/server/segment/SpecializedCoreSegment.h @@ -27,7 +27,7 @@ namespace armarx::armem::server::segment MemoryToIceAdapter& iceMemory, const std::string& defaultCoreSegmentName = "", aron::type::ObjectPtr coreSegmentAronType = nullptr, - int defaultMaxHistorySize = -1, + int defaultMaxHistorySize = 10, const std::vector<PredictionEngine>& predictionEngines = {}); virtual ~SpecializedCoreSegment() override; diff --git a/source/RobotAPI/libraries/armem/server/segment/SpecializedProviderSegment.h b/source/RobotAPI/libraries/armem/server/segment/SpecializedProviderSegment.h index 3cb50c52f..6cbac5cad 100644 --- a/source/RobotAPI/libraries/armem/server/segment/SpecializedProviderSegment.h +++ b/source/RobotAPI/libraries/armem/server/segment/SpecializedProviderSegment.h @@ -29,7 +29,7 @@ namespace armarx::armem::server::segment const std::string& defaultCoreSegmentName = "", aron::type::ObjectPtr providerSegmentAronType = nullptr, aron::type::ObjectPtr coreSegmentAronType = nullptr, - int defaultMaxHistorySize = -1, + int defaultMaxHistorySize = 10, const std::vector<PredictionEngine>& providerSegmentPredictionEngines = {}, const std::vector<PredictionEngine>& coreSegmentPredictionEngines = {}); diff --git a/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.cpp b/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.cpp index cccf47eef..a6f3448cc 100644 --- a/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.cpp +++ b/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.cpp @@ -5,11 +5,21 @@ namespace armarx::armem::server::wm::detail { - void MaxHistorySize::setMaxHistorySize(long maxSize) + void MaxHistorySize::setMaxHistorySize(long maxSize, const std::string& additionalInfo) { if (maxSize < 0){ - ARMARX_WARNING << "The maxHistorySize for this core segment is set to < 0. This means nothing will ever be forgotten in working memory. " - << "This may slow down the memory server."; + if(additionalInfo != ""){ + ARMARX_INFO << "The maxHistorySize for this memory entity is set to < 0. " + << "This means nothing will ever be forgotten in working memory. " + << "This may slow down the memory server." + << "It is better to set the maxHistorySize per Provider- or CoreSegment"; + } else { + + ARMARX_DEBUG << "The maxHistorySize for this memory entity is set to < 0. " + << "This means nothing will ever be forgotten in working memory. " + << "This may slow down the memory server." + << "The entity name is " << additionalInfo; + } } this->_maxHistorySize = maxSize; } diff --git a/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.h b/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.h index 64eb07a63..7d0bbd669 100644 --- a/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.h +++ b/source/RobotAPI/libraries/armem/server/wm/detail/MaxHistorySize.h @@ -12,7 +12,7 @@ namespace armarx::armem::server::wm::detail * @brief Set the maximum number of snapshots to be contained in an entity. * Affected entities are to be update right away. */ - void setMaxHistorySize(long maxSize); + void setMaxHistorySize(long maxSize, const std::string& additionalInfo = ""); long getMaxHistorySize() const; diff --git a/source/RobotAPI/libraries/armem/server/wm/memory_definitions.cpp b/source/RobotAPI/libraries/armem/server/wm/memory_definitions.cpp index 973e3ca5c..b4dfb1cf6 100644 --- a/source/RobotAPI/libraries/armem/server/wm/memory_definitions.cpp +++ b/source/RobotAPI/libraries/armem/server/wm/memory_definitions.cpp @@ -16,7 +16,8 @@ namespace armarx::armem::server::wm void Entity::setMaxHistorySize(long maxSize) { - MaxHistorySize::setMaxHistorySize(maxSize); + std::string containerID = (this->id()).str(); + MaxHistorySize::setMaxHistorySize(maxSize, containerID); truncate(); } diff --git a/source/RobotAPI/libraries/armem/server/wm/memory_definitions.h b/source/RobotAPI/libraries/armem/server/wm/memory_definitions.h index 35015353a..1249dcf03 100644 --- a/source/RobotAPI/libraries/armem/server/wm/memory_definitions.h +++ b/source/RobotAPI/libraries/armem/server/wm/memory_definitions.h @@ -101,7 +101,15 @@ namespace armarx::armem::server::wm ProviderSegment& addProviderSegment(const std::string& name, Args... args) { ProviderSegmentT& added = CoreSegmentBase::addProviderSegment(name, args...); - added.setMaxHistorySize(this->getMaxHistorySize()); + int maxHistorySize = this->getMaxHistorySize(); + if(maxHistorySize < 0){ + ARMARX_INFO << "The maxHistorySize for this core segment is set to < 0. " + << "This means nothing will ever be forgotten in working memory. " + << "This may slow down the memory server. \n" + << "Core Segment Name: " + << (this->id()).str(); + } + added.setMaxHistorySize(maxHistorySize); return added; } -- GitLab