2018-07-12 16:29:32 +02:00
|
|
|
#include "InternalErrorReporter.h"
|
|
|
|
|
|
|
|
#include <framework/datapool/DataSet.h>
|
|
|
|
#include <framework/datapool/PoolVariable.h>
|
|
|
|
#include <framework/ipc/MutexFactory.h>
|
|
|
|
|
|
|
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
|
|
|
|
|
|
|
InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId,
|
|
|
|
uint32_t queuePoolId, uint32_t tmPoolId, uint32_t storePoolId) :
|
2019-12-01 17:48:05 +01:00
|
|
|
SystemObject(setObjectId), mutex(NULL), queuePoolId(queuePoolId),
|
|
|
|
tmPoolId(tmPoolId),storePoolId(storePoolId), queueHits(0), tmHits(0),
|
|
|
|
storeHits(0) {
|
2018-07-12 16:29:32 +02:00
|
|
|
mutex = MutexFactory::instance()->createMutex();
|
|
|
|
}
|
|
|
|
|
|
|
|
InternalErrorReporter::~InternalErrorReporter() {
|
|
|
|
MutexFactory::instance()->deleteMutex(mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) {
|
|
|
|
|
|
|
|
DataSet mySet;
|
|
|
|
PoolVariable<uint32_t> queueHitsInPool(queuePoolId, &mySet,
|
|
|
|
PoolVariableIF::VAR_READ_WRITE);
|
|
|
|
PoolVariable<uint32_t> tmHitsInPool(tmPoolId, &mySet,
|
|
|
|
PoolVariableIF::VAR_READ_WRITE);
|
|
|
|
|
|
|
|
PoolVariable<uint32_t> storeHitsInPool(storePoolId, &mySet,
|
|
|
|
PoolVariableIF::VAR_READ_WRITE);
|
|
|
|
mySet.read();
|
|
|
|
|
|
|
|
uint32_t newQueueHits = getAndResetQueueHits();
|
|
|
|
uint32_t newTmHits = getAndResetTmHits();
|
|
|
|
uint32_t newStoreHits = getAndResetStoreHits();
|
|
|
|
|
|
|
|
queueHitsInPool.value += newQueueHits;
|
|
|
|
tmHitsInPool.value += newTmHits;
|
|
|
|
storeHitsInPool.value += newStoreHits;
|
|
|
|
|
|
|
|
mySet.commit(PoolVariableIF::VALID);
|
|
|
|
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InternalErrorReporter::queueMessageNotSent() {
|
|
|
|
incrementQueueHits();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InternalErrorReporter::lostTm() {
|
|
|
|
incrementTmHits();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t InternalErrorReporter::getAndResetQueueHits() {
|
|
|
|
uint32_t value;
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
value = queueHits;
|
|
|
|
queueHits = 0;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t InternalErrorReporter::getQueueHits() {
|
|
|
|
uint32_t value;
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
value = queueHits;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InternalErrorReporter::incrementQueueHits() {
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
queueHits++;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t InternalErrorReporter::getAndResetTmHits() {
|
|
|
|
uint32_t value;
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
value = tmHits;
|
|
|
|
tmHits = 0;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t InternalErrorReporter::getTmHits() {
|
|
|
|
uint32_t value;
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
value = tmHits;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InternalErrorReporter::incrementTmHits() {
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
tmHits++;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InternalErrorReporter::storeFull() {
|
|
|
|
incrementStoreHits();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t InternalErrorReporter::getAndResetStoreHits() {
|
|
|
|
uint32_t value;
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
value = storeHits;
|
|
|
|
storeHits = 0;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t InternalErrorReporter::getStoreHits() {
|
|
|
|
uint32_t value;
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
value = storeHits;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void InternalErrorReporter::incrementStoreHits() {
|
|
|
|
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
|
|
|
storeHits++;
|
|
|
|
mutex->unlockMutex();
|
|
|
|
}
|