Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

µC/TCP-IP maintains counters and statistics for a variety of expected or unexpected error conditions.  Some of these statistics are optional since they require additional code and memory when enabled, see Network Counters Configuration for further information about how to enable and disabled it.

Statistics

µC/TCP-IP maintains run-time statistics on interfaces and most µC/TCP-IP object pools. If desired, an application can thus query µC/TCP-IP to find out how many frames have been processed on a particular interface, transmit and receive performance metrics, buffer utilization and more. An application can also reset the statistic pools back to their initialization values via appropriate API .

Applications may choose to monitor statistics for various reasons. For example, examining buffer statistics allows you to better manage the memory usage. Typically, more buffers can be allocated than necessary and, by examining buffer usage statistics, adjustments can be made to reduce their number.

Network protocol and interface statistics are kept in an instance of a data structure named Net_StatCtrs. This variable may be viewed within a debugger or referenced externally by the application for run-time analysis.

Unlike network protocol statistics, object pool statistics have functions to get a copy of the specified statistic pool and functions for resetting the pools to their default values. These statistics are kept in a data structure called NET_STAT_POOL which can be declared by the application and used as a return variable from the statistics API functions.

The data structure is shown below:

NET_STAT_POOL_QTY  is a data type currently set to  CPU_INT16U  and thus contains a maximum count of 65535.

Access to buffer statistics is obtained via interface functions that the application can call (described in the next sections). Most likely, only the following variables in NET_STAT_POOL need to be examined, because the .Type member is configured at initialization time as NET_STAT_TYPE_POOL :

.EntriesAvail

This variable indicates how many buffers are available in the pool.

.EntriesUsed

This variable indicates how many buffers are currently used by the TCP/IP stack.

.EntriesUsedMax

This variable indicates the maximum number of buffers used since it was last reset.

.EntriesAllocatedCtr

This variable indicates the total number of times buffers were allocated (i.e., used by the TCP/IP stack).

.EntriesDeallocatedCtr

This variable indicates the total number of times buffers were returned back to the buffer pool.

 

In order to enable run-time statistics, must be enabled, see Network Counters Configuration.

Module pool statistics

You can query the following module to get usage statistics. It can help reduce memory usage and debugging issues regarding resources.

ModuleDescriptionFunction API or Variables
ARPARP Cache usage NetARP_CachePoolStatGet
IGMPIPv4 Multicast group statisticsNetIGMP_HostGrpPoolStat
NDPNDP Caches usageNetCache_AddrNDP_PoolStat
NetNDP_DestPoolStat
NetNDP_PrefixPoolStat
NetNDP_RouterPoolStat
BufferInterface's buffer usage

NetBuf_PoolStatGet
NetBuf_RxLargePoolStatGet
NetBuf_TxLargePoolStatGet
NetBuf_TxSmallPoolStatGet

IP connectionsIP connections pool usage NetConn_PoolStatGet
SocketSockets usage NetSock_PoolStatGet
TCPTCP connections usage NetTCP_ConnPoolStatGet
TimerTimer usage NetTmr_PoolStatGet()

Error Counters

µC/TCP-IP maintains run-time counters for tracking error conditions within the Network Protocol Stack. If desired, the application may view the error counters in order to debug run-time problems such as low memory conditions, slow performance, packet loss,  etc.

Network protocol error counters are kept in an instance of a data structure named Net_ErrCtrs. This variable may be viewed within a debugger or referenced externally by the application for run-time analysis (see net_ctr.h).

In order to enable run-time error counters, must be enabled, see Network Counters Configuration.

  • No labels