Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
stats.h File Reference

Statistics. More...

#include <stddef.h>
#include <zephyr/types.h>

Go to the source code of this file.

Data Structures

struct  stats_name_map
 
struct  stats_hdr
 

Macros

#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
 

Detailed Description

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.

Macro Definition Documentation

◆ STATS_CLEAR

#define STATS_CLEAR (   group__,
  var__ 
)

◆ STATS_INC

#define STATS_INC (   group__,
  var__ 
)

◆ STATS_INCN

#define STATS_INCN (   group__,
  var__,
  n__ 
)

◆ STATS_INIT_AND_REG

#define STATS_INIT_AND_REG (   group__,
  size__,
  name__ 
)    (0)

◆ STATS_NAME

#define STATS_NAME (   name__,
  entry__ 
)

◆ STATS_NAME_END

#define STATS_NAME_END (   name__)

◆ STATS_NAME_INIT_PARMS

#define STATS_NAME_INIT_PARMS (   name__)    NULL, 0

◆ STATS_NAME_START

#define STATS_NAME_START (   name__)

◆ STATS_RESET

#define STATS_RESET (   var__)

◆ STATS_SECT_DECL

#define STATS_SECT_DECL (   group__)     struct stats_ ## group__

Declares a stat group struct.

Parameters
group__The name to assign to the structure tag.

◆ STATS_SECT_END

#define STATS_SECT_END   }

Ends a stats group struct definition.

◆ STATS_SECT_ENTRY

#define STATS_SECT_ENTRY (   var__)

◆ STATS_SECT_ENTRY16

#define STATS_SECT_ENTRY16 (   var__)

◆ STATS_SECT_ENTRY32

#define STATS_SECT_ENTRY32 (   var__)

◆ STATS_SECT_ENTRY64

#define STATS_SECT_ENTRY64 (   var__)

◆ STATS_SECT_START

#define STATS_SECT_START (   group__)     STATS_SECT_DECL(group__) {

◆ STATS_SET

#define STATS_SET (   group__,
  var__ 
)

◆ STATS_SIZE_INIT_PARMS

#define STATS_SIZE_INIT_PARMS (   group__,
  size__ 
)