Table of Contents

Interface IStatisticsCapability

Namespace
KeenEyes.Capabilities
Assembly
KeenEyes.Abstractions.dll

Capability interface for accessing world memory and performance statistics.

public interface IStatisticsCapability

Examples

public void Install(IPluginContext context)
{
    if (context.TryGetCapability<IStatisticsCapability>(out var stats))
    {
        var memStats = stats.GetMemoryStats();
        Console.WriteLine($"Entities: {memStats.EntitiesActive} active");
        Console.WriteLine($"Archetypes: {memStats.ArchetypeCount}");
    }
}

Remarks

This capability provides access to memory usage statistics for profiling and diagnostics. Statistics include entity allocations, component storage, and pooling metrics.

Plugins that need to monitor world performance should request this capability via GetCapability<T>() rather than casting to the concrete World type.

Methods

GetArchetypeStatistics()

Gets detailed statistics for all archetypes in the world.

IReadOnlyList<ArchetypeStatistics> GetArchetypeStatistics()

Returns

IReadOnlyList<ArchetypeStatistics>

A list of statistics for each archetype.

Remarks

Archetype statistics provide insight into how entities are distributed across different component combinations and the memory efficiency of each.

This is useful for identifying fragmented archetypes or those consuming unexpectedly large amounts of memory.

GetMemoryStats()

Gets memory usage statistics for this world.

MemoryStats GetMemoryStats()

Returns

MemoryStats

A snapshot of current memory statistics.

Remarks

Statistics are computed on-demand and represent a snapshot in time.