Flecs v3.2
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
38FLECS_API extern ECS_COMPONENT_DECLARE(FlecsMetrics);
39
41FLECS_API extern ECS_TAG_DECLARE(EcsMetric);
42
44FLECS_API extern ECS_TAG_DECLARE(EcsCounter);
45
47FLECS_API extern ECS_TAG_DECLARE(EcsCounterIncrement);
48
50FLECS_API extern ECS_TAG_DECLARE(EcsCounterId);
51
53FLECS_API extern ECS_TAG_DECLARE(EcsGauge);
54
56FLECS_API extern ECS_TAG_DECLARE(EcsMetricInstance);
57
60
63
64typedef struct EcsMetricValue {
65 double value;
67
68typedef struct EcsMetricSource {
69 ecs_entity_t entity;
71
72typedef struct ecs_metric_desc_t {
73 int32_t _canary;
74
77
81
82 /* Member dot expression. Can be used instead of member and supports nested
83 * members. Must be set together with id and should not be set at the same
84 * time as member. */
85 const char *dotmember;
86
90
95 bool targets;
96
99
101 const char *brief;
103
143FLECS_API
145 ecs_world_t *world,
146 const ecs_metric_desc_t *desc);
147
159#define ecs_metric(world, ...)\
160 ecs_metric_init(world, &(ecs_metric_desc_t) __VA_ARGS__ )
161
162/* Module import */
163FLECS_API
164void FlecsMetricsImport(
165 ecs_world_t *world);
166
167#ifdef __cplusplus
168}
169#endif
170
171#endif
172
175#endif
FLECS_API ecs_entity_t ecs_metric_init(ecs_world_t *world, const ecs_metric_desc_t *desc)
Create a new metric.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:318
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:362
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:311
#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
const char * brief
Description of metric.
Definition metrics.h:101
ecs_entity_t member
Entity associated with member that stores metric value.
Definition metrics.h:80
ecs_entity_t kind
Must be EcsGauge, EcsCounter, EcsCounterIncrement or EcsCounterId.
Definition metrics.h:98
ecs_entity_t entity
Entity associated with metric.
Definition metrics.h:76
bool targets
If id is a (R, *) wildcard and relationship R has the OneOf property, setting this value to true will...
Definition metrics.h:95
ecs_id_t id
Tracks whether entities have the specified component id.
Definition metrics.h:89