Skip to content

Commit 8ea85ea

Browse files
fix: Correcting the profiler names for network vars to be appropriately named. Should address issue #605 (#632)
1 parent 0203fac commit 8ea85ea

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

com.unity.multiplayer.mlapi/Editor/MLAPIProfilerModule.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ private class MLAPIModules
6868
new MLAPIProfilerCounter { m_Name = ProfilerConstants.UnnamedMessageReceived, m_Category = ProfilerCategory.Network.Name },
6969
new MLAPIProfilerCounter { m_Name = ProfilerConstants.ByteSent, m_Category = ProfilerCategory.Network.Name },
7070
new MLAPIProfilerCounter { m_Name = ProfilerConstants.ByteReceived, m_Category = ProfilerCategory.Network.Name },
71-
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarReceived, m_Category = ProfilerCategory.Network.Name },
71+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarUpdates, m_Category = ProfilerCategory.Network.Name },
72+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarDeltas, m_Category = ProfilerCategory.Network.Name },
7273
};
7374

7475
private delegate List<MLAPIProfilerCounter> CounterListFactoryDelegate();

com.unity.multiplayer.mlapi/Runtime/Core/NetworkBehaviour.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ internal static void HandleNetworkVariableDeltas(List<INetworkVariable> networkV
729729
long readStartPos = stream.Position;
730730

731731
networkVariableList[i].ReadDelta(stream, IsServer, localTick, remoteTick);
732-
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarReceived);
732+
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarDeltas);
733733

734734
ProfilerStatManager.NetworkVarsRcvd.Record();
735735

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

812812
networkVariableList[i].ReadField(stream, NetworkTickSystem.NoTick, NetworkTickSystem.NoTick);
813-
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarReceived);
813+
PerformanceDataManager.Increment(ProfilerConstants.NetworkVarUpdates);
814814

815815
ProfilerStatManager.NetworkVarsRcvd.Record();
816816

com.unity.multiplayer.mlapi/Runtime/Profiling/ProfilerConstants.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ public static class ProfilerConstants
99
public const string UnnamedMessageReceived = nameof(UnnamedMessageReceived);
1010
public const string ByteSent = nameof(ByteSent);
1111
public const string ByteReceived = nameof(ByteReceived);
12-
public const string NetworkVarReceived = nameof(NetworkVarReceived);
12+
public const string NetworkVarDeltas = nameof(NetworkVarDeltas);
13+
public const string NetworkVarUpdates = nameof(NetworkVarUpdates);
1314
public const string RpcSent = nameof(RpcSent);
1415
public const string RpcReceived = nameof(RpcReceived);
1516
public const string RpcBatchesSent = nameof(RpcBatchesSent);

com.unity.multiplayer.mlapi/Runtime/Profiling/ProfilerCountersInfo.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ internal static class ProfilerCountersInfo
3434
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.ByteReceived,
3535
ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);
3636

37-
private static readonly ProfilerCounterValue<int> k_NetworkVarsCounterValue =
38-
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.NetworkVarReceived,
37+
private static readonly ProfilerCounterValue<int> k_NetworkVarDeltasCounterValue =
38+
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.NetworkVarDeltas,
39+
ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);
40+
41+
private static readonly ProfilerCounterValue<int> k_NetworkVarUpdatesCounterValue =
42+
new ProfilerCounterValue<int>(ProfilerCategory.Network, ProfilerConstants.NetworkVarUpdates,
3943
ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);
4044

4145
// RPCs
@@ -83,7 +87,8 @@ private static void InitializeCounters()
8387
k_UnnamedMessagesCounterValue.Value = 0;
8488
k_BytesSentCounterValue.Value = 0;
8589
k_BytesReceivedCounterValue.Value = 0;
86-
k_NetworkVarsCounterValue.Value = 0;
90+
k_NetworkVarDeltasCounterValue.Value = 0;
91+
k_NetworkVarUpdatesCounterValue.Value = 0;
8792

8893
k_RPCsSentCounterValue.Value = 0;
8994
k_RPCsReceivedCounterValue.Value = 0;
@@ -105,7 +110,8 @@ private static void OnPerformanceTickData(PerformanceTickData tickData)
105110
UpdateIntCounter(tickData, k_UnnamedMessagesCounterValue, ProfilerConstants.UnnamedMessageReceived);
106111
UpdateIntCounter(tickData, k_BytesSentCounterValue, ProfilerConstants.ByteSent);
107112
UpdateIntCounter(tickData, k_BytesReceivedCounterValue, ProfilerConstants.ByteReceived);
108-
UpdateIntCounter(tickData, k_NetworkVarsCounterValue, ProfilerConstants.NetworkVarReceived);
113+
UpdateIntCounter(tickData, k_NetworkVarDeltasCounterValue, ProfilerConstants.NetworkVarDeltas);
114+
UpdateIntCounter(tickData, k_NetworkVarUpdatesCounterValue, ProfilerConstants.NetworkVarUpdates);
109115

110116
// RPCs
111117
UpdateIntCounter(tickData, k_RPCsSentCounterValue, ProfilerConstants.RpcSent);

0 commit comments

Comments
 (0)