event manager uses refactored pool now
This commit is contained in:
parent
73215baf11
commit
67e33918e0
@ -1,23 +1,23 @@
|
|||||||
#include "EventManager.h"
|
#include "EventManager.h"
|
||||||
#include "EventMessage.h"
|
|
||||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "../ipc/QueueFactory.h"
|
#include "../ipc/QueueFactory.h"
|
||||||
#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 = {
|
||||||
|
{240, sizeof(EventMatchTree::Node)},
|
||||||
|
{120, sizeof(EventIdRangeMatcher)},
|
||||||
|
{120, sizeof(ReporterRangeMatcher)}
|
||||||
|
};
|
||||||
|
|
||||||
EventManager::EventManager(object_id_t setObjectId) :
|
EventManager::EventManager(object_id_t setObjectId) :
|
||||||
SystemObject(setObjectId),
|
SystemObject(setObjectId),
|
||||||
factoryBackend(0, POOL_SIZES, N_ELEMENTS, false, true) {
|
factoryBackend(0, poolConfig, false, true) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
eventReportQueue = QueueFactory::instance()->createMessageQueue(
|
eventReportQueue = QueueFactory::instance()->createMessageQueue(
|
||||||
MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE);
|
MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE);
|
||||||
@ -109,13 +109,13 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if FSFW_DEBUG_OUTPUT == 1
|
||||||
|
|
||||||
void EventManager::printEvent(EventMessage* message) {
|
void EventManager::printEvent(EventMessage* message) {
|
||||||
const char *string = 0;
|
const char *string = 0;
|
||||||
switch (message->getSeverity()) {
|
switch (message->getSeverity()) {
|
||||||
case SEVERITY::INFO:
|
case SEVERITY::INFO:
|
||||||
#ifdef DEBUG_INFO_EVENT
|
#if DEBUG_INFO_EVENT == 1
|
||||||
string = translateObject(message->getReporter());
|
string = translateObject(message->getReporter());
|
||||||
sif::info << "EVENT: ";
|
sif::info << "EVENT: ";
|
||||||
if (string != 0) {
|
if (string != 0) {
|
||||||
|
@ -8,9 +8,11 @@
|
|||||||
#include "../tasks/ExecutableObjectIF.h"
|
#include "../tasks/ExecutableObjectIF.h"
|
||||||
#include "../ipc/MessageQueueIF.h"
|
#include "../ipc/MessageQueueIF.h"
|
||||||
#include "../ipc/MutexIF.h"
|
#include "../ipc/MutexIF.h"
|
||||||
|
#include <FSFWConfig.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if FSFW_DEBUG_OUTPUT == 1
|
||||||
// forward declaration, should be implemented by mission
|
// forward declaration, should be implemented by mission
|
||||||
extern const char* translateObject(object_id_t object);
|
extern const char* translateObject(object_id_t object);
|
||||||
extern const char* translateEvents(Event event);
|
extern const char* translateEvents(Event event);
|
||||||
@ -49,13 +51,15 @@ protected:
|
|||||||
MutexIF* mutex = nullptr;
|
MutexIF* mutex = nullptr;
|
||||||
|
|
||||||
static const uint8_t N_POOLS = 3;
|
static const uint8_t N_POOLS = 3;
|
||||||
LocalPool<N_POOLS> factoryBackend;
|
LocalPool factoryBackend;
|
||||||
|
static const LocalPool::LocalPoolConfig poolConfig;
|
||||||
|
|
||||||
static const uint16_t POOL_SIZES[N_POOLS];
|
static const uint16_t POOL_SIZES[N_POOLS];
|
||||||
static const uint16_t N_ELEMENTS[N_POOLS];
|
static const uint16_t N_ELEMENTS[N_POOLS];
|
||||||
|
|
||||||
void notifyListeners(EventMessage *message);
|
void notifyListeners(EventMessage *message);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if FSFW_DEBUG_OUTPUT == 1
|
||||||
void printEvent(EventMessage *message);
|
void printEvent(EventMessage *message);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user