Skip to main content

EntityStatistics

A class in Root.Township, Alta.Profiling.Networking.

Network profiling list of bytes sent per entity, indexed by entity identifier, with inspector buttons to search, track chosen entities and list the top senders.

Constructors​

MemberWhat it is
EntityStatistics()Creates an EntityStatistics with default values.

Fields​

MemberWhat it is
const int MaxEntitiesToDisplayCap of 100 on the tracked, searched and top entity lists.
12 private and internal fields
MemberWhat it is
private DuplicateKeyComparer<float> comparerKey comparer that lets the sorted list hold equal values.
private List<NetworkEntity> entitiesToTrackEntities picked in the inspector to watch.
private bool isSearchingInspector button that runs the search.
private bool isUpdatingTopEntitiesTurns on the top entities update.
private bool isUpdatingTrackedEntitiesStatsInspector button that refreshes the tracked entity list.
private int previousTopEntitiesToShowSize of the top entities array when constructed; not read elsewhere in this class.
private List<EntityStatistic> searchedEntitiesResults of the last search.
private string searchStringText to match against entity names.
private SortedList<float, EntityStatistic> sortedEntityStatsScratch sorted list used to rank entities.
private EntityStatistics.StatisticSortingMethod sortingMethodWhat to rank the top entities by: bytes per second, bytes per frame, average send size or send count.
private EntityStatistic[] topEntitiesThe highest sending entities from the last update (20 slots by default).
private List<EntityStatistic> trackedEntityStatsStatistics of the tracked entities.

Methods​

MemberWhat it is
void OnValidate()Runs the search or tracked list update when their inspector button flags are set.
void RegisterBehaviourSend(NetworkEntity entity, string behaviourName, int byteCount)Adds a send of the given size to an entity's statistic under a behaviour name.
void RegisterMessageSend(NetworkEntity entity, int byteCount)Adds a send of the given size to an entity's statistic, optionally under a message type.
void RegisterMessageSend(NetworkEntity entity, EntityMessageType messageType, int byteCount)Adds a send of the given size to an entity's statistic, optionally under a message type.
void UpdateTopEntitiesList()If isUpdatingTopEntities is on, sorts all entity statistics by sortingMethod and fills topEntities highest first.
3 private and internal methods
MemberWhat it is
private EntityStatistic GetEntityStatistic(NetworkEntity entity)Gets the statistic for an entity's identifier, creating it (named after the entity) if missing.
private void SearchForEntities()Fills searchedEntities with statistics whose entity name contains searchString (case insensitive).
private void UpdateTrackedEntitiesStatsList()Fills trackedEntityStats with the statistics of the entities in entitiesToTrack.