connectivity/networking/net_pkt_processing_stats.html · connectivity/networking/net_pkt_processing_stats.rst 공식 원문 ↗

Zephyr 3.7.0 · Connectivity · Performance

Network Packet Processing Statistics

Packet 생성부터 queue·thread·socket·application까지 단계별 처리 시간을 microsecond 단위로 측정합니다.

Official pathconnectivity/networking/net_pkt_processing_stats.html
Source fileconnectivity/networking/net_pkt_processing_stats.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

기본 평균 timing과 상세 state transition timing을 구분하고 TX·RX 측정값의 해석 방법을 설명합니다.

TX

Create → Queue → Send

RX

Driver → Queue → App

Detail

Per-state · Per-class

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 51A0A05ED582D072C4402094FE55E368C11F0C6B9A1428563F3B8855157FC7B4
.. _net_pkt_processing_stats:

Network Packet Processing Statistics
####################################

.. contents::
    :local:
    :depth: 2

This page describes how to get information about network packet processing
statistics inside network stack.

Network stack contains infrastructure to figure out how long the network packet
processing takes either in sending or receiving path. There are two Kconfig
options that control this. For transmit (TX) path the option is called
:kconfig:option:`CONFIG_NET_PKT_TXTIME_STATS` and for receive (RX) path the options is
called :kconfig:option:`CONFIG_NET_PKT_RXTIME_STATS`. Note that for TX, all kind of
network packet statistics is collected. For RX, only UDP, TCP or raw packet
type network packet statistics is collected.

After enabling these options, the :ref:`net stats <net_shell>` network shell
command will show this information:

.. code-block:: console

   Avg TX net_pkt (11484) time 67 us
   Avg RX net_pkt (11474) time 43 us

.. note::

   The values above and below are from emulated qemu_x86 board and UDP traffic

The TX time tells how long it took for network packet from its creation to
when it was sent to the network. The RX time tells the time from its creation
to when it was passed to the application. The values are in microseconds. The
statistics will be collected per traffic class if there are more than one
transmit or receive queues defined in the system. These are controlled by
:kconfig:option:`CONFIG_NET_TC_TX_COUNT` and :kconfig:option:`CONFIG_NET_TC_RX_COUNT` options.

If you enable :kconfig:option:`CONFIG_NET_PKT_TXTIME_STATS_DETAIL` or
:kconfig:option:`CONFIG_NET_PKT_RXTIME_STATS_DETAIL` options, then additional
information for TX or RX network packets are collected when the network packet
traverses the IP stack.

After enabling these options, the :ref:`net stats <net_shell>` will show
this information:

.. code-block:: console

   Avg TX net_pkt (18902) time 63 us    [0->22->15->23=60 us]
   Avg RX net_pkt (18892) time 42 us    [0->9->6->11->13=39 us]

The numbers inside the brackets contain information how many microseconds it
took for a network packet to go from previous state to next.

In the TX example above, the values are averages over **18902** packets and
contain this information:

* Packet was created by application so the time is **0**.
* Packet is about to be placed to transmit queue. The time it took from network
  packet creation to this state, is **22** microseconds in this example.
* The correct TX thread is invoked, and the packet is read from the transmit
  queue. It took **15** microseconds from previous state.
* The network packet was just sent and the network stack is about to free the
  network packet. It took **23** microseconds from previous state.
* In total it took on average **60** microseconds to get the network packet
  sent. The value **63** tells also the same information, but is calculated
  differently so there is slight difference because of rounding errors.

In the RX example above, the values are averages over **18892** packets and
contain this information:

* Packet was created network device driver so the time is **0**.
* Packet is about to be placed to receive queue. The time it took from network
  packet creation to this state, is **9** microseconds in this example.
* The correct RX thread is invoked, and the packet is read from the receive
  queue. It took **6** microseconds from previous state.
* The network packet is then processed and placed to correct socket queue.
  It took **11** microseconds from previous state.
* The last value tells how long it took from there to the application. Here
  the value is **13** microseconds.
* In total it took on average **39** microseconds to get the network packet
  sent. The value **42** tells also the same information, but is calculated
  differently so there is slight difference because of rounding errors.

Part 3

한국어 전문 번역

Network Packet Processing Statistics

이 문서는 network stack 내부에서 network packet 처리 statistic을 확인하는 방법을 설명합니다.

Network stack에는 송신 또는 수신 path의 network packet 처리 시간을 측정하는 infrastructure가 있습니다. TX path는 CONFIG_NET_PKT_TXTIME_STATS, RX path는 CONFIG_NET_PKT_RXTIME_STATS Kconfig option으로 제어합니다.

TX에서는 모든 종류의 network packet statistic을 수집합니다. RX에서는 UDP, TCP 또는 raw packet type의 network packet statistic만 수집합니다.

이 option을 활성화하면 network shell의 net stats command에 다음 정보가 표시됩니다.

Avg TX net_pkt (11484) time 67 us
Avg RX net_pkt (11474) time 43 us

TX time은 network packet을 생성한 시점부터 network로 송신한 시점까지 걸린 시간입니다. RX time은 packet을 생성한 시점부터 application에 전달한 시점까지의 시간입니다. 단위는 microsecond입니다.

System에 TX 또는 RX queue가 둘 이상 정의돼 있으면 traffic class별로 statistic을 수집합니다. Queue 수는 CONFIG_NET_TC_TX_COUNT와 CONFIG_NET_TC_RX_COUNT가 제어합니다.

CONFIG_NET_PKT_TXTIME_STATS_DETAIL 또는 CONFIG_NET_PKT_RXTIME_STATS_DETAIL을 활성화하면 packet이 IP stack을 통과하는 동안 TX 또는 RX packet의 추가 timing 정보를 수집합니다.

이 option을 켠 뒤 net stats는 다음처럼 상세 정보를 보여 줍니다.

Avg TX net_pkt (18902) time 63 us    [0->22->15->23=60 us]
Avg RX net_pkt (18892) time 42 us    [0->9->6->11->13=39 us]

대괄호 안 숫자는 network packet이 이전 state에서 다음 state로 이동하는 데 걸린 microsecond를 나타냅니다.

위 TX 예는 18,902개 packet의 평균이며 다음 단계를 뜻합니다.

  • Application이 packet을 생성한 시점이므로 시간은 0입니다.
  • Packet을 TX queue에 넣기 직전까지 생성 시점에서 22 microsecond가 걸렸습니다.
  • 올바른 TX thread가 실행돼 TX queue에서 packet을 읽는 데 이전 state부터 15 microsecond가 걸렸습니다.
  • Packet 송신 직후 network stack이 packet을 해제하려는 시점까지 이전 state에서 23 microsecond가 걸렸습니다.
  • 총 평균은 60 microsecond입니다. 별도 방식으로 계산한 전체값 63은 rounding error 때문에 조금 다릅니다.

위 RX 예는 18,892개 packet의 평균이며 다음 단계를 뜻합니다.

  • Network device driver가 packet을 생성한 시점이므로 시간은 0입니다.
  • Packet을 RX queue에 넣기 직전까지 생성 시점에서 9 microsecond가 걸렸습니다.
  • 올바른 RX thread가 실행돼 RX queue에서 packet을 읽는 데 이전 state부터 6 microsecond가 걸렸습니다.
  • Packet을 처리해 올바른 socket queue에 넣는 데 이전 state부터 11 microsecond가 걸렸습니다.
  • 그 지점부터 application까지 전달하는 데 13 microsecond가 걸렸습니다.
  • 총 평균은 39 microsecond입니다. 별도 방식으로 계산한 전체값 42는 rounding error 때문에 조금 다릅니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.