Mirror/Assets/Mirage.Profiler/Editor/ReceivedModule.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2024-01-16 08:58:48 +00:00
using Mirage.NetworkProfiler.ModuleGUI.Messages;
using Unity.Profiling.Editor;
namespace Mirage.NetworkProfiler.ModuleGUI
{
[System.Serializable]
[ProfilerModuleMetadata(ModuleNames.RECEIVED)]
public class ReceivedModule : ProfilerModule, ICountRecorderProvider
{
private static readonly ProfilerCounterDescriptor[] counters = new ProfilerCounterDescriptor[]
{
new ProfilerCounterDescriptor(Names.RECEIVED_COUNT, Counters.Category),
new ProfilerCounterDescriptor(Names.RECEIVED_BYTES, Counters.Category),
new ProfilerCounterDescriptor(Names.RECEIVED_PER_SECOND, Counters.Category),
};
public ReceivedModule() : base(counters) { }
public override ProfilerModuleViewController CreateDetailsViewController()
{
var names = new CounterNames(
Names.RECEIVED_COUNT,
Names.RECEIVED_BYTES,
Names.RECEIVED_PER_SECOND
);
return new MessageViewController(ProfilerWindow, names, SaveDataLoader.ReceiveData);
}
CountRecorder ICountRecorderProvider.GetCountRecorder()
{
return NetworkProfilerRecorder._receivedCounter;
}
}
}