more work on switching to new COM and TIMER stack.

This commit is contained in:
Martin Preuss
2023-04-13 21:16:51 +02:00
parent a61226c3d9
commit c00b90bf28
9 changed files with 168 additions and 64 deletions

View File

@@ -297,21 +297,21 @@ void _processSendStatsMessage(GWEN_MSG_ENDPOINT *ep, GWEN_MSG *nodeMsg)
if (packetsOutInt) {
double packetsOut;
double collisions;
double aborted;
double busy;
double collisionsPercentage=0.0;
double abortedPercentage=0.0;
double busyPercentage=0.0;
packetsOut=(double) packetsOutInt;
collisions=(double)AQH_SendStatsMsg_GetCollisions(nodeMsg);
aborted=(double)AQH_SendStatsMsg_GetAborted(nodeMsg);
busy=(double)AQH_SendStatsMsg_GetBusyErrors(nodeMsg);
collisionsPercentage=collisions*100.0/packetsOut;
abortedPercentage=aborted*100.0/packetsOut;
busyPercentage=busy*100.0/packetsOut;
_publishInt(ep, AQH_SendStatsMsg_GetUid(nodeMsg), 0, "net/packetsOut", packetsOutInt);
_publishInt(ep, AQH_SendStatsMsg_GetUid(nodeMsg), 0, "net/collisions", (int) AQH_SendStatsMsg_GetCollisions(nodeMsg));
_publishDouble(ep, AQH_SendStatsMsg_GetUid(nodeMsg), 0, "net/collisionsPercent", collisionsPercentage);
_publishDouble(ep, AQH_SendStatsMsg_GetUid(nodeMsg), 0, "net/abortedPercent", abortedPercentage);
_publishDouble(ep, AQH_SendStatsMsg_GetUid(nodeMsg), 0, "net/busyPercent", busyPercentage);
}
}

View File

@@ -18,13 +18,12 @@
#include <gwenhywfar/debug.h>
#define AQH_MSG_OFFS_SENDSTATS_UID 0
#define AQH_MSG_OFFS_SENDSTATS_PACKETSOUT 4
#define AQH_MSG_OFFS_SENDSTATS_COLLISIONS 6
#define AQH_MSG_OFFS_SENDSTATS_ABORTED 8
#define AQH_MSG_OFFS_SENDSTATS_NOBUFFER 10
#define AQH_MSG_OFFS_SENDSTATS_UID 0 /* 4 bytes */
#define AQH_MSG_OFFS_SENDSTATS_PACKETSOUT 4 /* 2 bytes */
#define AQH_MSG_OFFS_SENDSTATS_COLLISIONS 6 /* 2 bytes */
#define AQH_MSG_OFFS_SENDSTATS_BUSY 8 /* 2 bytes */
#define AQH_MSG_SENDSTATS_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_ABORTED+2)
#define AQH_MSG_SENDSTATS_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_BUSY+2)
@@ -49,16 +48,9 @@ uint16_t AQH_SendStatsMsg_GetCollisions(const GWEN_MSG *msg)
uint16_t AQH_SendStatsMsg_GetAborted(const GWEN_MSG *msg)
uint16_t AQH_SendStatsMsg_GetBusyErrors(const GWEN_MSG *msg)
{
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_ABORTED, 0);
}
uint16_t AQH_SendStatsMsg_GetNoBufferErrors(const GWEN_MSG *msg)
{
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_NOBUFFER, 0);
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_BUSY, 0);
}
@@ -68,15 +60,14 @@ void AQH_SendStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMSENDSTATS) &&
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_SENDSTATS_MINSIZE)) {
GWEN_Buffer_AppendArgs(dbuf,
"0x%02x->0x%02x: SENDSTATS %s (uid=0x%08x, out=%d, collisions=%d, aborted=%d, no buffer=%d)\n",
"0x%02x->0x%02x: SENDSTATS %s (uid=0x%08x, out=%d, collisions=%d, busy line=%d)\n",
AQH_NodeMsg_GetSourceAddress(msg),
AQH_NodeMsg_GetDestAddress(msg),
sText,
(unsigned int) AQH_SendStatsMsg_GetUid(msg),
AQH_SendStatsMsg_GetPacketsOut(msg),
AQH_SendStatsMsg_GetCollisions(msg),
AQH_SendStatsMsg_GetAborted(msg),
AQH_SendStatsMsg_GetNoBufferErrors(msg));
AQH_SendStatsMsg_GetBusyErrors(msg));
}
}

View File

@@ -21,8 +21,7 @@
AQHOME_API uint32_t AQH_SendStatsMsg_GetUid(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_SendStatsMsg_GetPacketsOut(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_SendStatsMsg_GetCollisions(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_SendStatsMsg_GetAborted(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_SendStatsMsg_GetNoBufferErrors(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_SendStatsMsg_GetBusyErrors(const GWEN_MSG *msg);
AQHOME_API void AQH_SendStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);

View File

@@ -327,7 +327,7 @@ void _handleMsgComSendStat(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG_ENDPOINT *ep, c
}
AQH_NodeInfo_SetStatsPacketsOut(ni, AQH_SendStatsMsg_GetPacketsOut(msg));
AQH_NodeInfo_SetStatsCollisions(ni, AQH_SendStatsMsg_GetCollisions(msg));
AQH_NodeInfo_SetStatsAborted(ni, AQH_SendStatsMsg_GetAborted(msg));
AQH_NodeInfo_SetStatsBusy(ni, AQH_SendStatsMsg_GetBusyErrors(msg));
AQH_NodeDb_SetModified(xmgr->nodeDb);
}
}

View File

@@ -90,7 +90,7 @@
<flags></flags>
</member>
<member name="statsAborted" type="uint32_t" maxlen="4">
<member name="statsBusy" type="uint32_t" maxlen="4">
<default>0</default>
<preset>0</preset>
<access>public</access>