Skip to content

fix: Correcting the profiler names for network vars to be appropriate… #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion com.unity.multiplayer.mlapi/Editor/MLAPIProfilerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ private class MLAPIModules
new MLAPIProfilerCounter { m_Name = ProfilerConstants.UnnamedMessageReceived, m_Category = ProfilerCategory.Network.Name },
new MLAPIProfilerCounter { m_Name = ProfilerConstants.ByteSent, m_Category = ProfilerCategory.Network.Name },
new MLAPIProfilerCounter { m_Name = ProfilerConstants.ByteReceived, m_Category = ProfilerCategory.Network.Name },
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarReceived, m_Category = ProfilerCategory.Network.Name },
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarUpdates, m_Category = ProfilerCategory.Network.Name },
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarDeltas, m_Category = ProfilerCategory.Network.Name },
Comment on lines +71 to +72
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand the difference between these two stats?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One does uses buffer manager and one is the normal expected network var changes.
However the best person to answer this would be Luke or Albin

I was just clarifying the name as these were two distinct things

};

private delegate List<MLAPIProfilerCounter> CounterListFactoryDelegate();
Expand Down
4 changes: 2 additions & 2 deletions com.unity.multiplayer.mlapi/Runtime/Core/NetworkBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ internal static void HandleNetworkVariableDeltas(List<INetworkVariable> networkV
long readStartPos = stream.Position;

networkVariableList[i].ReadDelta(stream, IsServer, localTick, remoteTick);
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarReceived);
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarDeltas);

ProfilerStatManager.NetworkVarsRcvd.Record();

Expand Down Expand Up @@ -810,7 +810,7 @@ internal static void HandleNetworkVariableUpdate(List<INetworkVariable> networkV
long readStartPos = stream.Position;

networkVariableList[i].ReadField(stream, NetworkTickSystem.NoTick, NetworkTickSystem.NoTick);
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarReceived);
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarUpdates);

ProfilerStatManager.NetworkVarsRcvd.Record();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public static class ProfilerConstants
public const string UnnamedMessageReceived = nameof(UnnamedMessageReceived);
public const string ByteSent = nameof(ByteSent);
public const string ByteReceived = nameof(ByteReceived);
public const string NetworkVarReceived = nameof(NetworkVarReceived);
public const string NetworkVarDeltas = nameof(NetworkVarDeltas);
public const string NetworkVarUpdates = nameof(NetworkVarUpdates);
public const string RpcSent = nameof(RpcSent);
public const string RpcReceived = nameof(RpcReceived);
public const string RpcBatchesSent = nameof(RpcBatchesSent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ internal static class ProfilerCountersInfo
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.ByteReceived,
ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);

private static readonly ProfilerCounterValue<int> k_NetworkVarsCounterValue =
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.NetworkVarReceived,
private static readonly ProfilerCounterValue<int> k_NetworkVarDeltasCounterValue =
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.NetworkVarDeltas,
ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);

private static readonly ProfilerCounterValue<int> k_NetworkVarUpdatesCounterValue =
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.NetworkVarUpdates,
ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);

// RPCs
Expand Down Expand Up @@ -83,7 +87,8 @@ private static void InitializeCounters()
k_UnnamedMessagesCounterValue.Value = 0;
k_BytesSentCounterValue.Value = 0;
k_BytesReceivedCounterValue.Value = 0;
k_NetworkVarsCounterValue.Value = 0;
k_NetworkVarDeltasCounterValue.Value = 0;
k_NetworkVarUpdatesCounterValue.Value = 0;

k_RPCsSentCounterValue.Value = 0;
k_RPCsReceivedCounterValue.Value = 0;
Expand All @@ -105,7 +110,8 @@ private static void OnPerformanceTickData(PerformanceTickData tickData)
UpdateIntCounter(tickData, k_UnnamedMessagesCounterValue, ProfilerConstants.UnnamedMessageReceived);
UpdateIntCounter(tickData, k_BytesSentCounterValue, ProfilerConstants.ByteSent);
UpdateIntCounter(tickData, k_BytesReceivedCounterValue, ProfilerConstants.ByteReceived);
UpdateIntCounter(tickData, k_NetworkVarsCounterValue, ProfilerConstants.NetworkVarReceived);
UpdateIntCounter(tickData, k_NetworkVarDeltasCounterValue, ProfilerConstants.NetworkVarDeltas);
UpdateIntCounter(tickData, k_NetworkVarUpdatesCounterValue, ProfilerConstants.NetworkVarUpdates);

// RPCs
UpdateIntCounter(tickData, k_RPCsSentCounterValue, ProfilerConstants.RpcSent);
Expand Down