Flecs v4.0
A fast entity component system (ECS) for C & C++
|
Collect user-defined metrics from ECS data. More...
Classes | |
struct | EcsMetricValue |
Component that stores metric value. More... | |
struct | EcsMetricSource |
Component that stores metric source. More... | |
struct | ecs_metric_desc_t |
Used with ecs_metric_init to create metric. More... | |
Macros | |
#define | ecs_metric(world, ...) ecs_metric_init(world, &(ecs_metric_desc_t) __VA_ARGS__ ) |
Shorthand for creating a metric with ecs_metric_init(). | |
Functions | |
FLECS_API | ECS_COMPONENT_DECLARE (FlecsMetrics) |
Flecs metrics module. | |
FLECS_API | ECS_TAG_DECLARE (EcsMetric) |
Tag added to metrics, and used as first element of metric kind pair. | |
FLECS_API | ECS_TAG_DECLARE (EcsCounter) |
Metric that has monotonically increasing value. | |
FLECS_API | ECS_TAG_DECLARE (EcsCounterIncrement) |
Counter metric that is auto-incremented by source value. | |
FLECS_API | ECS_TAG_DECLARE (EcsCounterId) |
Counter metric that counts the number of entities with an id. | |
FLECS_API | ECS_TAG_DECLARE (EcsGauge) |
Metric that represents current value. | |
FLECS_API | ECS_TAG_DECLARE (EcsMetricInstance) |
Tag added to metric instances. | |
FLECS_API | ECS_COMPONENT_DECLARE (EcsMetricValue) |
Component with metric instance value. | |
FLECS_API | ECS_COMPONENT_DECLARE (EcsMetricSource) |
Component with entity source of metric instance. | |
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. | |
Collect user-defined metrics from ECS data.
#define ecs_metric | ( | world, | |
... ) ecs_metric_init(world, &(ecs_metric_desc_t) __VA_ARGS__ ) |
Shorthand for creating a metric with ecs_metric_init().
Example:
FLECS_API ecs_entity_t ecs_metric_init | ( | ecs_world_t * | world, |
const ecs_metric_desc_t * | desc ) |
Create a new metric.
Metrics are entities that store values measured from a range of different properties in the ECS storage. Metrics provide a single unified interface to discovering and reading these values, which can be useful for monitoring utilities, or for debugging.
Examples of properties that can be measured by metrics are:
Metrics can either be created as a "gauge" or "counter". A gauge is a metric that represents the value of something at a specific point in time, for example "velocity". A counter metric represents a value that is monotonically increasing, for example "miles driven".
There are three different kinds of counter metric kinds:
world | The world. |
desc | Metric description. |
FLECS_API void FlecsMetricsImport | ( | ecs_world_t * | world | ) |