Micrium OS Network collects run-time statistics, error counters and buffer usage information that are optional during compile-time since they require additional code and memory.
Application developers may want to analyze these run-time metrics for various reasons:
The protocol statistics allow you to verify the performance of your network application by looking at reception and transmission speeds.
Error counters allow you to debug run-time problems such as low memory conditions, slow performance and packet loss.
The buffer statistics allows you to optimize the memory usage and since the examples in Simplicity Studio are configured for general purpose and may have more buffers than necessary, these metrics can help you optimize the memory usage for your specific application needs.
The sockets list screen allows you to see the state of your incoming and outgoing network connections, including the IP addresses, port numbers and the protocol.
To enable run-time statistics within Micrium OS Network a few macros need to be defined to DEF_ENABLED as follows.
These statistics are related to the network protocol and interfaces. You may want to analyze statistics counters to verify the performance of your network application on a per interface basis. To enable them, edit the file net_cfg.h and set the following macros to DEF_ENABLED as shown below:
#define NET_CTR_CFG_STAT_EN DEF_ENABLED
Micrium OS Network maintains run-time counters for tracking error conditions within the Network Protocol Stack. You may want to analyze error counters to debug runtime problems such as low memory conditions, slow performance and packet loss. To enable them, edit the file net_cfg.h and set the following macros to DEF_ENABLED as shown below:
#define NET_CTR_CFG_ERR_EN DEF_ENABLED
These statistics are related to data buffers. You may want to analyze these statistics to optimize the memory usage of your network application. To enable them, edit the file net_cfg.h and set the following macros to DEF_ENABLED as shown below:
#define NET_STAT_POOL_BUF_EN DEF_ENABLED #define NET_STAT_POOL_ARP_EN DEF_ENABLED #define NET_STAT_POOL_NDP_EN DEF_ENABLED #define NET_STAT_POOL_IGMP_EN DEF_ENABLED #define NET_STAT_POOL_MLDP_EN DEF_ENABLED #define NET_STAT_POOL_TMR_EN DEF_ENABLED #define NET_STAT_POOL_SOCK_EN DEF_ENABLED #define NET_STAT_POOL_CONN_EN DEF_ENABLED #define NET_STAT_POOL_TCP_CONN_EN DEF_ENABLED
#define NET_MCAST_CFG_IPv4_RX_EN DEF_ENABLED
To access these run-time statistics, you can either watch the arrays and variables from your IDE's watch window or call some APIs from your application. However, that quickly proves to be impractical. Instead, you can use uC/Probe, a tool that is integrated in Simplicity Studio that allows you to watch these statistics live in a series of pre-built screens as shown in the following image:
uC/Probe can be installed and integrated in Simplicity Studio by following the next steps:
To open uC/Probe launch a Debug Session for your project and press the button uC/Probe located on the top toolbar of Simplicity Studio as shown below:
Typically uC/Probe will launch and open your project’s ELF file in the Symbol Browser as shown in the image below:
However, if the Symbol Browser is empty, then you need to press the button ELF and locate your project’s output file typically located in your toolchain’s output folder. For example:
uC/Probe is a Windows tool that lets you associate a virtual indicator and/or control to any of your embedded application’s global variables, and then display the variables values live in a dashboard.
However, for the run-time statics maintained by the Micrium OS Network stack, a series of screens are already designed and configured to display said statistics.
To include the screens, follow the next steps:
To start watching the run-time statistics live, ensure that your embedded application is running and press the button Run located on the top toolbar of uC/Probe as shown in the following image:
To ensure the highest level of performance possible, it makes sense to start your Micrium OS Network based application by defining as many buffers as possible and then use uC/Probe and its interface and pool statistics data screens in order to refine the number after having run the application for a while. For example, a busy network will require more receive buffers in order to handle the additional messages that will be received.