improve stats reporting
now again use three messages to transmit stats (much more efficient than sending single values, also more acurate).
This commit is contained in:
@@ -29,8 +29,8 @@
|
||||
|
||||
#define AQH_MSG_TYPE_PING 10
|
||||
#define AQH_MSG_TYPE_PONG 11
|
||||
#define AQH_MSG_TYPE_COMSENDSTATS 20
|
||||
#define AQH_MSG_TYPE_COMRECVSTATS 21
|
||||
#define AQH_MSG_TYPE_COMSENDSTATS 22
|
||||
#define AQH_MSG_TYPE_COMRECVSTATS 23
|
||||
#define AQH_MSG_TYPE_TWIBUSMEMBER 30
|
||||
#define AQH_MSG_TYPE_DEBUG 40
|
||||
#define AQH_MSG_TYPE_VALUE 50 /* deprecated */
|
||||
|
||||
@@ -19,12 +19,20 @@
|
||||
|
||||
|
||||
#define AQH_MSG_OFFS_RECVSTATS_UID 0 /* 4 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_PACKETSIN 4 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_CRCERRORS 6 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_IOERRORS 8 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_NOBUFFER 10 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_HANDLED 12 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_MISSED 14 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_IFACE 4 /* 1 byte */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_PACKETSIN 5 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_CRCERRORS 7 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_IOERRORS 9 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_NOBUFFER 11 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_HANDLED 13 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_RECVSTATS_MISSED 15 /* 2 bytes */
|
||||
|
||||
|
||||
|
||||
uint8_t AQH_RecvStatsMessage_GetInterface(const AQH_MESSAGE *msg)
|
||||
{
|
||||
return AQH_Message_ReadUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_IFACE, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -80,12 +88,13 @@ uint16_t AQH_RecvStatsMessage_GetMissed(const AQH_MESSAGE *msg)
|
||||
void AQH_RecvStatsMessage_DumpToBuffer(const AQH_MESSAGE *msg, GWEN_BUFFER *dbuf, const char *sText)
|
||||
{
|
||||
GWEN_Buffer_AppendArgs(dbuf,
|
||||
"0x%02x->0x%02x: RECVSTATS %s "
|
||||
"(uid=0x%08x, in=%d, crc errs=%d, io errs=%d, nobuf errs=%d, handled=%d, missed=%d)\n",
|
||||
"0x%02x->0x%02x: RECVSTATS %s"
|
||||
"(uid=0x%08x, dev=%d, in=%d, crc errs=%d, io errs=%d, nobuf errs=%d, handled=%d, missed=%d)\n",
|
||||
AQH_NodeMessage_GetSourceAddress(msg),
|
||||
AQH_NodeMessage_GetDestAddress(msg),
|
||||
sText,
|
||||
(unsigned int) AQH_RecvStatsMessage_GetUid(msg),
|
||||
AQH_RecvStatsMessage_GetInterface(msg),
|
||||
AQH_RecvStatsMessage_GetPacketsIn(msg),
|
||||
AQH_RecvStatsMessage_GetCrcErrors(msg),
|
||||
AQH_RecvStatsMessage_GetIoErrors(msg),
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
|
||||
AQHOME_API uint8_t AQH_RecvStatsMessage_GetInterface(const AQH_MESSAGE *msg);
|
||||
AQHOME_API uint32_t AQH_RecvStatsMessage_GetUid(const AQH_MESSAGE *msg);
|
||||
AQHOME_API uint16_t AQH_RecvStatsMessage_GetPacketsIn(const AQH_MESSAGE *msg);
|
||||
AQHOME_API uint16_t AQH_RecvStatsMessage_GetCrcErrors(const AQH_MESSAGE *msg);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
* This file is part of the project AqHome.
|
||||
* AqHome (c) by 2023 Martin Preuss, all rights reserved.
|
||||
* AqHome (c) by 2025 Martin Preuss, all rights reserved.
|
||||
*
|
||||
* The license for this file can be found in the file COPYING which you
|
||||
* should have received along with this file.
|
||||
@@ -19,9 +19,17 @@
|
||||
|
||||
|
||||
#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_OFFS_SENDSTATS_IFACE 4 /* 1 byte */
|
||||
#define AQH_MSG_OFFS_SENDSTATS_PACKETSOUT 5 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_SENDSTATS_COLLISIONS 7 /* 2 bytes */
|
||||
#define AQH_MSG_OFFS_SENDSTATS_BUSY 9 /* 2 bytes */
|
||||
|
||||
|
||||
|
||||
uint8_t AQH_SendStatsMessage_GetInterface(const AQH_MESSAGE *msg)
|
||||
{
|
||||
return AQH_Message_ReadUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_IFACE, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,11 +65,12 @@ void AQH_SendStatsMessage_DumpToBuffer(const AQH_MESSAGE *msg, GWEN_BUFFER *dbuf
|
||||
{
|
||||
if (msg)
|
||||
GWEN_Buffer_AppendArgs(dbuf,
|
||||
"0x%02x->0x%02x: SENDSTATS %s (uid=0x%08x, out=%d, collisions=%d, busy line=%d)\n",
|
||||
"0x%02x->0x%02x: SENDSTATS %s (uid=0x%08x, dev=%d, out=%d, collisions=%d, busy line=%d)\n",
|
||||
AQH_NodeMessage_GetSourceAddress(msg),
|
||||
AQH_NodeMessage_GetDestAddress(msg),
|
||||
sText,
|
||||
(unsigned int) AQH_SendStatsMessage_GetUid(msg),
|
||||
AQH_SendStatsMessage_GetInterface(msg),
|
||||
AQH_SendStatsMessage_GetPacketsOut(msg),
|
||||
AQH_SendStatsMessage_GetCollisions(msg),
|
||||
AQH_SendStatsMessage_GetBusyErrors(msg));
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
|
||||
AQHOME_API uint8_t AQH_SendStatsMessage_GetInterface(const AQH_MESSAGE *msg);
|
||||
AQHOME_API uint32_t AQH_SendStatsMessage_GetUid(const AQH_MESSAGE *msg);
|
||||
AQHOME_API uint16_t AQH_SendStatsMessage_GetPacketsOut(const AQH_MESSAGE *msg);
|
||||
AQHOME_API uint16_t AQH_SendStatsMessage_GetCollisions(const AQH_MESSAGE *msg);
|
||||
|
||||
Reference in New Issue
Block a user