The Bandwidth Profiler is a tool that enables tracking of network serialization calls from CryAction and CryGame to track estimated usage of bandwidth from game objects.
It presently tracks all calls to NetSerialise and DispatchRMI, grouping calls by class type (e.g. player, game rules) and provides functionality for budgeting entries (e.g. an entry must not exceed 256 k/bits).
Any file looking to use the profiler needs to include INetwork.h, this provides the interface.
Profiling is started by calling NET_PROFILE_BEGIN and terminated by NET_PROFILE_END. NET_PROFILE_BEGIN takes two parameters, a name for the profile entry and a bool to denote if this is a read or write call. At present only write calls are measured.
NET_PROFILE_SCOPE can also be used to initiate profiling and will automatically end the profiling when it goes out of scope. It takes the same parameters as NET_PROFILE_BEGIN.
Additionally, there is NET_PROFILE_BEGIN_BUDGET and NET_PROFILE_SCOPE_BUDGET. These take a third parameter that specifies a bandwidth budget for that entry in kilobits. At present this value is tested against the estimated worst case send for that entry and will display a warning to the screen if this is exceeded.
When profiling RMI's, there is NET_PROFILE_BEGIN_RMI and NET_PROFILE_SCOPE_RMI. Presently, all known RMI calls are captured and logged accordingly at a high level; further break down (i.e. individual SerialiseWith calls) could be undertaken using these macros if desired.
Net Profile is capable of logging to two output files if the appropriate cvars are enabled.
Log files include the following categories:
Category | Description |
---|---|
calls | number of times the entry was called. |
bits | number of bits written within a second, for rmi's this is the size of 1 rmi to 1 channel, for net serialises, this is the number of bits written to 1 channel over a second. |
written | kilobits written in a second. |
sent | estimated kilobits sent in a second for number of connected clients. |
worst | estimated worst send rate, uses net_profile_worst_num_channels to calculate this. |
heir | percentage of parent bandwidth the entry took. |
self | percentage of overall bandwidth the entry took. |
Net Profile can only be used with CryNetwork, CryAction and CryGame at this time.