Mirror/Assets/Mirage.Profiler/Editor/SentModule.cs
2024-01-16 08:58:48 +00:00

36 lines
1.2 KiB
C#
Executable File

using Mirage.NetworkProfiler.ModuleGUI.Messages;
using Unity.Profiling.Editor;
namespace Mirage.NetworkProfiler.ModuleGUI
{
[System.Serializable]
[ProfilerModuleMetadata(ModuleNames.SENT)]
public class SentModule : ProfilerModule, ICountRecorderProvider
{
private static readonly ProfilerCounterDescriptor[] counters = new ProfilerCounterDescriptor[]
{
new ProfilerCounterDescriptor(Names.SENT_COUNT, Counters.Category),
new ProfilerCounterDescriptor(Names.SENT_BYTES, Counters.Category),
new ProfilerCounterDescriptor(Names.SENT_PER_SECOND, Counters.Category),
};
public SentModule() : base(counters) { }
public override ProfilerModuleViewController CreateDetailsViewController()
{
var names = new CounterNames(
Names.SENT_COUNT,
Names.SENT_BYTES,
Names.SENT_PER_SECOND
);
return new MessageViewController(ProfilerWindow, names, SaveDataLoader.SentData);
}
CountRecorder ICountRecorderProvider.GetCountRecorder()
{
return NetworkProfilerRecorder._sentCounter;
}
}
}