Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
metrics.h
Go to the documentation of this file.
1
9#ifdef FLECS_METRICS
10
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
35extern "C" {
36#endif
37
39FLECS_API extern ECS_COMPONENT_DECLARE(FlecsMetrics);
40
42FLECS_API extern ECS_TAG_DECLARE(EcsMetric);
43
45FLECS_API extern ECS_TAG_DECLARE(EcsCounter);
46
48FLECS_API extern ECS_TAG_DECLARE(EcsCounterIncrement);
49
51FLECS_API extern ECS_TAG_DECLARE(EcsCounterId);
52
54FLECS_API extern ECS_TAG_DECLARE(EcsGauge);
55
57FLECS_API extern ECS_TAG_DECLARE(EcsMetricInstance);
58
61
64
66typedef struct EcsMetricValue {
67 double value;
69
71typedef struct EcsMetricSource {
72 ecs_entity_t entity;
74
76typedef struct ecs_metric_desc_t {
77 int32_t _canary;
78
81
85
86 /* Member dot expression. Can be used instead of member and supports nested
87 * members. Must be set together with id and should not be set at the same
88 * time as member. */
89 const char *dotmember;
90
94
99 bool targets;
100
103
105 const char *brief;
107
147FLECS_API
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
174FLECS_API
176 ecs_world_t *world);
177
178#ifdef __cplusplus
179}
180#endif
181
182#endif
183
186#endif
struct EcsMetricSource EcsMetricSource
Component that stores metric source.
struct ecs_metric_desc_t ecs_metric_desc_t
Used with ecs_metric_init to create metric.
struct EcsMetricValue EcsMetricValue
Component that stores metric value.
FLECS_API ecs_entity_t ecs_metric_init(ecs_world_t *world, const ecs_metric_desc_t *desc)
Create a new metric.
FLECS_API void FlecsMetricsImport(ecs_world_t *world)
Metrics module import function.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:347
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:391
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:340
#define ECS_TAG_DECLARE
Forward declare a tag.
Definition flecs_c.h:66
#define ECS_COMPONENT_DECLARE(id)
Forward declare a component.
Definition flecs_c.h:112
Component that stores metric source.
Definition metrics.h:71
Component that stores metric value.
Definition metrics.h:66
Used with ecs_metric_init to create metric.
Definition metrics.h:76
const char * brief
Description of metric.
Definition metrics.h:105
ecs_entity_t member
Entity associated with member that stores metric value.
Definition metrics.h:84
ecs_entity_t kind
Must be EcsGauge, EcsCounter, EcsCounterIncrement or EcsCounterId.
Definition metrics.h:102
ecs_entity_t entity
Entity associated with metric.
Definition metrics.h:80
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_id_t id
Tracks whether entities have the specified component id.
Definition metrics.h:93