示例#1
0
        public void InitMeasuringOnRoundStart(NodeAddedEvent e, RoundUserNode roundUser, [Context, JoinByUser] BattleUserNode selfBattleUser, [JoinAll] StatisticsNode statistics)
        {
            PerformanceStatisticsHelperComponent   performanceStatisticsHelper   = statistics.performanceStatisticsHelper;
            PerformanceStatisticsSettingsComponent performanceStatisticsSettings = statistics.performanceStatisticsSettings;

            performanceStatisticsHelper.startRoundTimeInSec = UnityTime.realtimeSinceStartup;
            performanceStatisticsHelper.frames    = new FramesCollection(performanceStatisticsSettings.HugeFrameDurationInMs, performanceStatisticsSettings.MeasuringIntervalInSec);
            performanceStatisticsHelper.tankCount = new StatisticCollection(50);
        }
示例#2
0
 public void Update(TimeUpdateEvent e, BattleUserNode selfBattleUser, [JoinByUser] SingleNode <RoundUserComponent> selfRoundUser, [JoinByBattle] ICollection <SingleNode <RoundUserComponent> > allRoundUsers, [JoinAll] StatisticsNode statistics)
 {
     if (!RoundTimeTooShortForMeasuring(statistics))
     {
         PerformanceStatisticsHelperComponent performanceStatisticsHelper = statistics.performanceStatisticsHelper;
         int durationInMs = (int)(e.DeltaTime * 1000f);
         performanceStatisticsHelper.frames.AddFrame(durationInMs);
         performanceStatisticsHelper.tankCount.Add(allRoundUsers.Count, durationInMs);
     }
 }
示例#3
0
 public void SendStatisticDataOnRoundStop(NodeRemoveEvent e, SingleNode <RoundUserComponent> roundUser, [JoinByUser] BattleUserNode battleUser, [JoinByUser] SelfUserNode selfUser, [JoinByUser] SingleNode <RoundUserComponent> node, [JoinByBattle] SingleNode <BattleComponent> battle, [JoinByMap] SingleNode <MapComponent> map, [JoinAll] StatisticsNode statistics)
 {
     if (!RoundTimeTooShortForMeasuring(statistics))
     {
         PerformanceStatisticsHelperComponent performanceStatisticsHelper = statistics.performanceStatisticsHelper;
         FramesCollection         frames = performanceStatisticsHelper.frames;
         PerformanceStatisticData data   = new PerformanceStatisticData {
             UserName             = selfUser.userUid.Uid,
             GraphicDeviceName    = SystemInfo.graphicsDeviceName,
             GraphicsDeviceType   = SystemInfo.graphicsDeviceType.ToString(),
             GraphicsMemorySize   = SystemInfo.graphicsMemorySize,
             DefaultQuality       = GraphicsSettings.INSTANCE.DefaultQuality.Name,
             Quality              = QualitySettings.names[QualitySettings.GetQualityLevel()],
             Resolution           = GraphicsSettings.INSTANCE.CurrentResolution.ToString(),
             MapName              = GetMapName(map),
             BattleRoundTimeInMin = (int)((Time.realtimeSinceStartup - performanceStatisticsHelper.startRoundTimeInSec) / 60f),
             TankCountModa        = performanceStatisticsHelper.tankCount.Moda,
             Moda    = frames.Moda,
             Average = frames.Average,
             StandardDeviationInMs = frames.StandartDevation,
             HugeFrameCount        = frames.HugeFrameCount,
             MinAverageForInterval = frames.MinAverageForInterval,
             MaxAverageForInterval = frames.MaxAverageForInterval,
             GraphicDeviceKey      = $"DeviceVendorID: {SystemInfo.graphicsDeviceVendorID}; DeviceID: {SystemInfo.graphicsDeviceID}",
             AveragePing           = battleUser.battlePing.getAveragePing(),
             PingModa = battleUser.battlePing.getMediana(),
             GraphicsDeviceVersion = SystemInfo.graphicsDeviceVersion,
             CustomSettings        = GraphicsSettings.INSTANCE.customSettings,
             Windowed            = !Screen.fullScreen,
             SaturationLevel     = GraphicsSettings.INSTANCE.CurrentSaturationLevel,
             VegetationLevel     = GraphicsSettings.INSTANCE.CurrentVegetationLevel,
             GrassLevel          = GraphicsSettings.INSTANCE.CurrentGrassLevel,
             AntialiasingQuality = GraphicsSettings.INSTANCE.CurrentAntialiasingQuality,
             AnisotropicQuality  = GraphicsSettings.INSTANCE.CurrentAnisotropicQuality,
             TextureQuality      = GraphicsSettings.INSTANCE.CurrentTextureQuality,
             ShadowQuality       = GraphicsSettings.INSTANCE.CurrentShadowQuality,
             AmbientOcclusion    = GraphicsSettings.INSTANCE.currentAmbientOcclusion,
             Bloom = GraphicsSettings.INSTANCE.currentBloom,
             RenderResolutionQuality = GraphicsSettings.INSTANCE.CurrentRenderResolutionQuality,
             SystemMemorySize        = SystemInfo.systemMemorySize,
             TotalReservedMemory     = (long)Profiler.GetTotalReservedMemory(),
             TotalAllocatedMemory    = (long)Profiler.GetTotalAllocatedMemory(),
             MonoHeapSize            = (long)Profiler.GetMonoHeapSize(),
             HandlerNames            = new string[0],
             HandlerCallCounts       = new int[0]
         };
         base.Log.InfoFormat("{0}\n{1}", "PerformanceStatisticData", EcsToStringUtil.ToStringWithProperties(data, ", "));
         base.ScheduleEvent(new SendPerfomanceStatisticDataEvent(data), selfUser);
     }
 }