This is the documentation for the latest (master) development branch of Zephyr. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

Network Statistics


Network statistics are collected if CONFIG_NET_STATISTICS is set. Individual component statistics for IPv4 or IPv6 can be turned off if those statistics are not needed. See various options in subsys/net/ip/Kconfig.stats file for details.

By default, the system collects network statistics per network interface. This can be controlled by CONFIG_NET_STATISTICS_PER_INTERFACE option.

The CONFIG_NET_STATISTICS_USER_API option can be set if the application wants to collect statistics for further processing. The network management interface API is used for that. See Network Management for details.

The CONFIG_NET_STATISTICS_ETHERNET option can be set to collect generic Ethernet statistics. If the CONFIG_NET_STATISTICS_ETHERNET_VENDOR option is set, then Ethernet device driver can collect Ethernet device specific statistics. These statistics can then be transferred to application for processing.

If the CONFIG_NET_SHELL option is set, then network shell can show statistics information with net stats command.

API Reference

group net_stats

Network statistics library.


typedef net_stats_t

Network statistics counter.

struct net_stats_bytes
#include <net_stats.h>

Number of bytes sent and received.

struct net_stats_pkts
#include <net_stats.h>

Number of network packets sent and received.

struct net_stats_ip
#include <net_stats.h>

IP layer statistics.

struct net_stats_ip_errors
#include <net_stats.h>

IP layer error statistics.

struct net_stats_icmp
#include <net_stats.h>

ICMP statistics.

struct net_stats_tcp
#include <net_stats.h>

TCP statistics.

struct net_stats_udp
#include <net_stats.h>

UDP statistics.

struct net_stats_ipv6_nd
#include <net_stats.h>

IPv6 neighbor discovery statistics.

struct net_stats_ipv6_mld
#include <net_stats.h>

IPv6 multicast listener daemon statistics.

struct net_stats_tx_time
#include <net_stats.h>

Network packet transfer times for calculating average TX time.

struct net_stats_rx_time
#include <net_stats.h>

Network packet receive times for calculating average RX time.

struct net_stats_tc
#include <net_stats.h>

Traffic class statistics.

struct net_stats_pm
#include <net_stats.h>

Power management statistics.

struct net_stats
#include <net_stats.h>

All network statistics in one struct.

struct net_stats_eth_errors
#include <net_stats.h>

Ethernet error statistics.

struct net_stats_eth_flow
#include <net_stats.h>

Ethernet flow control statistics.

struct net_stats_eth_csum
#include <net_stats.h>

Ethernet checksum statistics.

struct net_stats_eth_hw_timestamp
#include <net_stats.h>

Ethernet hardware timestamp statistics.

struct net_stats_eth
#include <net_stats.h>

All Ethernet specific statistics.

struct net_stats_ppp
#include <net_stats.h>

All PPP specific statistics.