important bugfixes

This commit is contained in:
Robin Müller 2020-10-15 00:54:00 +02:00
parent 64bed475fe
commit 1ee01ffcdb
4 changed files with 13 additions and 23 deletions

View File

@ -4,20 +4,15 @@
#include "../ipc/MutexFactory.h" #include "../ipc/MutexFactory.h"
const uint16_t EventManager::POOL_SIZES[N_POOLS] = {
sizeof(EventMatchTree::Node), sizeof(EventIdRangeMatcher),
sizeof(ReporterRangeMatcher) };
// If one checks registerListener calls, there are around 40 (to max 50) // If one checks registerListener calls, there are around 40 (to max 50)
// objects registering for certain events. // objects registering for certain events.
// Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher. // Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher.
// So a good guess is 75 to a max of 100 pools required for each, which fits well. // So a good guess is 75 to a max of 100 pools required for each, which fits well.
// SHOULDDO: Shouldn't this be in the config folder and passed via ctor? // This should be configurable..
const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 };
const LocalPool::LocalPoolConfig EventManager::poolConfig = { const LocalPool::LocalPoolConfig EventManager::poolConfig = {
{sizeof(EventMatchTree::Node), 240}, {240, sizeof(EventMatchTree::Node)},
{sizeof(EventIdRangeMatcher), 120}, {120, sizeof(EventIdRangeMatcher)},
{sizeof(ReporterRangeMatcher), 120} {120, sizeof(ReporterRangeMatcher)}
}; };
EventManager::EventManager(object_id_t setObjectId) : EventManager::EventManager(object_id_t setObjectId) :

View File

@ -9,8 +9,8 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig poolConfig,
spillsToHigherPools(spillsToHigherPools) { spillsToHigherPools(spillsToHigherPools) {
uint16_t index = 0; uint16_t index = 0;
for (const auto& currentPoolConfig: poolConfig) { for (const auto& currentPoolConfig: poolConfig) {
this->elementSizes[index] = currentPoolConfig.first; this->numberOfElements[index] = currentPoolConfig.first;
this->numberOfElements[index] = currentPoolConfig.second; this->elementSizes[index] = currentPoolConfig.second;
store[index] = std::vector<uint8_t>( store[index] = std::vector<uint8_t>(
numberOfElements[index] * elementSizes[index]); numberOfElements[index] * elementSizes[index]);
sizeLists[index] = std::vector<size_type>(numberOfElements[index]); sizeLists[index] = std::vector<size_type>(numberOfElements[index]);

View File

@ -33,7 +33,7 @@ public:
using poolElementSize = size_type; using poolElementSize = size_type;
using numberPoolElements = uint16_t; using numberPoolElements = uint16_t;
using LocalPoolCfgPair = std::pair<poolElementSize, numberPoolElements>; using LocalPoolCfgPair = std::pair<numberPoolElements, poolElementSize>;
using LocalPoolConfig = std::multiset<LocalPoolCfgPair>; using LocalPoolConfig = std::multiset<LocalPoolCfgPair>;
/** /**
* @brief This definition generally sets the number of different sized pools. * @brief This definition generally sets the number of different sized pools.
@ -44,7 +44,7 @@ public:
* @brief This is the default constructor for a pool manager instance. * @brief This is the default constructor for a pool manager instance.
* @details * @details
* The pool is configured by passing a set of pairs into the constructor. * The pool is configured by passing a set of pairs into the constructor.
* The first value of that pair determines the number of one element on * The first value of that pair determines the number of one elements on
* the respective page of the pool while the second value determines how * the respective page of the pool while the second value determines how
* many elements with that size are created on that page. * many elements with that size are created on that page.
* All regions are to zero on start up. * All regions are to zero on start up.

View File

@ -3,17 +3,12 @@
#include "ServiceMatcher.h" #include "ServiceMatcher.h"
#include "SubserviceMatcher.h" #include "SubserviceMatcher.h"
const uint16_t PacketMatchTree::POOL_SIZES[N_POOLS] = { sizeof(ServiceMatcher), // This should be configurable..
sizeof(SubServiceMatcher), sizeof(ApidMatcher),
sizeof(PacketMatchTree::Node) };
//Maximum number of types and subtypes to filter should be more than sufficient.
const uint16_t PacketMatchTree::N_ELEMENTS[N_POOLS] = { 10, 20, 2, 40 };
const LocalPool::LocalPoolConfig PacketMatchTree::poolConfig = { const LocalPool::LocalPoolConfig PacketMatchTree::poolConfig = {
LocalPool::LocalPoolCfgPair(sizeof(ServiceMatcher), 10), {10, sizeof(ServiceMatcher)},
LocalPool::LocalPoolCfgPair(sizeof(SubServiceMatcher), 20), {20, sizeof(SubServiceMatcher)},
LocalPool::LocalPoolCfgPair(sizeof(ApidMatcher), 2), {2, sizeof(ApidMatcher)},
LocalPool::LocalPoolCfgPair(sizeof(PacketMatchTree::Node), 40) {40, sizeof(PacketMatchTree::Node)}
}; };
PacketMatchTree::PacketMatchTree(Node* root) : PacketMatchTree::PacketMatchTree(Node* root) :