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.
- Listed in Networking and servers
- Inherits or implements
NetworkingStatisticsListNonSerialized<EntityStatistic> - Nested types
StatisticSortingMethod
Constructors
| Member | What it is |
|---|---|
EntityStatistics() | Creates an EntityStatistics with default values. |
Fields
| Member | What it is |
|---|---|
const int MaxEntitiesToDisplay | Cap of 100 on the tracked, searched and top entity lists. |
12 private and internal fields
| Member | What it is |
|---|---|
private DuplicateKeyComparer<float> comparer | Key comparer that lets the sorted list hold equal values. |
private List<NetworkEntity> entitiesToTrack | Entities picked in the inspector to watch. |
private bool isSearching | Inspector button that runs the search. |
private bool isUpdatingTopEntities | Turns on the top entities update. |
private bool isUpdatingTrackedEntitiesStats | Inspector button that refreshes the tracked entity list. |
private int previousTopEntitiesToShow | Size of the top entities array when constructed; not read elsewhere in this class. |
private List<EntityStatistic> searchedEntities | Results of the last search. |
private string searchString | Text to match against entity names. |
private SortedList<float, EntityStatistic> sortedEntityStats | Scratch sorted list used to rank entities. |
private EntityStatistics.StatisticSortingMethod sortingMethod | What to rank the top entities by: bytes per second, bytes per frame, average send size or send count. |
private EntityStatistic[] topEntities | The highest sending entities from the last update (20 slots by default). |
private List<EntityStatistic> trackedEntityStats | Statistics of the tracked entities. |
Methods
| Member | What 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
| Member | What 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. |