zephyr/samples/net/stats
Alberto Escolar Piedras d0f554dd6a docs: networing: Replace references to native_posix w native_sim
Let's replace the references to native_posix with native_sim.

Background: during this release native_sim is replacing
native_posix as the main host test/development platform.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-15 10:03:17 +01:00
..
src samples, tests, boards: Switch main return type from void to int 2023-04-14 07:49:41 +09:00
CMakeLists.txt cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
Kconfig kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
prj.conf samples: net: Remove net-app based sample applications 2019-02-01 12:29:21 +02:00
README.rst docs: networing: Replace references to native_posix w native_sim 2023-11-15 10:03:17 +01:00
sample.yaml tests: cleanup metadata and filtering 2023-06-13 09:38:27 -04:00

.. zephyr:code-sample:: net-stats
   :name: Network statistics
   :relevant-api: net_stats

   Query and display network statistics from a user application.

Overview
********

This sample shows how to query (and display) network statistics from a user
application.

The source code for this sample application can be found at:
:zephyr_file:`samples/net/stats`.

Requirements
************

- :ref:`networking_with_host`

Building and Running
********************

A good way to run this sample application is with QEMU or native_sim board
as described in :ref:`networking_with_host`.

Follow these steps to build the network statistics sample application:

.. zephyr-app-commands::
   :zephyr-app: samples/net/stats
   :board: <board to use>
   :conf: prj.conf
   :goals: build
   :compact:

If everything is configured correctly, the application will periodically print
current network statistics to the console.

.. code-block:: console

    Global network statistics
    IPv6 recv      27	sent	8	drop	0	forwarded	0
    IPv6 ND recv   2	sent	5	drop	2
    IPv6 MLD recv  0	sent	3	drop	0
    IPv4 recv      20	sent	0	drop	20	forwarded	0
    IP vhlerr      0	hblener	0	lblener	0
    IP fragerr     0	chkerr	0	protoer	0
    ICMP recv      15	sent	3	drop	13
    ICMP typeer    0	chkerr	0
    UDP recv       0	sent	0	drop	30
    UDP chkerr     0
    TCP bytes recv 0	sent	0
    TCP seg recv   0	sent	0	drop	0
    TCP seg resent 0	chkerr	0	ackerr	0
    TCP seg rsterr 0	rst	0	re-xmit	0
    TCP conn drop  0	connrst	0
    Bytes received 7056
    Bytes sent     564
    Processing err 1