Skip to content

Commit 17e8b2c

Browse files
committed
revert name changes to MLAPIProfilerModule struct fields
1 parent 3c36a5f commit 17e8b2c

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

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

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ internal static class MLAPIProfilerModule
2525
private class MLAPIProfilerCounter
2626
{
2727
// Note: These fields are named this way for internal serialization
28-
public string Name;
29-
public string Category;
28+
public string m_Name;
29+
public string m_Category;
3030
}
3131

3232
/// <summary>
@@ -36,62 +36,65 @@ private class MLAPIProfilerCounter
3636
private class MLAPIProfilerModuleData
3737
{
3838
// Note: These fields are named this way for internal serialization
39-
public List<MLAPIProfilerCounter> ChartCounters = new List<MLAPIProfilerCounter>();
40-
public List<MLAPIProfilerCounter> DetailCounters = new List<MLAPIProfilerCounter>();
41-
public string Name;
39+
public List<MLAPIProfilerCounter> m_ChartCounters = new List<MLAPIProfilerCounter>();
40+
public List<MLAPIProfilerCounter> m_DetailCounters = new List<MLAPIProfilerCounter>();
41+
public string m_Name;
4242
}
4343

44+
/// <summary>
45+
/// This needs to be in synced with the internal dynamic module structure to provide our own counters
46+
/// </summary>
4447
[Serializable]
4548
private class MLAPIModules
4649
{
4750
// Note: These fields are named this way for internal serialization
48-
public List<MLAPIProfilerModuleData> Modules;
51+
public List<MLAPIProfilerModuleData> m_Modules;
4952
}
5053
#pragma warning restore IDE1006 // restore naming rule violation check
5154

5255
private static List<MLAPIProfilerCounter> CreateRPCCounters() => new List<MLAPIProfilerCounter>()
5356
{
54-
new MLAPIProfilerCounter { Name = ProfilerConstants.RpcSent, Category = ProfilerCategory.Network.Name },
55-
new MLAPIProfilerCounter { Name = ProfilerConstants.RpcReceived, Category = ProfilerCategory.Network.Name },
56-
new MLAPIProfilerCounter { Name = ProfilerConstants.RpcBatchesSent, Category = ProfilerCategory.Network.Name },
57-
new MLAPIProfilerCounter { Name = ProfilerConstants.RpcBatchesReceived, Category = ProfilerCategory.Network.Name },
58-
new MLAPIProfilerCounter { Name = ProfilerConstants.RpcQueueProcessed, Category = ProfilerCategory.Network.Name },
59-
new MLAPIProfilerCounter { Name = ProfilerConstants.RpcInQueueSize, Category = ProfilerCategory.Network.Name },
60-
new MLAPIProfilerCounter { Name = ProfilerConstants.RpcOutQueueSize, Category = ProfilerCategory.Network.Name },
57+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.RpcSent, m_Category = ProfilerCategory.Network.Name },
58+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.RpcReceived, m_Category = ProfilerCategory.Network.Name },
59+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.RpcBatchesSent, m_Category = ProfilerCategory.Network.Name },
60+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.RpcBatchesReceived, m_Category = ProfilerCategory.Network.Name },
61+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.RpcQueueProcessed, m_Category = ProfilerCategory.Network.Name },
62+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.RpcInQueueSize, m_Category = ProfilerCategory.Network.Name },
63+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.RpcOutQueueSize, m_Category = ProfilerCategory.Network.Name },
6164
};
6265

6366
private static List<MLAPIProfilerCounter> CreateOperationsCounters() => new List<MLAPIProfilerCounter>()
6467
{
65-
new MLAPIProfilerCounter { Name = ProfilerConstants.Connections, Category = ProfilerCategory.Network.Name },
66-
new MLAPIProfilerCounter { Name = ProfilerConstants.ReceiveTickRate, Category = ProfilerCategory.Network.Name },
68+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.Connections, m_Category = ProfilerCategory.Network.Name },
69+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.ReceiveTickRate, m_Category = ProfilerCategory.Network.Name },
6770
};
6871

6972
private static List<MLAPIProfilerCounter> CreateMessagesCounters() => new List<MLAPIProfilerCounter>()
7073
{
71-
new MLAPIProfilerCounter { Name = ProfilerConstants.NamedMessageReceived, Category = ProfilerCategory.Network.Name },
72-
new MLAPIProfilerCounter { Name = ProfilerConstants.UnnamedMessageReceived, Category = ProfilerCategory.Network.Name },
73-
new MLAPIProfilerCounter { Name = ProfilerConstants.NamedMessageSent, Category = ProfilerCategory.Network.Name },
74-
new MLAPIProfilerCounter { Name = ProfilerConstants.UnnamedMessageSent, Category = ProfilerCategory.Network.Name },
75-
new MLAPIProfilerCounter { Name = ProfilerConstants.ByteSent, Category = ProfilerCategory.Network.Name },
76-
new MLAPIProfilerCounter { Name = ProfilerConstants.ByteReceived, Category = ProfilerCategory.Network.Name },
77-
new MLAPIProfilerCounter { Name = ProfilerConstants.NetworkVarUpdates, Category = ProfilerCategory.Network.Name },
78-
new MLAPIProfilerCounter { Name = ProfilerConstants.NetworkVarDeltas, Category = ProfilerCategory.Network.Name },
74+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NamedMessageReceived, m_Category = ProfilerCategory.Network.Name },
75+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.UnnamedMessageReceived, m_Category = ProfilerCategory.Network.Name },
76+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NamedMessageSent, m_Category = ProfilerCategory.Network.Name },
77+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.UnnamedMessageSent, m_Category = ProfilerCategory.Network.Name },
78+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.ByteSent, m_Category = ProfilerCategory.Network.Name },
79+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.ByteReceived, m_Category = ProfilerCategory.Network.Name },
80+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarUpdates, m_Category = ProfilerCategory.Network.Name },
81+
new MLAPIProfilerCounter { m_Name = ProfilerConstants.NetworkVarDeltas, m_Category = ProfilerCategory.Network.Name },
7982
};
8083

8184
private delegate List<MLAPIProfilerCounter> CounterListFactoryDelegate();
8285

8386
private static bool CreateMLAPIDynamicModule(ref MLAPIModules mlapiModules, string moduleName, CounterListFactoryDelegate counterListFactoryDelegate)
8487
{
85-
var module = mlapiModules.Modules.Find(x => x.Name == moduleName);
88+
var module = mlapiModules.m_Modules.Find(x => x.m_Name == moduleName);
8689
if (module == null)
8790
{
8891
var newModule = new MLAPIProfilerModuleData
8992
{
90-
Name = moduleName,
91-
ChartCounters = counterListFactoryDelegate(),
92-
DetailCounters = counterListFactoryDelegate(),
93+
m_Name = moduleName,
94+
m_ChartCounters = counterListFactoryDelegate(),
95+
m_DetailCounters = counterListFactoryDelegate(),
9396
};
94-
mlapiModules.Modules.Add(newModule);
97+
mlapiModules.m_Modules.Add(newModule);
9598
return true;
9699
}
97100

0 commit comments

Comments
 (0)