// Report Utils void FillBuckets(Excel._Worksheet oSheet, GetBucketValue grv, int minValue, int maxValue, float ignoreStart) { /* * float totalTime = 0.0f; * List<float> frameBuckets = new List<float>(maxValue - minValue + 1); * for (int i = 0; i <= maxValue - minValue; i++) * { * frameBuckets.Add(0.0f); * } * ignoreStart += m_logData.m_frameRecords[0].FrameTimeInS; * foreach (FrameRecord fr in m_logData.m_frameRecords) * { * if (fr.FrameTimeInS >= ignoreStart) * { * BucketValue bv = grv(fr); * float fps = bv.fps; * int idx = (int)fps - minValue; * idx = Math.Min(idx, maxValue - minValue); * idx = Math.Max(idx, 0); * frameBuckets[idx] += bv.dt; * totalTime += bv.dt; * } * } * float acc = 0.0f; * for (int i = 0; i < frameBuckets.Count(); i++) * { * oSheet.Cells[i + 1, 1] = i + minValue; * oSheet.Cells[i + 1, 2] = 100.0f * frameBuckets[i] / totalTime; * oSheet.Cells[i + 1, 3] = i + minValue; * oSheet.Cells[i + 1, 4] = acc; * acc += 100.0f * frameBuckets[i] / totalTime; * } * */ }
void BuildFramerateAnalysis(Excel._Workbook oWB, Word.Document oDoc, GetBucketValue grv, string uniqueName, string bookmarkName, float k_ignoreTime, int maxFPS) { const float k_fpsSize = 400.0f; const float aspect = 3.0f / 4.0f; Excel._Worksheet oSheet = AddWorksheet(oWB, uniqueName); FillBuckets(oSheet, grv, 0, maxFPS, k_ignoreTime); Excel._Chart oChart = MakeChart(oWB, oSheet.get_Range("C1", "D61"), Excel.XlChartType.xlXYScatterSmoothNoMarkers, Excel.XlRowCol.xlColumns, 1, 0, false); SetupAxes(oChart, "Frame Rate", 0.0f, maxFPS, "Percentage of Time Below", 0.0f, -1.0f); Word.InlineShape oShape = InsertChart(oChart, oDoc, uniqueName + "acc", bookmarkName, k_fpsSize, k_fpsSize * aspect, 0.5f); oChart = MakeChart(oWB, oSheet.get_Range("A1", "B61"), Excel.XlChartType.xlXYScatterSmoothNoMarkers, Excel.XlRowCol.xlColumns, 1, 0, false); SetupAxes(oChart, "Frame Rate", 0.0f, maxFPS, "Percentage of Time", 0.0f, -1.0f); oShape = InsertChart(oChart, oDoc, uniqueName, bookmarkName, k_fpsSize, k_fpsSize * aspect, 0.5f); }