Zephyr API Documentation
3.0.0
A Scalable Open Source RTOS
3.0.0
Toggle main menu visibility
Main Page
Related Pages
Modules
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
stats.h
Go to the documentation of this file.
1
/*
2
* Copyright Runtime.io 2018. All rights reserved.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
51
#ifndef ZEPHYR_INCLUDE_STATS_STATS_H_
52
#define ZEPHYR_INCLUDE_STATS_STATS_H_
53
54
#include <stddef.h>
55
#include <
zephyr/types.h
>
56
57
#ifdef __cplusplus
58
extern
"C"
{
59
#endif
60
61
struct
stats_name_map
{
62
uint16_t
snm_off
;
63
const
char
*
snm_name
;
64
} __attribute__((packed));
65
66
struct
stats_hdr
{
67
const
char
*
s_name
;
68
uint8_t
s_size
;
69
uint16_t
s_cnt
;
70
uint8_t
s_pad1
;
71
#ifdef CONFIG_STATS_NAMES
72
const
struct
stats_name_map
*s_map;
73
int
s_map_cnt;
74
#endif
75
struct
stats_hdr
*
s_next
;
76
};
77
83
#define STATS_SECT_DECL(group__) \
84
struct stats_ ## group__
85
89
#define STATS_SECT_END }
90
91
/* The following macros depend on whether CONFIG_STATS is defined. If it is
92
* not defined, then invocations of these macros get compiled out.
93
*/
94
#ifdef CONFIG_STATS
95
101
#define STATS_SECT_START(group__) \
102
STATS_SECT_DECL(group__) { \
103
struct stats_hdr s_hdr;
104
110
#define STATS_SECT_ENTRY(var__) uint32_t var__;
111
117
#define STATS_SECT_ENTRY16(var__) uint16_t var__;
118
124
#define STATS_SECT_ENTRY32(var__) uint32_t var__;
125
131
#define STATS_SECT_ENTRY64(var__) uint64_t var__;
132
143
#define STATS_INCN(group__, var__, n__) \
144
((group__).var__ += (n__))
145
155
#define STATS_INC(group__, var__) \
156
STATS_INCN(group__, var__, 1)
157
168
#define STATS_SET(group__, var__, n__) \
169
((group__).var__ = (n__))
170
180
#define STATS_CLEAR(group__, var__) \
181
((group__).var__ = 0)
182
183
#define STATS_SIZE_16 (sizeof(uint16_t))
184
#define STATS_SIZE_32 (sizeof(uint32_t))
185
#define STATS_SIZE_64 (sizeof(uint64_t))
186
187
#define STATS_SIZE_INIT_PARMS(group__, size__) \
188
(size__), \
189
((sizeof(group__)) - sizeof(struct stats_hdr)) / (size__)
190
205
#define STATS_INIT_AND_REG(group__, size__, name__) \
206
stats_init_and_reg( \
207
&(group__).s_hdr, \
208
(size__), \
209
(sizeof(group__) - sizeof(struct stats_hdr)) / (size__), \
210
STATS_NAME_INIT_PARMS(group__), \
211
(name__))
212
230
void
stats_init(
struct
stats_hdr
*shdr,
uint8_t
size,
uint16_t
cnt,
231
const
struct
stats_name_map
*
map
,
uint16_t
map_cnt);
232
245
int
stats_register(
const
char
*name,
struct
stats_hdr
*shdr);
246
271
int
stats_init_and_reg(
struct
stats_hdr
*hdr,
uint8_t
size,
uint16_t
cnt,
272
const
struct
stats_name_map
*
map
,
uint16_t
map_cnt,
273
const
char
*name);
274
280
void
stats_reset(
struct
stats_hdr
*shdr);
281
294
typedef
int
stats_walk_fn(
struct
stats_hdr
*hdr,
void
*arg,
295
const
char
*name,
uint16_t
off
);
296
307
int
stats_walk(
struct
stats_hdr
*hdr, stats_walk_fn *walk_cb,
void
*arg);
308
318
typedef
int
stats_group_walk_fn(
struct
stats_hdr
*hdr,
void
*arg);
319
329
int
stats_group_walk(stats_group_walk_fn *walk_cb,
void
*arg);
330
340
struct
stats_hdr
*stats_group_get_next(
const
struct
stats_hdr
*
cur
);
341
350
struct
stats_hdr
*stats_group_find(
const
char
*name);
351
352
#else
/* CONFIG_STATS */
353
354
#define STATS_SECT_START(group__) \
355
STATS_SECT_DECL(group__) {
356
357
#define STATS_SECT_ENTRY(var__)
358
#define STATS_SECT_ENTRY16(var__)
359
#define STATS_SECT_ENTRY32(var__)
360
#define STATS_SECT_ENTRY64(var__)
361
#define STATS_RESET(var__)
362
#define STATS_SIZE_INIT_PARMS(group__, size__)
363
#define STATS_INCN(group__, var__, n__)
364
#define STATS_INC(group__, var__)
365
#define STATS_SET(group__, var__)
366
#define STATS_CLEAR(group__, var__)
367
#define STATS_INIT_AND_REG(group__, size__, name__) (0)
368
369
#endif
/* !CONFIG_STATS */
370
371
#ifdef CONFIG_STATS_NAMES
372
373
#define STATS_NAME_MAP_NAME(sectname__) stats_map_ ## sectname__
374
375
#define STATS_NAME_START(sectname__) \
376
static const struct stats_name_map STATS_NAME_MAP_NAME(sectname__)[] = {
377
378
#define STATS_NAME(sectname__, entry__) \
379
{ offsetof(STATS_SECT_DECL(sectname__), entry__), #entry__ },
380
381
#define STATS_NAME_END(sectname__) }
382
383
#define STATS_NAME_INIT_PARMS(name__) \
384
&(STATS_NAME_MAP_NAME(name__)[0]), \
385
(sizeof(STATS_NAME_MAP_NAME(name__)) / sizeof(struct stats_name_map))
386
387
#else
/* CONFIG_STATS_NAMES */
388
389
#define STATS_NAME_START(name__)
390
#define STATS_NAME(name__, entry__)
391
#define STATS_NAME_END(name__)
392
#define STATS_NAME_INIT_PARMS(name__) NULL, 0
393
394
#endif
/* CONFIG_STATS_NAMES */
395
396
#ifdef __cplusplus
397
}
398
#endif
399
400
#endif
/* ZEPHYR_INCLUDE_STATS_STATS_H_ */
off
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa off
Definition:
asm-macro-32-bit-gnu.h:17
types.h
map
static struct @214 map[(3)]
uint8_t
__UINT8_TYPE__ uint8_t
Definition:
stdint.h:58
uint16_t
__UINT16_TYPE__ uint16_t
Definition:
stdint.h:59
stats_hdr
Definition:
stats.h:66
stats_hdr::s_size
uint8_t s_size
Definition:
stats.h:68
stats_hdr::s_cnt
uint16_t s_cnt
Definition:
stats.h:69
stats_hdr::s_name
const char * s_name
Definition:
stats.h:67
stats_hdr::s_pad1
uint8_t s_pad1
Definition:
stats.h:70
stats_hdr::s_next
struct stats_hdr * s_next
Definition:
stats.h:75
stats_name_map
Definition:
stats.h:61
stats_name_map::snm_name
const char * snm_name
Definition:
stats.h:63
stats_name_map::snm_off
uint16_t snm_off
Definition:
stats.h:62
cur
static int cur
Definition:
timeout_order.c:16
include
stats
stats.h
Generated on Mon Feb 21 2022 22:43:02 for Zephyr API Documentation by
1.9.2