Statistics
GOAL files:
goal_stat.[h,c]
example:
…\goal\appl\00410_goal\eth_stats
GOAL provides the possibility to track statistics. Primarily this is used for Ethernet to propagate statistics and to analyse communication problems. GOAL provides the following typical Ethernet statistics for each port:
Table: provided Ethernet statistics by GOAL
GOAL number of Ethernet statistic | Description | ||
---|---|---|---|
GOAL ID | Number | Identifier | |
GOAL_ID_ETH | 1 | GOAL_STAT_ID_ETH_TOTAL_DISC | number of total discarded frames |
GOAL_ID_ETH | 2 | GOAL_STAT_ID_ETH_TOTAL_BYTE_DISC | number of total discarded bytes |
GOAL_ID_ETH | 3 | GOAL_STAT_ID_ETH_TOTAL_FRAMES | number of total processed frames |
GOAL_ID_ETH | 4 | GOAL_STAT_ID_ETH_TOTAL_BYTE_FRAMES | number of total processed bytes |
GOAL_ID_ETH | 5 | GOAL_STAT_ID_ETH_ODISC | number of discarded outgoing frames |
GOAL_ID_ETH | 6 | GOAL_STAT_ID_ETH_IDISC_VLAN | number of discarded wrong or missing VLAN-IDs |
GOAL_ID_ETH | 7 | GOAL_STAT_ID_ETH_IDISC_UNTAGGED | number of discarded missing VLAN tags |
GOAL_ID_ETH | 8 | GOAL_STAT_ID_ETH_IDISC_BLOCK | number of discarded due to blocking mode |
GOAL_ID_ETH | 9 | GOAL_STAT_ID_ETH_LEARN_CNT | number of learned MAC addresses |
GOAL_ID_ETH | 10 | GOAL_STAT_ID_ETH_AFRAMES_RECEIVED_OK | number of received valid frames including pause |
GOAL_ID_ETH | 11 | GOAL_STAT_ID_ETH_AFRAMES_CRC_ERRORS | number of received frames with CRC errors |
GOAL_ID_ETH | 12 | GOAL_STAT_ID_ETH_AALIGNMENT_ERRORS | number of received frames with alignment errors |
GOAL_ID_ETH | 13 | GOAL_STAT_ID_ETH_AOCTETS_TRANSM_OK | number of transmitted valid octets |
GOAL_ID_ETH | 14 | GOAL_STAT_ID_ETH_ATX_PAUSE_CTRL_FRAMES | number of received valid octets |
GOAL_ID_ETH | 15 | GOAL_STAT_ID_ETH_ATX_PAUSE_CTRL_FRAMES | number of transmitted pause frames |
GOAL_ID_ETH | 16 | GOAL_STAT_ID_ETH_ARX_PAUSE_CTRL_FRAMES | number of received pause frames |
GOAL_ID_ETH | 17 | GOAL_STAT_ID_ETH_IFIN_ERRORS | number of received errors |
GOAL_ID_ETH | 18 | GOAL_STAT_ID_ETH_IFOUT_ERRORS | number of transmit errors |
GOAL_ID_ETH | 19 | GOAL_STAT_ID_ETH_IFIN_UCAST_PKTS | number of received unicast frames |
GOAL_ID_ETH | 20 | GOAL_STAT_ID_ETH_IFIN_MCAST_PKTS | number of received multicast frames |
GOAL_ID_ETH | 21 | GOAL_STAT_ID_ETH_IFIN_BCAST_PKTS | number of received broadcast frames |
GOAL_ID_ETH | 22 | GOAL_STAT_ID_ETH_IFOUT_DISC | number of discarded transmitted frames |
GOAL_ID_ETH | 23 | GOAL_STAT_ID_ETH_IFOUT_UCASR_PKTS | number of transmitted unicast frames |
GOAL_ID_ETH | 24 | GOAL_STAT_ID_ETH_IFOUT_MCAST_PKTS | number of transmitted multicast frames |
GOAL_ID_ETH | 25 | GOAL_STAT_ID_ETH_IFOUT_BCAST_PKTS | number of transmitted broadcast frames |
GOAL_ID_ETH | 26 | GOAL_STAT_ID_ETH_ETHERSTATS_OCTETS | number of all bytes (good and bad) |
GOAL_ID_ETH | 27 | GOAL_STAT_ID_ETH_ETHERSTATS_PKTS | number of all frames (good and bad) |
GOAL_ID_ETH | 28 | GOAL_STAT_ID_ETH_ETHERSTATS_UNDERSIZE | number of frames too short |
GOAL_ID_ETH | 29 | GOAL_STAT_ID_ETH_ETHERSTATS_OVERSIZE | number of frame too long |
GOAL_ID_ETH | 30 | GOAL_STAT_ID_ETH_ETHERSTATS_PKTS64 | number of frames with size of 64 bytes |
GOAL_ID_ETH | 3 | GOAL_STAT_ID_ETH_ETHERSTATS_PKTS65TO127 | number of frames with size of 65-127 bytes |
GOAL_ID_ETH | 32 | GOAL_STAT_ID_ETH_ETHERSTATS_PKTS128TO255 | number of frames with size of 128-255 bytes |
GOAL_ID_ETH | 33 | GOAL_STAT_ID_ETH_ETHERSTATS_PKTS256TO511 | number of frames with size of 256-511 bytes |
GOAL_ID_ETH | 34 | GOAL_STAT_ID_ETH_ETHERSTATS_PKTS512TO1023 | number of frames with size of 512-1023 bytes |
GOAL_ID_ETH | 35 | GOAL_STAT_ID_ETH_ETHERSTATS_PKT1024TO1518 | number of frames with size of 1024-1518 bytes |
GOAL_ID_ETH | 36 | GOAL_STAT_ID_ETH_ETHERSTATS_PKTS1519TOX | number of frames with size >= 1519 bytes |
GOAL_ID_ETH | 37 | GOAL_STAT_ID_ETH_ETHERSTATS_JABBERS | number of jabbers |
GOAL_ID_ETH | 38 | GOAL_STAT_ID_ETH_ETHERSTATS_FRAGS | number of fragments |
GOAL_ID_ETH | 39 | GOAL_STAT_ID_ETH_VLAN_RECV_OK | number of received valid VLANs |
GOAL_ID_ETH | 40 | GOAL_STAT_ID_ETH_VLAN_TRANS_OK | number of transmitted valid VLANs |
GOAL_ID_ETH | 41 | GOAL_STAT_ID_ETH_FRAMES_RETRANS | number of retransmitted collision frames |
GOAL_ID_ETH | 42 | GOAL_STAT_ID_ETH_ADEFERRED | number of deferred at begin |
GOAL_ID_ETH | 43 | GOAL_STAT_ID_ETH_AMULTIPLE_COLL | number of frames transmitted after multiple collisions |
GOAL_ID_ETH | 44 | GOAL_STAT_ID_ETH_ASINGLE_COLL | number of frames transmitted after single collisions |
GOAL_ID_ETH | 45 | GOAL_STAT_ID_ETH_ALATE_COLL | number of too late collisions |
GOAL_ID_ETH | 46 | GOAL_STAT_ID_ETH_AEXCESS_COLL | number of frames discarded due to 16 consecutive collisions |
GOAL_ID_ETH | 47 | GOAL_STAT_ID_ETH_ACARR_SENSE_ERR | number of PHY carrier sense errors |
GOAL_ID_ETH | 48 | GOAL_STAT_ID_ETH_IFIN_DISC | number of discarded received frames |
GOAL_ID_ETH | 49 | GOAL_STAT_ID_ETH_IFIN_UNKNOWN_PROTO | number of received unknown protocols |
GOAL_ID_ETH | 50 | GOAL_STAT_ID_ETH_SQE_ERR | number of SQE test errors |
GOAL_ID_ETH | 51 | GOAL_STAT_ID_ETH_MAC_TX_ERR | number of internal MAC Tx errors |
GOAL_ID_ETH | 52 | GOAL_STAT_ID_ETH_MAC_RX_ERR | number of internal MAC Rx errors |
GOAL_ID_ETH | 53 | GOAL_STAT_ID_ETH_SYMBOL_ERR | number of symbol errors |
Access
GOAL statistics are disabled by default but can be enabled by adding following defines to goal_config.h.
Code: Defines for enabling GOAL statistics
#define GOAL_CONFIG_STATS 1 /**< enables GOAL statistics */
#define GOAL_CONFIG_ETH_STATS 1 /**< enables GOAL Ethernet statistics */
#define GOAL_CONFIG_STATS_NAME 1 /**< [optional] enables goal_statNameGetById to get name of the statistics as string */
Code: Read a statistics value
/* get received octets from port 0 */
res = goal_statValGetById(&val, GOAL_ID_ETH, GOAL_STAT_ID_ETH_IFOUTOCTETS, 0);
if (GOAL_RES_ERR(res)) {
goal_logErr("failed to retrieve statistics counter");
return;
}
Code: Reset a statistics value
res = goal_statResetById(GOAL_ID_ETH, GOAL_STAT_ID_ETH_IFOUTOCTETS, 0);
if (GOAL_RES_ERR(res)) {
goal_logErr("failed to reset statistics counter");
return;
}
Ethernet statistics
Each platform manages the support of the Ethernet statistics listed in Table 4 for the ID GOAL_ID_ETH
by a bit-coded mask of the GOAL data type uint64_t
. Bit 0 of the mask represents the Ethernet statistic with the GOAL number 0.
The access to the statistic values are realized about the Ethernet commands:
GOAL_ETH_CMD_STATS_MASK_GET
: read the supported Ethernet statistics from the platform as bit-coded mask for all Ethernet portGOAL_ETH_CMD_STATS_GET
: read the values of all supported Ethernet statistics for one Ethernet portGOAL_ETH_CMD_STATS_RST
: reset Ethernet statistics for Ethernet ports; it is platform-specific which statistics of one or all Ethernet ports are reset
The Ethernet commands are executed by function goal_miEthCmd()
.
If the compiler-define GOAL_CONFIG_ETH_STATS_NAMES
is set to 1, a short description for each Ethernet statistic is available in code by function goal_miEthStatsNameGet()
.
example:
…\goal\appl\00410_goal\eth_stats