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"
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)
// objects registering for certain events.
// 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.
// SHOULDDO: Shouldn't this be in the config folder and passed via ctor?
const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 };
// This should be configurable..
const LocalPool::LocalPoolConfig EventManager::poolConfig = {
{sizeof(EventMatchTree::Node), 240},
{sizeof(EventIdRangeMatcher), 120},
{sizeof(ReporterRangeMatcher), 120}
{240, sizeof(EventMatchTree::Node)},
{120, sizeof(EventIdRangeMatcher)},
{120, sizeof(ReporterRangeMatcher)}
};
EventManager::EventManager(object_id_t setObjectId) :

View File

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

View File

@ -33,7 +33,7 @@ public:
using poolElementSize = size_type;
using numberPoolElements = uint16_t;
using LocalPoolCfgPair = std::pair<poolElementSize, numberPoolElements>;
using LocalPoolCfgPair = std::pair<numberPoolElements, poolElementSize>;
using LocalPoolConfig = std::multiset<LocalPoolCfgPair>;
/**
* @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.
* @details
* 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
* many elements with that size are created on that page.
* All regions are to zero on start up.

View File

@ -3,17 +3,12 @@
#include "ServiceMatcher.h"
#include "SubserviceMatcher.h"
const uint16_t PacketMatchTree::POOL_SIZES[N_POOLS] = { sizeof(ServiceMatcher),
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 };
// This should be configurable..
const LocalPool::LocalPoolConfig PacketMatchTree::poolConfig = {
LocalPool::LocalPoolCfgPair(sizeof(ServiceMatcher), 10),
LocalPool::LocalPoolCfgPair(sizeof(SubServiceMatcher), 20),
LocalPool::LocalPoolCfgPair(sizeof(ApidMatcher), 2),
LocalPool::LocalPoolCfgPair(sizeof(PacketMatchTree::Node), 40)
{10, sizeof(ServiceMatcher)},
{20, sizeof(SubServiceMatcher)},
{2, sizeof(ApidMatcher)},
{40, sizeof(PacketMatchTree::Node)}
};
PacketMatchTree::PacketMatchTree(Node* root) :