Flecs
v4.1
A fast entity component system (ECS) for C & C++
Toggle main menu visibility
Loading...
Searching...
No Matches
metrics.h
Go to the documentation of this file.
1
8
9
#ifdef FLECS_METRICS
10
18
19
#ifndef FLECS_METRICS_H
20
#define FLECS_METRICS_H
21
22
#ifndef FLECS_META
23
#define FLECS_META
24
#endif
25
26
#ifndef FLECS_UNITS
27
#define FLECS_UNITS
28
#endif
29
30
#ifndef FLECS_PIPELINE
31
#define FLECS_PIPELINE
32
#endif
33
34
#ifdef __cplusplus
35
extern
"C"
{
36
#endif
37
39
FLECS_API
extern
ECS_COMPONENT_DECLARE
(FlecsMetrics);
40
42
FLECS_API
extern
ECS_TAG_DECLARE
(EcsMetric);
43
45
FLECS_API
extern
ECS_TAG_DECLARE
(EcsCounter);
46
48
FLECS_API
extern
ECS_TAG_DECLARE
(EcsCounterIncrement);
49
51
FLECS_API
extern
ECS_TAG_DECLARE
(EcsCounterId);
52
54
FLECS_API
extern
ECS_TAG_DECLARE
(EcsGauge);
55
57
FLECS_API
extern
ECS_TAG_DECLARE
(EcsMetricInstance);
58
60
FLECS_API
extern
ECS_COMPONENT_DECLARE
(
EcsMetricValue
);
61
63
FLECS_API
extern
ECS_COMPONENT_DECLARE
(
EcsMetricSource
);
64
66
typedef
struct
EcsMetricValue
{
67
double
value;
68
}
EcsMetricValue
;
69
71
typedef
struct
EcsMetricSource
{
72
ecs_entity_t
entity;
73
}
EcsMetricSource
;
74
76
typedef
struct
ecs_metric_desc_t
{
77
int32_t
_canary
;
78
80
ecs_entity_t
entity
;
81
84
ecs_entity_t
member
;
85
89
const
char
*
dotmember
;
90
93
ecs_id_t
id
;
94
99
bool
targets
;
100
102
ecs_entity_t
kind
;
103
105
const
char
*
brief
;
106
}
ecs_metric_desc_t
;
107
147
FLECS_API
148
ecs_entity_t
ecs_metric_init
(
149
ecs_world_t
*world,
150
const
ecs_metric_desc_t
*desc);
151
163
#define ecs_metric(world, ...)\
164
ecs_metric_init(world, &(ecs_metric_desc_t) __VA_ARGS__ )
165
174
FLECS_API
175
void
FlecsMetricsImport
(
176
ecs_world_t
*world);
177
178
#ifdef __cplusplus
179
}
180
#endif
181
182
#endif
183
185
186
#endif
ecs_metric_init
FLECS_API ecs_entity_t ecs_metric_init(ecs_world_t *world, const ecs_metric_desc_t *desc)
Create a new metric.
FlecsMetricsImport
FLECS_API void FlecsMetricsImport(ecs_world_t *world)
Metrics module import function.
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition
flecs.h:385
ecs_world_t
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition
flecs.h:429
ecs_id_t
uint64_t ecs_id_t
IDs are the things that can be added to an entity.
Definition
flecs.h:378
ECS_TAG_DECLARE
#define ECS_TAG_DECLARE
Forward declare a tag.
Definition
flecs_c.h:66
ECS_COMPONENT_DECLARE
#define ECS_COMPONENT_DECLARE(id)
Forward declare a component.
Definition
flecs_c.h:112
EcsMetricSource
Component that stores metric source.
Definition
metrics.h:71
EcsMetricValue
Component that stores metric value.
Definition
metrics.h:66
ecs_metric_desc_t
Used with ecs_metric_init() to create metric.
Definition
metrics.h:76
ecs_metric_desc_t::brief
const char * brief
Description of metric.
Definition
metrics.h:105
ecs_metric_desc_t::member
ecs_entity_t member
Entity associated with member that stores metric value.
Definition
metrics.h:84
ecs_metric_desc_t::kind
ecs_entity_t kind
Must be EcsGauge, EcsCounter, EcsCounterIncrement, or EcsCounterId.
Definition
metrics.h:102
ecs_metric_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition
metrics.h:77
ecs_metric_desc_t::dotmember
const char * dotmember
Member dot expression.
Definition
metrics.h:89
ecs_metric_desc_t::entity
ecs_entity_t entity
Entity associated with metric.
Definition
metrics.h:80
ecs_metric_desc_t::targets
bool targets
If id is a (R, *) wildcard and relationship R has the OneOf property, setting this value to true will...
Definition
metrics.h:99
ecs_metric_desc_t::id
ecs_id_t id
Tracks whether entities have the specified component ID.
Definition
metrics.h:93