private void UpdateCharts()
{
int num = ProfilerDriver.maxHistoryLength - 1;
int b = ProfilerDriver.lastFrameIndex - num;
int firstSelectableFrame = Mathf.Max(ProfilerDriver.firstFrameIndex, b);
foreach (ProfilerChart chart in this.m_Charts)
{
float num5 = 1f;
float[] scale = new float[chart.m_Series.Length];
for (int i = 0; i < chart.m_Series.Length; i++)
{
float num8;
float num9;
ProfilerDriver.GetStatisticsValues(ProfilerDriver.GetStatisticsIdentifier(chart.m_Series[i].identifierName), b, chart.m_DataScale, chart.m_Series[i].data, out num8);
num8 = Mathf.Max(num8, 0.0001f);
if (num8 > num5)
{
num5 = num8;
}
if (chart.m_Type == Chart.ChartType.Line)
{
num9 = 1f / (num8 * (1.05f + (i * 0.05f)));
}
else
{
num9 = 1f / num8;
}
scale[i] = num9;
}
if (chart.m_Type == Chart.ChartType.Line)
{
chart.m_Data.AssignScale(scale);
}
if ((chart.m_Area == ProfilerArea.NetworkMessages) || (chart.m_Area == ProfilerArea.NetworkOperations))
{
for (int j = 0; j < chart.m_Series.Length; j++)
{
scale[j] = 0.9f / num5;
}
chart.m_Data.AssignScale(scale);
chart.m_Data.maxValue = num5;
}
chart.m_Data.Assign(chart.m_Series, b, firstSelectableFrame);
}
bool flag = (ProfilerDriver.selectedPropertyPath != string.Empty) && (this.m_CurrentArea == ProfilerArea.CPU);
ProfilerChart chart2 = this.m_Charts[0];
if (flag)
{
chart2.m_Data.hasOverlay = true;
foreach (ChartSeries series in chart2.m_Series)
{
float num13;
int statisticsIdentifier = ProfilerDriver.GetStatisticsIdentifier("Selected" + series.identifierName);
series.CreateOverlayData();
ProfilerDriver.GetStatisticsValues(statisticsIdentifier, b, chart2.m_DataScale, series.overlayData, out num13);
}
}
else
{
chart2.m_Data.hasOverlay = false;
}
for (ProfilerArea area = ProfilerArea.CPU; area <= ProfilerArea.GPU; area += 1)
{
ProfilerChart chart3 = this.m_Charts[(int) area];
float num14 = 0f;
float num15 = 0f;
for (int k = 0; k < num; k++)
{
float num17 = 0f;
for (int m = 0; m < chart3.m_Series.Length; m++)
{
if (chart3.m_Series[m].enabled)
{
num17 += chart3.m_Series[m].data[k];
}
}
if (num17 > num14)
{
num14 = num17;
}
if ((num17 > num15) && ((k + b) >= (firstSelectableFrame + 1)))
{
num15 = num17;
}
}
if (num15 != 0f)
{
num14 = num15;
}
num14 = Math.Min(num14, this.m_ChartMaxClamp);
if (this.m_ChartOldMax[(int) area] > 0f)
{
num14 = Mathf.Lerp(this.m_ChartOldMax[(int) area], num14, 0.4f);
}
this.m_ChartOldMax[(int) area] = num14;
float[] singleArray1 = new float[] { 1f / num14 };
chart3.m_Data.AssignScale(singleArray1);
UpdateChartGrid(num14, chart3.m_Data);
}
string str2 = null;
if (!ProfilerDriver.isGPUProfilerSupported)
{
str2 = "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)
{
str2 = "GPU profiling requires Mac OS X 10.7 (Lion) and a capable video card. GPU profiling is currently not supported on mobile.";
}
else
{
str2 = "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 = str2;
}