Struct ArchetypeStatistics
- Namespace
- KeenEyes
- Assembly
- KeenEyes.Abstractions.dll
Provides statistics for a single archetype in the ECS world.
public readonly record struct ArchetypeStatistics : IEquatable<ArchetypeStatistics>
- Implements
- Inherited Members
Remarks
Each archetype stores entities with the same set of component types. These statistics provide insight into memory usage and storage efficiency for individual archetypes.
Properties
ChunkCount
Gets the number of chunks used by this archetype.
public required int ChunkCount { get; init; }
Property Value
Remarks
Chunks are fixed-size storage units. More chunks may indicate fragmentation if many are only partially filled.
ComponentTypeNames
Gets the names of component types in this archetype.
public required IReadOnlyList<string> ComponentTypeNames { get; init; }
Property Value
Remarks
Component type names are used instead of Type objects for AOT compatibility and serialization friendliness.
EntityCount
Gets the number of entities currently stored in this archetype.
public required int EntityCount { get; init; }
Property Value
EstimatedMemoryBytes
Gets the estimated memory usage in bytes for component storage in this archetype.
public required long EstimatedMemoryBytes { get; init; }
Property Value
Remarks
This is an estimate based on component sizes and entity count. Actual memory usage may differ due to array pooling and alignment.
FragmentationPercentage
Gets the fragmentation percentage for this archetype.
public double FragmentationPercentage { get; }
Property Value
Remarks
Fragmentation represents unused capacity within allocated chunks. A value of 0% means all chunk slots are used (perfect efficiency). Higher values indicate wasted memory due to partially filled chunks.
Formula: (TotalCapacity - EntityCount) / TotalCapacity * 100
Id
Gets the unique identifier for this archetype.
public required int Id { get; init; }
Property Value
TotalCapacity
Gets the total capacity across all chunks in this archetype.
public required int TotalCapacity { get; init; }
Property Value
UtilizationPercentage
Gets the utilization percentage for this archetype.
public double UtilizationPercentage { get; }
Property Value
Remarks
Utilization is the inverse of fragmentation, representing how much of the allocated capacity is being used. Formula: EntityCount / TotalCapacity * 100