Beispiel #1
0
        private void UpdateCharts()
        {
            int num  = ProfilerDriver.maxHistoryLength - 1;
            int num2 = ProfilerDriver.lastFrameIndex - num;
            int num3 = Mathf.Max(ProfilerDriver.firstFrameIndex, num2);

            ProfilerChart[] charts = this.m_Charts;
            for (int i = 0; i < charts.Length; i++)
            {
                ProfilerChart profilerChart = charts[i];
                float[]       array         = new float[profilerChart.m_Series.Length];
                for (int j = 0; j < profilerChart.m_Series.Length; j++)
                {
                    int   statisticsIdentifier = ProfilerDriver.GetStatisticsIdentifier(profilerChart.m_Series[j].identifierName);
                    float num4;
                    ProfilerDriver.GetStatisticsValues(statisticsIdentifier, num2, profilerChart.m_DataScale, profilerChart.m_Series[j].data, out num4);
                    num4 = Mathf.Max(num4, 0.0001f);
                    float num5;
                    if (profilerChart.m_Type == Chart.ChartType.Line)
                    {
                        num5 = 1f / (num4 * (1.05f + (float)j * 0.05f));
                    }
                    else
                    {
                        num5 = 1f / num4;
                    }
                    array[j] = num5;
                }
                if (profilerChart.m_Type == Chart.ChartType.Line)
                {
                    profilerChart.m_Data.AssignScale(array);
                }
                profilerChart.m_Data.Assign(profilerChart.m_Series, num2, num3);
            }
            string        selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
            bool          flag           = selectedPropertyPath != string.Empty && this.m_CurrentArea == ProfilerArea.CPU;
            ProfilerChart profilerChart2 = this.m_Charts[0];

            if (flag)
            {
                profilerChart2.m_Data.hasOverlay = true;
                ChartSeries[] series = profilerChart2.m_Series;
                for (int k = 0; k < series.Length; k++)
                {
                    ChartSeries chartSeries           = series[k];
                    int         statisticsIdentifier2 = ProfilerDriver.GetStatisticsIdentifier("Selected" + chartSeries.identifierName);
                    chartSeries.CreateOverlayData();
                    float num6;
                    ProfilerDriver.GetStatisticsValues(statisticsIdentifier2, num2, profilerChart2.m_DataScale, chartSeries.overlayData, out num6);
                }
            }
            else
            {
                profilerChart2.m_Data.hasOverlay = false;
            }
            for (ProfilerArea profilerArea = ProfilerArea.CPU; profilerArea <= ProfilerArea.GPU; profilerArea++)
            {
                ProfilerChart profilerChart3 = this.m_Charts[(int)profilerArea];
                float         num7           = 0f;
                float         num8           = 0f;
                for (int l = 0; l < num; l++)
                {
                    float num9 = 0f;
                    for (int m = 0; m < profilerChart3.m_Series.Length; m++)
                    {
                        if (profilerChart3.m_Series[m].enabled)
                        {
                            num9 += profilerChart3.m_Series[m].data[l];
                        }
                    }
                    if (num9 > num7)
                    {
                        num7 = num9;
                    }
                    if (num9 > num8 && l + num2 >= num3 + 1)
                    {
                        num8 = num9;
                    }
                }
                if (num8 != 0f)
                {
                    num7 = num8;
                }
                num7 = Math.Min(num7, this.m_ChartMaxClamp);
                if (this.m_ChartOldMax[(int)profilerArea] > 0f)
                {
                    num7 = Mathf.Lerp(this.m_ChartOldMax[(int)profilerArea], num7, 0.4f);
                }
                this.m_ChartOldMax[(int)profilerArea] = num7;
                profilerChart3.m_Data.AssignScale(new float[]
                {
                    1f / num7
                });
                ProfilerWindow.UpdateChartGrid(num7, profilerChart3.m_Data);
            }
            string notSupportedWarning = null;

            if (ProfilerDriver.isGPUProfilerBuggyOnDriver)
            {
                notSupportedWarning = "Graphics card driver returned invalid timing information. Please update to a newer version if available.";
            }
            else
            {
                if (!ProfilerDriver.isGPUProfilerSupported)
                {
                    notSupportedWarning = "GPU profiling is not supported by the graphics card driver. Please update to a newer version if available.";
                    if (Application.platform == RuntimePlatform.OSXEditor)
                    {
                        if (!ProfilerDriver.isGPUProfilerSupportedByOS)
                        {
                            notSupportedWarning = "GPU profiling requires Mac OS X 10.7 (Lion) and a capable video card. GPU profiling is currently not supported on mobile.";
                        }
                        else
                        {
                            notSupportedWarning = "GPU profiling is not supported by the graphics card driver (or it was disabled because of driver bugs).";
                        }
                    }
                }
            }
            this.m_Charts[1].m_Chart.m_NotSupportedWarning = notSupportedWarning;
        }