|
#define | STATS_SECT_DECL(group__) struct stats_ ## group__ |
| Declares a stat group struct.
|
|
#define | STATS_SECT_END } |
| Ends a stats group struct definition.
|
|
#define | STATS_SECT_START(group__) STATS_SECT_DECL(group__) { |
|
#define | STATS_SECT_ENTRY(var__) |
|
#define | STATS_SECT_ENTRY16(var__) |
|
#define | STATS_SECT_ENTRY32(var__) |
|
#define | STATS_SECT_ENTRY64(var__) |
|
#define | STATS_RESET(var__) |
|
#define | STATS_SIZE_INIT_PARMS(group__, size__) |
|
#define | STATS_INCN(group__, var__, n__) |
|
#define | STATS_INC(group__, var__) |
|
#define | STATS_SET(group__, var__) |
|
#define | STATS_CLEAR(group__, var__) |
|
#define | STATS_INIT_AND_REG(group__, size__, name__) (0) |
|
#define | STATS_NAME_START(name__) |
|
#define | STATS_NAME(name__, entry__) |
|
#define | STATS_NAME_END(name__) |
|
#define | STATS_NAME_INIT_PARMS(name__) NULL, 0 |
|
Statistics.
Statistics are per-module event counters for troubleshooting, maintenance, and usage monitoring. Statistics are organized into named "groups", with each group consisting of a set of "entries". An entry corresponds to an individual counter. Each entry can optionally be named if the STATS_NAMES setting is enabled. Statistics can be retrieved with the mcumgr management subsystem.
There are two, largely duplicated, statistics sections here, in order to provide the optional ability to name statistics.
STATS_SECT_START/END actually declare the statistics structure definition, STATS_SECT_DECL() creates the structure declaration so you can declare these statistics as a global structure, and STATS_NAME_START/END are how you name the statistics themselves.
Statistics entries can be declared as any of several integer types. However, all statistics in a given structure must be of the same size, and they are all unsigned.
Following the static entry declaration is the statistic names declaration. This is compiled out when the CONFIGURE_STATS_NAME setting is undefined.
When CONFIG_STATS_NAMES is defined, the statistics names are stored and returned to the management APIs. When the setting is undefined, temporary names are generated as needed with the following format:
s<stat-idx>
E.g., "s0", "s1", etc.