public Result(string experimentName) { name = experimentName; totalSamples = 0; firstFrameNumber = Benchmarking.DataSource.frameCount; memoryUsageAtStart = Benchmarking.DataSource.memoryAllocated; realtimeAtStart = Benchmarking.DataSource.realtimeSinceStartup; deltaTimeMSMin = float.MaxValue; deltaTimeMSMax = 0f; populatePercList(); populateUpperboundList(); memoryUsageAtPeak = 0u; memoryTotal = 0L; memorySystem = (long)SystemInfo.systemMemorySize * 1048576L; deviceRefreshRate = Screen.currentResolution.refreshRate; appRefreshRate = Application.targetFrameRate; if (QualitySettings.vSyncCount == 2) { deviceRefreshRate /= 2; } if (deviceRefreshRate <= 0 && appRefreshRate <= 0) { refreshRate = 60; setDefaultRefreshRate(); } else if (deviceRefreshRate <= 0) { refreshRate = appRefreshRate; } else if (appRefreshRate <= 0) { refreshRate = deviceRefreshRate; setDefaultRefreshRate(); } else if (deviceRefreshRate < appRefreshRate) { refreshRate = deviceRefreshRate; } else { refreshRate = appRefreshRate; } targetFrameTime = 1f / (float)refreshRate * 1000f; ValueBinBuilder valueBinBuilder = new ValueBinBuilder(); valueBinBuilder.AddBin(percList[0] * targetFrameTime); for (int i = 0; i < percList.Length - 1; i++) { float size = (percList[i + 1] - percList[i]) * targetFrameTime; valueBinBuilder.AddBin(size); } deltaTimeMSBins = valueBinBuilder.Result; }
public Result(string experimentName) { name = experimentName; totalSamples = 0; firstFrameNumber = Benchmarking.DataSource.frameCount; memoryUsageAtStart = Benchmarking.DataSource.memoryAllocated; realtimeAtStart = Benchmarking.DataSource.realtimeSinceStartup; deltaTimeMSMin = float.MaxValue; deltaTimeMSMax = 0; populatePercList(); populateUpperboundList(); #if VARIANCE deltaTimeMSVariance = 0; #endif memoryUsageAtPeak = 0; memoryTotal = 0; // Convert memorySystem from megabytes to bytes since all other memory // related data is in bytes memorySystem = SystemInfo.systemMemorySize * (System.Int64) 1048576; deviceRefreshRate = Screen.currentResolution.refreshRate; appRefreshRate = Application.targetFrameRate; // If vSyncCount is 2, device refresh rate will be cut in half if (QualitySettings.vSyncCount == 2) { deviceRefreshRate /= 2; } // Assuming that deviceRefreshRate and appRefreshRate are both > 0, we will use // the smaller of the two refresh rates if (deviceRefreshRate <= 0 && appRefreshRate <= 0) { refreshRate = 60; // Refresh rate will be overwritten if running on iOS to 30. setDefaultRefreshRate(); } else if (deviceRefreshRate <= 0) { refreshRate = appRefreshRate; } else if (appRefreshRate <= 0) { refreshRate = deviceRefreshRate; // Refresh rate will be overwritten if running on iOS to 30. setDefaultRefreshRate(); } else if (deviceRefreshRate < appRefreshRate) { refreshRate = deviceRefreshRate; } else // if appRefreshRate < deviceRefreshRate { refreshRate = appRefreshRate; } targetFrameTime = (1f / refreshRate) * 1000f; // Creating bins var builder = new ValueBinBuilder(); builder.AddBin(percList [0] * targetFrameTime); for (int i = 0; i < percList.Length - 1; i++) { float size = (percList [i + 1] - percList [i]) * targetFrameTime; builder.AddBin(size); } deltaTimeMSBins = builder.Result; }