Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c10
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.c102
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.h57
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.c27
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.h38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h8
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h43
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c28
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h12
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c2
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c18
13 files changed, 265 insertions, 122 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c
index 43df6a908..d554ca3a8 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c
@@ -20,7 +20,6 @@ void etQueue_init(etQueue* self){
self->first = NULL;
self->last = NULL;
- self->highWaterMark = 0;
self->size = 0;
ET_MSC_LOGGER_SYNC_EXIT
@@ -40,9 +39,7 @@ void etQueue_push(etQueue* self, etQueueObj* obj){
self->last = obj;
}
obj->next = NULL; /*TODO: optimization: this line could be removed if we assume that all objects are initialized*/
-
- if (++self->size > self->highWaterMark)
- self->highWaterMark++;
+ self->size++;
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -97,8 +94,3 @@ etBool etQueue_isNotEmpty(etQueue* self){
return self->last != NULL;
}
-etInt16 etQueue_getHighWaterMark(etQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getHightWaterMark")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->highWaterMark;
-}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
index 89109c64a..f50ba26c8 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
@@ -27,9 +27,7 @@ typedef struct etQueueObj {
typedef struct etQueue {
etQueueObj* first;
etQueueObj* last;
- etInt16 highWaterMark;
etInt16 size;
-
} etQueue;
void etQueue_init(etQueue* self);
@@ -44,8 +42,6 @@ etQueueObj* etQueue_getLast(etQueue* self);
etBool etQueue_isNotEmpty(etQueue* self);
-etInt16 etQueue_getHighWaterMark(etQueue* self);
-
etInt16 etQueue_getSize(etQueue* self);
ET_EXTERN_C_END
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.c
new file mode 100644
index 000000000..53eb17ee2
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.c
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ * Juergen Haug
+ *
+ *******************************************************************************/
+
+#include "base/etQueue2.h"
+
+#define DO_LOCK \
+ if (self->lock!=NULL) { \
+ self->lock->lockFct(self->lock->lockData); \
+ }
+
+#define DO_UNLOCK \
+ if (self->lock!=NULL) { \
+ self->lock->unlockFct(self->lock->lockData); \
+ }
+
+void etQueue2_init(etQueue2* self){
+ etQueue_init(&self->queue);
+ self->lock = NULL;
+ etQueueStatistics_init(&self->statistics);
+}
+
+void etQueue2_setLock(etQueue2* self, etLock* lock) {
+ self->lock = lock;
+}
+
+void etQueue2_push(etQueue2* self, etQueueObj* obj) {
+ DO_LOCK
+
+ etQueue_push(&self->queue, obj);
+ if(self->queue.size > self->statistics.highWaterMark) {
+ self->statistics.highWaterMark = self->queue.size;
+ }
+
+ DO_UNLOCK
+}
+
+etQueueObj* etQueue2_pop(etQueue2* self) {
+ DO_LOCK
+
+ etQueueObj* pop_msg = etQueue_pop(&self->queue);
+ if (self->queue.size < self->statistics.lowWaterMark) {
+ self->statistics.lowWaterMark = self->queue.size;
+ }
+
+ DO_UNLOCK
+ return pop_msg;
+}
+
+etInt16 etQueue2_getSize(etQueue2* self) {
+ DO_LOCK
+ etInt16 size = self->queue.size;
+ DO_UNLOCK
+
+ return size;
+}
+
+etQueueObj* etQueue2_getFirst(etQueue2* self) {
+ DO_LOCK
+ etQueueObj* obj = self->queue.first;
+ DO_UNLOCK
+
+ return obj;
+}
+
+etQueueObj* etQueue2_getLast(etQueue2* self) {
+ DO_LOCK
+ etQueueObj* obj = self->queue.last;
+ DO_UNLOCK
+
+ return obj;
+}
+
+etBool etQueue2_isNotEmpty(etQueue2* self) {
+ DO_LOCK
+ etBool notEmpty = self->queue.last != NULL;
+ DO_UNLOCK
+
+ return notEmpty;
+}
+
+const etQueueStatistics* etQueue2_getStatistics(etQueue2* self) {
+ return &self->statistics;
+}
+
+void etQueue2_resetStatistics(etQueue2* self) {
+ DO_LOCK
+ etQueueStatistics_reset(&self->statistics, self->queue.size);
+ DO_UNLOCK
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.h
new file mode 100644
index 000000000..77884e3a6
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue2.h
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ * Juergen Haug
+ *
+ *******************************************************************************/
+
+#ifndef COMMON_BASE_ETQUEUE2_H_
+#define COMMON_BASE_ETQUEUE2_H_
+
+#include "base/etQueue.h"
+#include "osal/etLock.h"
+#include "base/etQueueStatistics.h"
+
+ET_EXTERN_C_BEGIN
+
+/**
+ * etQueue with locking and statistics
+ */
+typedef struct etQueue2 {
+ etQueue queue;
+ etLock* lock;
+ etQueueStatistics statistics;
+} etQueue2;
+
+void etQueue2_init(etQueue2* self);
+
+void etQueue2_setLock(etQueue2* self, etLock* lock);
+
+void etQueue2_push(etQueue2* self, etQueueObj* obj);
+
+etQueueObj* etQueue2_pop(etQueue2* self);
+
+etQueueObj* etQueue2_getFirst(etQueue2* self);
+
+etQueueObj* etQueue2_getLast(etQueue2* self);
+
+etBool etQueue2_isNotEmpty(etQueue2* self);
+
+etInt16 etQueue2_getSize(etQueue2* self);
+
+const etQueueStatistics* etQueue2_getStatistics(etQueue2* self);
+
+void etQueue2_resetStatistics(etQueue2* self);
+
+
+ET_EXTERN_C_END
+
+#endif /* COMMON_BASE_ETQUEUE2_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.c
new file mode 100644
index 000000000..2f3ce55cb
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.c
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * CONTRIBUTORS:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "etQueueStatistics.h"
+
+void etQueueStatistics_init(etQueueStatistics* self) {
+ self->highWaterMark = 0;
+ self->lowWaterMark = 0;
+ self->nFailingRequests = 0;
+}
+
+void etQueueStatistics_reset(etQueueStatistics* self, etInt16 lowWaterMark) {
+ self->highWaterMark = 0;
+ self->lowWaterMark = lowWaterMark;
+ self->nFailingRequests = 0;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.h
new file mode 100644
index 000000000..c27c93ed5
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueueStatistics.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * CONTRIBUTORS:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef COMMON_BASE_ETQUEUESTATISTICS_H_
+#define COMMON_BASE_ETQUEUESTATISTICS_H_
+
+#include "etDatatypes.h"
+
+ET_EXTERN_C_BEGIN
+
+/**
+ * a data structure for the queue statistics
+ */
+typedef struct etQueueStatistics {
+ etInt16 highWaterMark; /**< high water mark */
+ etInt16 lowWaterMark; /**< low water mark */
+ etInt16 nFailingRequests; /**< queue would have exceeded maximum size */
+}
+etQueueStatistics;
+
+void etQueueStatistics_init(etQueueStatistics* self);
+
+void etQueueStatistics_reset(etQueueStatistics* self, etInt16 lowWaterMark);
+
+ET_EXTERN_C_END
+
+#endif /* COMMON_BASE_ETQUEUESTATISTICS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
index aa9d486bc..17ca024b6 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
@@ -202,6 +202,14 @@ void etMSCLogger_addVisibleComment(const char* comment);
* If \ref ET_MSC_LOGGER_ACTIVATE isn't defined this macro is void
*/
#define ET_MSC_LOGGER_CHANGE_STATE(objectName, stateName)
+
+/**
+ * calls \ref etMSCLogger_addVisibleComment(const char*)
+ * \par
+ * If \ref ET_MSC_LOGGER_ACTIVATE isn't defined this macro is void
+ */
+#define ET_MSC_LOGGER_VISIBLE_COMMENT(comment)
+
#endif
ET_EXTERN_C_END
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
index 88bb1f38c..fc0a7edb1 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
@@ -20,8 +20,6 @@ void etMessageQueue_init(etMessageQueue* self){
ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "init")
self->first = NULL;
self->last = NULL;
- self->statistics.highWaterMark = 0;
- self->statistics.lowWaterMark = 0;
self->size = 0;
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -40,9 +38,7 @@ void etMessageQueue_push(etMessageQueue* self, etMessage* msg){
self->last = msg;
}
msg->next = NULL; /*TODO: optimization: this line could be removed if we assume that all messages are initialized*/
-
- if (++self->size > self->statistics.highWaterMark)
- self->statistics.highWaterMark++;
+ self->size++;
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -67,9 +63,6 @@ etMessage* etMessageQueue_pop(etMessageQueue* self){
pop_msg->next=NULL;
self->size--;
- if (self->size < self->statistics.lowWaterMark)
- self->statistics.lowWaterMark--;
-
ET_MSC_LOGGER_SYNC_EXIT
return pop_msg;
}
@@ -98,32 +91,3 @@ etBool etMessageQueue_isNotEmpty(etMessageQueue* self){
return self->last != NULL;
}
-const etQueueStatistics* etMessageQueue_getStatistics(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getHighWaterMark")
- ET_MSC_LOGGER_SYNC_EXIT
- return &self->statistics;
-}
-
-etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getHighWaterMark")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->statistics.highWaterMark;
-}
-
-void etMessageQueue_resetHighWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "resetHighWaterMark")
- self->statistics.highWaterMark = 0;
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getLowWaterMark")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->statistics.lowWaterMark;
-}
-
-void etMessageQueue_resetLowWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "resetLowWaterMark")
- self->statistics.lowWaterMark = self->size;
- ET_MSC_LOGGER_SYNC_EXIT
-}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
index eb3727034..dda05abfa 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
@@ -29,22 +29,12 @@
ET_EXTERN_C_BEGIN
/**
- * a data structure for the queue statistics
- */
-typedef struct etQueueStatistics {
- etInt16 highWaterMark; /**< high water mark */
- etInt16 lowWaterMark; /**< low water mark */
-}
-etQueueStatistics;
-
-/**
* the message queue data structure
*/
typedef struct etMessageQueue {
etMessage* first; /**< the head of the list */
etMessage* last; /**< the tail of the list */
etInt16 size; /**< the size of the list */
- etQueueStatistics statistics; /**< high water mark for statistical purposes */
}
etMessageQueue;
@@ -99,39 +89,6 @@ etBool etMessageQueue_isNotEmpty(etMessageQueue* self);
* \return the size of the message queue
*/
etInt16 etMessageQueue_getSize(etMessageQueue* self);
-/**
- * returns the statistics of the queue
- * \param self the this pointer
- * \return the statistics of the queue (immutable)
- */
-const etQueueStatistics* etMessageQueue_getStatistics(etMessageQueue* self);
-/**
- * returns the high water mark of the message queue
- *
- * \param self the this pointer
- * \return the high water mark of the message queue
- */
-etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self);
-/**
- * resets the high water mark of the message queue to 0
- *
- * \param self the this pointer
- */
-void etMessageQueue_resetHighWaterMark(etMessageQueue* self);
-/**
- * returns the low water mark of the message queue
- *
- * \param self the this pointer
- * \return the low water mark of the message queue
- */
-etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self);
-/**
- * resets the low water mark of the message queue to the current
- * position (size) of the queue
- *
- * \param self the this pointer
- */
-void etMessageQueue_resetLowWaterMark(etMessageQueue* self);
ET_EXTERN_C_END
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
index e7298885c..d752e465a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
@@ -90,7 +90,10 @@ void etMessageService_initx(
/* init statistics */
self->statistics.highWaterMark = 0;
- self->statistics.queueStatistics = &self->messageQueue.statistics;
+ self->statistics.queueStatistics.highWaterMark = 0;
+ self->statistics.queueStatistics.lowWaterMark = 0;
+ self->statistics.queueStatistics.nFailingRequests = 0;
+
self->resetStatistics = ET_FALSE;
/* register with runtime */
@@ -152,7 +155,6 @@ void etMessageService_initMessagePool(etMessageService* self){
etMessage* block = (etMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize];
etMessageQueue_push(&self->messagePool, block);
}
- etMessageQueue_resetLowWaterMark(&self->messagePool);
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -184,14 +186,19 @@ etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 si
if (self->messagePool.size>0){
etMessage* msg = etMessageQueue_pop(&self->messagePool);
etMutex_leave(&self->poolMutex);
+ if((self->messageBuffer.maxBlocks - self->messagePool.size) > self->statistics.queueStatistics.highWaterMark) {
+ self->statistics.queueStatistics.highWaterMark++;
+ }
ET_MSC_LOGGER_SYNC_EXIT
return msg;
}
else {
- etLogger_logErrorF("etMessageService_getMessageBuffer: message pool empty: %d", etMessageService_getMessagePoolLowWaterMark(self));
+ self->statistics.queueStatistics.nFailingRequests++;
+ etLogger_logErrorF("etMessageService_getMessageBuffer: message pool empty: %d", self->statistics.queueStatistics.lowWaterMark);
}
}
else {
+ self->statistics.queueStatistics.nFailingRequests++;
etLogger_logErrorF("etMessageService_getMessageBuffer: message too big: %d, blockSize: %d", size, self->messageBuffer.blockSize);
}
etMutex_leave(&self->poolMutex);
@@ -203,6 +210,9 @@ void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buf
ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "returnMessageBuffer")
etMutex_enter(&self->poolMutex);
etMessageQueue_push(&self->messagePool, buffer);
+ if ((self->messageBuffer.maxBlocks - self->messagePool.size) < self->statistics.queueStatistics.lowWaterMark) {
+ self->statistics.queueStatistics.lowWaterMark--;
+ }
etMutex_leave(&self->poolMutex);
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -273,8 +283,9 @@ static void etMessageService_deliverAllMessages(etMessageService* self){
self->resetStatistics = ET_FALSE;
self->statistics.highWaterMark = 0;
- etMessageQueue_resetHighWaterMark(&self->messageQueue);
- etMessageQueue_resetLowWaterMark(&self->messageQueue);
+ self->statistics.queueStatistics.highWaterMark = 0;
+ self->statistics.queueStatistics.lowWaterMark = (self->messageBuffer.maxBlocks - self->messagePool.size);
+ self->statistics.queueStatistics.nFailingRequests = 0;
}
while (etMessageQueue_isNotEmpty(&self->messageQueue) && cont){
@@ -290,13 +301,6 @@ static void etMessageService_deliverAllMessages(etMessageService* self){
ET_MSC_LOGGER_SYNC_EXIT
}
-etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessagePoolLowWaterMark")
- etInt16 lowWaterMark = etMessageQueue_getLowWaterMark(&self->messagePool);
- ET_MSC_LOGGER_SYNC_EXIT
- return lowWaterMark;
-}
-
static void etMessageService_timerCallback(void* data) {
ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "timerCallback")
{
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
index 1d52a5f3c..2a50e55b6 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
@@ -27,6 +27,8 @@
#include "etDatatypes.h"
#include "messaging/etMessageQueue.h"
#include "messaging/etMessageReceiver.h"
+#include "base/etQueue.h"
+#include "base/etQueueStatistics.h"
#include "osal/etMutex.h"
#include "osal/etThread.h"
@@ -71,7 +73,7 @@ struct etHighPrioFunc{
*/
typedef struct etMessageServiceStatistics {
etTimeDiff highWaterMark; /** high water mark */
- etQueueStatistics* queueStatistics; /** a pointer to the queue statistics */
+ etQueueStatistics queueStatistics; /** a pointer to the queue statistics */
}
etMessageServiceStatistics;
@@ -211,14 +213,6 @@ etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 si
*/
void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer);
-/**
- * returns the low water mark of the message pool
- *
- * \param self the this pointer
- * \return the low water mark of the message pool
- */
-etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self);
-
/* functions to register and unregister high prio functions */
void etMessageService_registerHighPrioFunc(etMessageService* self, etHighPrioFunc* func);
void etMessageService_unregisterHighPrioFunc(etMessageService* self, etHighPrioFunc* func);
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c
index d0ea4058a..0e99b226f 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageQueue.c
@@ -28,13 +28,11 @@ void TestEtMessageQueue_testPushPop(etInt16 id){
etMessageQueue_push(&queue1, &msg2);
EXPECT_EQUAL_INT16(id, "etMessageQueue.size before", 2, queue1.size);
- EXPECT_EQUAL_INT16(id, "etMessageQueue.statistics.highWaterMark before", 2, queue1.statistics.highWaterMark);
etMessage* rcvMsg1 = etMessageQueue_pop(&queue1);
etMessage* rcvMsg2 = etMessageQueue_pop(&queue1);
EXPECT_EQUAL_INT16(id, "etMessageQueue.size after", 0, queue1.size);
- EXPECT_EQUAL_INT16(id, "etMessageQueue.statistics.highWaterMark after", 2, queue1.statistics.highWaterMark);
EXPECT_EQUAL_INT16(id, "rcvMsg1->address", 123, rcvMsg1->address);
EXPECT_EQUAL_INT16(id, "rcvMsg1->evtID", 456, rcvMsg1->evtID);
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
index ea1480b72..407ba137d 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
@@ -237,7 +237,8 @@ void TestEtMessageService_getMessagePoolLowWaterMark(etInt16 id){
DummyMessageDispatcher,
EXECMODE_BLOCKED);
- EXPECT_EQUAL_INT16(id, "inital low water mark", max, etMessageService_getMessagePoolLowWaterMark(&msgService));
+ EXPECT_EQUAL_INT16(id, "inital low water mark", 0, msgService.statistics.queueStatistics.lowWaterMark);
+ EXPECT_EQUAL_INT16(id, "inital high water mark", 0, msgService.statistics.queueStatistics.highWaterMark);
// get messages from pool
etMessage* msg1 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
@@ -253,7 +254,8 @@ void TestEtMessageService_getMessagePoolLowWaterMark(etInt16 id){
etMessageService_pushMessage(&msgService, msg2);
etMessageService_pushMessage(&msgService, msg1);
- EXPECT_EQUAL_INT16(id, "low water mark 1", max-2, etMessageService_getMessagePoolLowWaterMark(&msgService));
+ EXPECT_EQUAL_INT16(id, "low water mark 1", 0, msgService.statistics.queueStatistics.lowWaterMark);
+ EXPECT_EQUAL_INT16(id, "high water mark 1", 2, msgService.statistics.queueStatistics.highWaterMark);
// pop messages from queue
etMessage* rcvMsg1 = etMessageService_popMessage(&msgService);
@@ -262,7 +264,8 @@ void TestEtMessageService_getMessagePoolLowWaterMark(etInt16 id){
etMessageService_returnMessageBuffer(&msgService, rcvMsg1);
etMessageService_returnMessageBuffer(&msgService, rcvMsg2);
- EXPECT_EQUAL_INT16(id, "low water mark 2", max-2, etMessageService_getMessagePoolLowWaterMark(&msgService));
+ EXPECT_EQUAL_INT16(id, "low water mark 2", 0, msgService.statistics.queueStatistics.lowWaterMark);
+ EXPECT_EQUAL_INT16(id, "high water mark 2", 2, msgService.statistics.queueStatistics.highWaterMark);
msg1 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
msg2 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
@@ -270,7 +273,8 @@ void TestEtMessageService_getMessagePoolLowWaterMark(etInt16 id){
etMessageService_pushMessage(&msgService, msg1);
/*still the same*/
- EXPECT_EQUAL_INT16(id, "low water mark 3", max-2, etMessageService_getMessagePoolLowWaterMark(&msgService));
+ EXPECT_EQUAL_INT16(id, "low water mark 3", 0, msgService.statistics.queueStatistics.lowWaterMark);
+ EXPECT_EQUAL_INT16(id, "high water mark 3", 2, msgService.statistics.queueStatistics.highWaterMark);
msg1 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
etMessageService_pushMessage(&msgService, msg2);
@@ -282,13 +286,15 @@ void TestEtMessageService_getMessagePoolLowWaterMark(etInt16 id){
etMessageService_pushMessage(&msgService, msg2);
/* no message left */
- EXPECT_EQUAL_INT16(id, "low water mark 4", 0, etMessageService_getMessagePoolLowWaterMark(&msgService));
+ EXPECT_EQUAL_INT16(id, "low water mark 4", 0, msgService.statistics.queueStatistics.lowWaterMark);
+ EXPECT_EQUAL_INT16(id, "high water mark 4", max, msgService.statistics.queueStatistics.highWaterMark);
msg1 = etMessageService_getMessageBuffer(&msgService, sizeof(etMessage));
EXPECT_EQUAL_PTR(id, "check message for NULL", NULL, msg1);
/* still no message left */
- EXPECT_EQUAL_INT16(id, "low water mark 6", 0, etMessageService_getMessagePoolLowWaterMark(&msgService));
+ EXPECT_EQUAL_INT16(id, "low water mark 6", 0, msgService.statistics.queueStatistics.lowWaterMark);
+ EXPECT_EQUAL_INT16(id, "high water mark 6", max, msgService.statistics.queueStatistics.highWaterMark);
etMessageService_destroy(&msgService);
}

Back to the top