Part 1
요약·해설
Command 0은 이름으로 statistics field map을 조회하고 command 1은 group 이름 목록을 반환합니다. SMP version별 error envelope도 함께 설명합니다.
2
Data · list
CONFIG_STATS
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
A47BE9FC59D90178F316815520D2BAEF3CFE34DDA2CE0651256AE9C3FF918B75
.. _mcumgr_smp_group_2:
Statistics management
#####################
Statistics management allows to obtain data gathered by Statistics subsystem
of Zephyr, enabled with :kconfig:option:`CONFIG_STATS`.
Statistics management group defines commands:
.. table::
:align: center
+-------------------+-----------------------------------------------+
| ``Command ID`` | Command description |
+===================+===============================================+
| ``0`` | Group data |
+-------------------+-----------------------------------------------+
| ``1`` | List groups |
+-------------------+-----------------------------------------------+
Statistics: group data
**********************
The command is used to obtain data for group specified by a name.
The name is one of group names as registered, with
:c:macro:`STATS_INIT_AND_REG` macro or :c:func:`stats_init_and_reg` function
call, within module that gathers the statistics.
Statistics: group data request
==============================
Statistics group data request header:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``0`` | ``2`` | ``0`` |
+--------+--------------+----------------+
CBOR data of request:
.. code-block:: none
{
(str)"name" : (str)
}
where:
.. table::
:align: center
+-----------------------+---------------------------------------------------+
| "name" | group name. |
+-----------------------+---------------------------------------------------+
Statistics: group data response
===============================
Statistics group data response header:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``1`` | ``2`` | ``0`` |
+--------+--------------+----------------+
CBOR data of successful response:
.. code-block:: none
{
(str)"name" : (str)
(str)"fields" : {
(str)<entry_name> : (uint)
...
}
}
In case of error the CBOR data takes the form:
.. tabs::
.. group-tab:: SMP version 2
.. code-block:: none
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}
.. group-tab:: SMP version 1 (and non-group SMP version 2)
.. code-block:: none
{
(str)"rc" : (int)
}
where:
.. table::
:align: center
+------------------+-------------------------------------------------------------------------+
| "name" | this is name of group the response contains data for. |
+------------------+-------------------------------------------------------------------------+
| "fields" | this is map of entries within groups that consists of pairs where the |
| | entry name is mapped to value it represents in statistics. |
+------------------+-------------------------------------------------------------------------+
| <entry_name> | single entry to value mapping; value is hardcoded to unsigned integer |
| | type, in a CBOR meaning. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "group" | :c:enum:`mcumgr_group_t` group of the group-based error code. Only |
| | appears if an error is returned when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "rc" | contains the index of the group-based error code. Only appears if |
| | non-zero (error condition) when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rc" | :c:enum:`mcumgr_err_t` only appears if non-zero (error condition) when |
| | using SMP version 1 or for SMP errors when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
Statistics: list of groups
**************************
The command is used to obtain list of groups of statistics that are gathered
on a device. This is a list of names as given to groups with
:c:macro:`STATS_INIT_AND_REG` macro or :c:func:`stats_init_and_reg` function
calls, within module that gathers the statistics; this means that this command
may be considered optional as it is known during compilation what groups will
be included into build and listing them is not needed prior to issuing a query.
Statistics: list of groups request
==================================
Statistics group list request header:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``0`` | ``2`` | ``1`` |
+--------+--------------+----------------+
The command sends an empty CBOR map as data.
Statistics: list of groups response
===================================
Statistics group list request header:
.. table::
:align: center
+--------+--------------+----------------+
| ``OP`` | ``Group ID`` | ``Command ID`` |
+========+==============+================+
| ``1`` | ``2`` | ``1`` |
+--------+--------------+----------------+
CBOR data of successful response:
.. code-block:: none
{
(str)"stat_list" : [
(str)<stat_group_name>, ...
]
}
In case of error the CBOR data takes the form:
.. tabs::
.. group-tab:: SMP version 2
.. code-block:: none
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}
.. group-tab:: SMP version 1 (and non-group SMP version 2)
.. code-block:: none
{
(str)"rc" : (int)
}
where:
.. table::
:align: center
+------------------+-------------------------------------------------------------------------+
| "stat_list" | array of strings representing group names; this array may be empty if |
| | there are no groups. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "group" | :c:enum:`mcumgr_group_t` group of the group-based error code. Only |
| | appears if an error is returned when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "err" -> "rc" | contains the index of the group-based error code. Only appears if |
| | non-zero (error condition) when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
| "rc" | :c:enum:`mcumgr_err_t` only appears if non-zero (error condition) when |
| | using SMP version 1 or for SMP errors when using SMP version 2. |
+------------------+-------------------------------------------------------------------------+
Part 3
한국어 전문 번역
Statistics management를 사용하면 Zephyr Statistics subsystem이 수집한 data를 가져올 수 있습니다. Statistics subsystem은 CONFIG_STATS로 활성화합니다.
Statistics management group은 다음 command를 정의합니다.
| Command ID | Command description |
|---|---|
| 0 | Group data |
| 1 | Group 목록 |
Statistics: group data
이 command는 name으로 지정한 group의 data를 가져옵니다. Name은 statistics를 모으는 module 안에서 STATS_INIT_AND_REG macro 또는 stats_init_and_reg() function call로 등록한 group name 중 하나입니다.
Statistics: group data request
Statistics group data request header는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 0 | 2 | 0 |
Request의 CBOR data는 다음과 같습니다.
{
(str)"name" : (str)
}
각 field의 의미는 다음과 같습니다.
name | Group name입니다. |
Statistics: group data response
Statistics group data response header는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 1 | 2 | 0 |
성공한 response의 CBOR data는 다음과 같습니다.
{
(str)"name" : (str)
(str)"fields" : {
(str)<entry_name> : (uint)
...
}
}
Error가 발생하면 CBOR data는 다음 형식입니다.
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}{
(str)"rc" : (int)
}Response field의 의미는 다음과 같습니다.
name | Response가 data를 담고 있는 group의 name입니다. |
fields | Group 안의 entry map입니다. 각 entry name이 그 statistics 값에 mapping됩니다. |
<entry_name> | Entry 하나와 값의 mapping입니다. 값은 CBOR 의미상 unsigned integer type으로 고정됩니다. |
err → group | Group 기반 error code의 mcumgr_group_t group입니다. SMP version 2를 사용하며 error가 반환될 때만 나타납니다. |
err → rc | Group 기반 error code의 index입니다. SMP version 2에서 값이 0이 아닌 error condition일 때만 나타납니다. |
rc | mcumgr_err_t입니다. SMP version 1에서 값이 0이 아닌 error condition일 때, 또는 SMP version 2에서 SMP error가 발생할 때만 나타납니다. |
Statistics: group 목록
이 command는 device에서 수집 중인 statistics group 목록을 가져옵니다. 목록에는 statistics 수집 module이 STATS_INIT_AND_REG macro 또는 stats_init_and_reg() function call에 지정한 group name이 들어갑니다.
어떤 group이 build에 포함되는지는 compile 시점에 이미 알 수 있으므로, query 전에 목록을 가져올 필요가 없다면 이 command는 선택 사항으로 볼 수 있습니다.
Statistics: group 목록 request
Statistics group list request header는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 0 | 2 | 1 |
이 command는 data로 빈 CBOR map을 보냅니다.
Statistics: group 목록 response
원문에서 Statistics group list request header라고 표기한 response header는 다음과 같습니다.
| OP | Group ID | Command ID |
|---|---|---|
| 1 | 2 | 1 |
성공한 response의 CBOR data는 다음과 같습니다.
{
(str)"stat_list" : [
(str)<stat_group_name>, ...
]
}
Error가 발생하면 CBOR data는 다음 형식입니다.
{
(str)"err" : {
(str)"group" : (uint)
(str)"rc" : (uint)
}
}{
(str)"rc" : (int)
}Response field의 의미는 다음과 같습니다.
stat_list | Group name을 나타내는 string array입니다. Group이 없으면 array가 비어 있을 수 있습니다. |
err → group | Group 기반 error code의 mcumgr_group_t group입니다. SMP version 2를 사용하며 error가 반환될 때만 나타납니다. |
err → rc | Group 기반 error code의 index입니다. SMP version 2에서 값이 0이 아닌 error condition일 때만 나타납니다. |
rc | mcumgr_err_t입니다. SMP version 1에서 값이 0이 아닌 error condition일 때, 또는 SMP version 2에서 SMP error가 발생할 때만 나타납니다. |
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.