Table of Contents

Struct MemoryStats

Namespace
KeenEyes
Assembly
KeenEyes.Abstractions.dll

Provides memory usage statistics for an ECS world. Useful for monitoring, profiling, and debugging memory consumption.

public readonly struct MemoryStats
Inherited Members

Remarks

Memory statistics are computed on-demand when requested from the world. This is not a live view and represents a snapshot in time.

Statistics include entity allocations, component storage, archetype counts, and pooling efficiency metrics.

Properties

ArchetypeCount

Gets the number of archetypes in use.

public int ArchetypeCount { get; init; }

Property Value

int

CachedQueryCount

Gets the number of cached queries.

public int CachedQueryCount { get; init; }

Property Value

int

ComponentTypeCount

Gets the number of registered component types.

public int ComponentTypeCount { get; init; }

Property Value

int

EntitiesActive

Gets the number of entities currently alive (active).

public int EntitiesActive { get; init; }

Property Value

int

EntitiesAllocated

Gets the total number of entities that have ever been allocated.

public int EntitiesAllocated { get; init; }

Property Value

int

EntitiesRecycled

Gets the number of entity IDs available for recycling.

public int EntitiesRecycled { get; init; }

Property Value

int

EntityRecycleCount

Gets the total number of times entity IDs have been recycled.

public long EntityRecycleCount { get; init; }

Property Value

long

EstimatedComponentBytes

Gets the estimated total bytes used by component storage.

public long EstimatedComponentBytes { get; init; }

Property Value

long

Remarks

This is an estimate based on component sizes and counts. Actual memory usage may differ due to array pooling and alignment.

QueryCacheHitRate

Gets the query cache hit rate as a percentage.

public double QueryCacheHitRate { get; }

Property Value

double

QueryCacheHits

Gets the query cache hit count.

public long QueryCacheHits { get; init; }

Property Value

long

QueryCacheMisses

Gets the query cache miss count.

public long QueryCacheMisses { get; init; }

Property Value

long

RecycleEfficiency

Gets the entity recycling efficiency as a percentage.

public double RecycleEfficiency { get; }

Property Value

double

Remarks

Higher values indicate more entity ID reuse, reducing allocation pressure. Calculated as: RecycleCount / (TotalAllocated - ActiveCount) * 100

SystemCount

Gets the number of registered systems.

public int SystemCount { get; init; }

Property Value

int

Methods

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.