public override void OnGUI(Rect rect) { Rect source = new Rect(rect); if (this.m_ShowAutoInstrumemtationParams) { Rect position = new Rect(source) { height = 20f }; InstrumentedAssemblyTypes none = InstrumentedAssemblyTypes.None; if (GUI.Toggle(position, (this.m_AutoInstrumentedAssemblyTypes & InstrumentedAssemblyTypes.Script) != InstrumentedAssemblyTypes.None, s_AutoInstrumentScriptsContent)) { none |= InstrumentedAssemblyTypes.Script; } if (none != this.m_AutoInstrumentedAssemblyTypes) { this.m_AutoInstrumentedAssemblyTypes = none; ProfilerDriver.SetAutoInstrumentedAssemblies(this.m_AutoInstrumentedAssemblyTypes); SessionState.SetInt("ProfilerAutoInstrumentedAssemblyTypes", (int)this.m_AutoInstrumentedAssemblyTypes); } source.y += 20f; source.height -= 20f; } this.m_FunctionsList.OnGUI(source); }
void ProfilerInstrumentationPopupCallback(PopupList.ListElement element) { if (element == m_AllCheckbox) { element.selected = !element.selected; foreach (var child in m_FunctionsListInputData.m_ListElements) { if (element.selected) { ProfilerDriver.BeginInstrumentFunction(child.text); } else { ProfilerDriver.EndInstrumentFunction(child.text); } child.selected = element.selected; } } else { element.selected = !element.selected; if (element.selected) { ProfilerDriver.BeginInstrumentFunction(element.text); } else { ProfilerDriver.EndInstrumentFunction(element.text); } } UpdateAllCheckbox(); }
public virtual int DoChartGUI(Rect chartRect, int currentFrame, bool active) { if (Event.current.type == EventType.Repaint) { string[] labels = new string[m_Series.Length]; for (int s = 0; s < m_Series.Length; s++) { string name = m_Data.hasOverlay ? "Selected" + m_Series[s].name : m_Series[s].name; if (usesCounters) { labels[s] = ProfilerDriver.GetFormattedCounterValue(currentFrame, m_Series[s].category, name); } else { labels[s] = ProfilerDriver.GetFormattedCounterValue(currentFrame, m_Area, name); } } m_Data.AssignSelectedLabels(labels); } if (legendHeaderLabel == null) { legendHeaderLabel = new GUIContent(m_LocalizedName, EditorGUIUtility.LoadIconRequired(m_IconName), Tooltip); } return(DoGUI(chartRect, m_Type, currentFrame, m_Data, active)); }
public override void OnGUI(Rect rect) { Rect r = new Rect(rect); if (m_ShowAutoInstrumemtationParams) { Rect toggleRect = new Rect(r); toggleRect.height = kAutoInstrumentButtonHeight; // TODO: Use reflection and foreach on InstrumentedAssemblyTypes values var newAutoInstrumentedAssemblies = InstrumentedAssemblyTypes.None; if (GUI.Toggle(toggleRect, (m_AutoInstrumentedAssemblyTypes & InstrumentedAssemblyTypes.Script) != 0, s_AutoInstrumentScriptsContent)) { newAutoInstrumentedAssemblies |= InstrumentedAssemblyTypes.Script; } if (newAutoInstrumentedAssemblies != m_AutoInstrumentedAssemblyTypes) { m_AutoInstrumentedAssemblyTypes = newAutoInstrumentedAssemblies; ProfilerDriver.SetAutoInstrumentedAssemblies(m_AutoInstrumentedAssemblyTypes); SessionState.SetInt(kAutoInstrumentSettingKey, (int)m_AutoInstrumentedAssemblyTypes); } r.y += kAutoInstrumentButtonsHeight; r.height -= kAutoInstrumentButtonsHeight; } m_FunctionsList.OnGUI(r); }
public virtual int DoChartGUI(int currentFrame, bool active) { if (Event.current.type == EventType.Repaint) { string[] labels = new string[m_Series.Length]; for (int s = 0; s < m_Series.Length; s++) { string name = m_Data.hasOverlay ? "Selected" + m_Series[s].name : m_Series[s].name; int identifier = ProfilerDriver.GetStatisticsIdentifierForArea(m_Area, name); labels[s] = ProfilerDriver.GetFormattedStatisticsValue(currentFrame, identifier); } m_Data.AssignSelectedLabels(labels); } if (legendHeaderLabel == null) { string iconName = string.Format("Profiler.{0}", System.Enum.GetName(typeof(ProfilerArea), m_Area)); legendHeaderLabel = EditorGUIUtility.TextContentWithIcon(GetLocalizedChartName(), iconName); } return(DoGUI(m_Type, currentFrame, m_Data, active)); }
private void ProfilerInstrumentationPopupCallback(PopupList.ListElement element) { if (element == this.m_AllCheckbox) { element.selected = !element.selected; foreach (PopupList.ListElement element2 in this.m_FunctionsListInputData.m_ListElements) { if (element.selected) { ProfilerDriver.BeginInstrumentFunction(element2.text); } else { ProfilerDriver.EndInstrumentFunction(element2.text); } element2.selected = element.selected; } } else { element.selected = !element.selected; if (element.selected) { ProfilerDriver.BeginInstrumentFunction(element.text); } else { ProfilerDriver.EndInstrumentFunction(element.text); } } this.UpdateAllCheckbox(); }
private void ApplyActiveState() { // Opening/Closing CPU chart should not set the CPU area as that would set Profiler.enabled. if (m_Area != ProfilerArea.CPU) { ProfilerDriver.SetAreaEnabled(m_Area, active); } }
public static void Show(Rect r, string funcName) { ProfilerInstrumentationPopup windowContent = new ProfilerInstrumentationPopup(null, true, false); s_PendingPopup = windowContent; ProfilerDriver.QueryFunctionCallees(funcName); PopupWindow.Show(r, windowContent); }
public static void Show(Rect r, string funcName) { ProfilerInstrumentationPopup instrumentationPopup = new ProfilerInstrumentationPopup((Dictionary <string, int>)null, true, false); ProfilerInstrumentationPopup.s_PendingPopup = instrumentationPopup; ProfilerDriver.QueryFunctionCallees(funcName); PopupWindow.Show(r, (PopupWindowContent)instrumentationPopup); }
public static void Show(Rect r, string funcName) { var popup = new ProfilerInstrumentationPopup(null, true, false); s_PendingPopup = popup; ProfilerDriver.QueryFunctionCallees(funcName); PopupWindow.Show(r, popup); }
public virtual void UpdateData(int firstEmptyFrame, int firstFrame, int frameCount) { // Clear the data available buffer prior to iterating over chart series. if (m_Series.Length > 0) { m_Data.ClearDataAvailableBuffer(); } // Iterate over all chart series pulling counter data. float totalMaxValue = 1; for (int i = 0, count = m_Series.Length; i < count; ++i) { float maxValue; if (usesCounters) { // Retrieve counter values by category name & counter name. ProfilerDriver.GetCounterValuesWithAvailabilityBatchByCategory(m_Series[i].category, m_Series[i].name, firstEmptyFrame, 1.0f, m_Series[i].yValues, m_Data.dataAvailable, out maxValue); } else { // Retrieve counter values by area & counter name. ProfilerDriver.GetCounterValuesWithAvailabilityBatch(m_Area, m_Series[i].name, firstEmptyFrame, 1.0f, m_Series[i].yValues, m_Data.dataAvailable, out maxValue); } m_Series[i].yScale = m_DataScale; maxValue *= m_DataScale; // Minimum size so we don't generate nans during drawing maxValue = Mathf.Max(maxValue, 0.0001F); if (maxValue > totalMaxValue) { totalMaxValue = maxValue; } if (m_Type == ProfilerModuleChartType.Line) { // Scale line charts so they never hit the top. Scale them slightly differently for each line // so that in "no stuff changing" case they will not end up being exactly the same. maxValue *= (1.05f + i * 0.05f); m_Series[i].rangeAxis = new Vector2(0f, maxValue); } } if (m_SharedScale && m_Type == ProfilerModuleChartType.Line) { // For some charts, every line is scaled individually, so every data series gets their own range based on their own max scale. // For charts that share their scale (like the Networking charts) all series get adjusted to the total max of the chart. for (int i = 0, count = m_Series.Length; i < count; ++i) { m_Series[i].rangeAxis = new Vector2(0f, (1.05f + i * 0.05f) * totalMaxValue); } m_Data.maxValue = totalMaxValue; } m_Data.Assign(m_Series, firstEmptyFrame, firstFrame); }
public static void Show(Rect r) { ProfilerInstrumentationPopup windowContent = new ProfilerInstrumentationPopup(s_InstrumentableFunctions, false, true); if (s_InstrumentableFunctions == null) { s_PendingPopup = windowContent; ProfilerDriver.QueryInstrumentableFunctions(); } else { s_PendingPopup = null; } PopupWindow.Show(r, windowContent); }
public static void Show(Rect r) { ProfilerInstrumentationPopup instrumentationPopup = new ProfilerInstrumentationPopup(ProfilerInstrumentationPopup.s_InstrumentableFunctions, false, true); if (ProfilerInstrumentationPopup.s_InstrumentableFunctions == null) { ProfilerInstrumentationPopup.s_PendingPopup = instrumentationPopup; ProfilerDriver.QueryInstrumentableFunctions(); } else { ProfilerInstrumentationPopup.s_PendingPopup = (ProfilerInstrumentationPopup)null; } PopupWindow.Show(r, (PopupWindowContent)instrumentationPopup); }
public int DoChartGUI(int currentFrame, ProfilerArea currentArea, out Chart.ChartAction action) { if (Event.current.type == EventType.Repaint) { string[] strArray = new string[this.m_Series.Length]; for (int index = 0; index < this.m_Series.Length; ++index) { int statisticsIdentifier = ProfilerDriver.GetStatisticsIdentifier(!this.m_Data.hasOverlay ? this.m_Series[index].identifierName : "Selected" + this.m_Series[index].identifierName); strArray[index] = ProfilerDriver.GetFormattedStatisticsValue(currentFrame, statisticsIdentifier); } this.m_Data.selectedLabels = strArray; } if (this.m_Icon == null) { this.m_Icon = EditorGUIUtility.TextContentWithIcon(this.GetLocalizedChartName(), "Profiler." + Enum.GetName(typeof(ProfilerArea), (object)this.m_Area)); } return(this.m_Chart.DoGUI(this.m_Type, currentFrame, this.m_Data, this.m_Area, currentArea == this.m_Area, this.m_Icon, out action)); }
public void UpdateOverlayData(int firstEmptyFrame) { m_Data.hasOverlay = true; int numCharts = m_Data.numSeries; for (int i = 0; i < numCharts; ++i) { var chart = m_Data.series[i]; var length = chart.yValues.Length; if (m_Data.overlays[i] == null || m_Data.overlays[i].yValues.Length != length) { m_Data.overlays[i] = new ChartSeriesViewData(chart.name, chart.category, length, chart.color); } float maxValue; ProfilerDriver.GetCounterValuesBatch(ProfilerArea.CPU, UnityString.Format("Selected{0}", chart.name), firstEmptyFrame, 1.0f, m_Data.overlays[i].yValues, out maxValue); m_Data.overlays[i].yScale = m_DataScale; } }
public int DoChartGUI(int currentFrame, ProfilerArea currentArea, out Chart.ChartAction action) { if (Event.current.type == EventType.Repaint) { string[] array = new string[this.m_Series.Length]; for (int i = 0; i < this.m_Series.Length; i++) { string propertyName = (!this.m_Data.hasOverlay) ? this.m_Series[i].identifierName : ("Selected" + this.m_Series[i].identifierName); int statisticsIdentifier = ProfilerDriver.GetStatisticsIdentifier(propertyName); array[i] = ProfilerDriver.GetFormattedStatisticsValue(currentFrame, statisticsIdentifier); } this.m_Data.selectedLabels = array; } if (this.m_Icon == null) { this.m_Icon = EditorGUIUtility.TextContent("Profiler." + Enum.GetName(typeof(ProfilerArea), this.m_Area)); } return(this.m_Chart.DoGUI(this.m_Type, currentFrame, this.m_Data, this.m_Area, currentArea == this.m_Area, this.m_Icon, out action)); }
public virtual int DoChartGUI(int currentFrame, ProfilerArea currentArea) { if (Event.current.type == EventType.Repaint) { string[] array = new string[this.m_Series.Length]; for (int i = 0; i < this.m_Series.Length; i++) { string propertyName = (!this.m_Data.hasOverlay) ? this.m_Series[i].name : ("Selected" + this.m_Series[i].name); int statisticsIdentifier = ProfilerDriver.GetStatisticsIdentifier(propertyName); array[i] = ProfilerDriver.GetFormattedStatisticsValue(currentFrame, statisticsIdentifier); } this.m_Data.AssignSelectedLabels(array); } if (base.legendHeaderLabel == null) { string icon = string.Format("Profiler.{0}", Enum.GetName(typeof(ProfilerArea), this.m_Area)); base.legendHeaderLabel = EditorGUIUtility.TextContentWithIcon(this.GetLocalizedChartName(), icon); } return(base.DoGUI(this.m_Type, currentFrame, this.m_Data, currentArea == this.m_Area)); }
private void ProfilerInstrumentationPopupCallback(PopupList.ListElement element) { if (element == this.m_AllCheckbox) { element.selected = !element.selected; using (List <PopupList.ListElement> .Enumerator enumerator = this.m_FunctionsListInputData.m_ListElements.GetEnumerator()) { while (enumerator.MoveNext()) { PopupList.ListElement current = enumerator.Current; if (element.selected) { ProfilerDriver.BeginInstrumentFunction(current.text); } else { ProfilerDriver.EndInstrumentFunction(current.text); } current.selected = element.selected; } } } else { element.selected = !element.selected; if (element.selected) { ProfilerDriver.BeginInstrumentFunction(element.text); } else { ProfilerDriver.EndInstrumentFunction(element.text); } } this.UpdateAllCheckbox(); }
public override void OnGUI(Rect rect) { Rect rect1 = new Rect(rect); if (this.m_ShowAutoInstrumemtationParams) { Rect position = new Rect(rect1); position.height = 20f; InstrumentedAssemblyTypes instrumentedAssemblyTypes = InstrumentedAssemblyTypes.None; if (GUI.Toggle(position, (this.m_AutoInstrumentedAssemblyTypes & InstrumentedAssemblyTypes.Script) != InstrumentedAssemblyTypes.None, ProfilerInstrumentationPopup.s_AutoInstrumentScriptsContent)) { instrumentedAssemblyTypes |= InstrumentedAssemblyTypes.Script; } if (instrumentedAssemblyTypes != this.m_AutoInstrumentedAssemblyTypes) { this.m_AutoInstrumentedAssemblyTypes = instrumentedAssemblyTypes; ProfilerDriver.SetAutoInstrumentedAssemblies(this.m_AutoInstrumentedAssemblyTypes); SessionState.SetInt("ProfilerAutoInstrumentedAssemblyTypes", (int)this.m_AutoInstrumentedAssemblyTypes); } rect1.y += 20f; rect1.height -= 20f; } this.m_FunctionsList.OnGUI(rect1); }
public void DoGUI(FrameDataView frameDataView, float width, float ypos, float height) { if (frameDataView == null || !frameDataView.IsValid()) { GUILayout.Label(BaseStyles.noData, BaseStyles.label); return; } Rect fullRect = new Rect(0, ypos - 1, width, height + 1); float sideWidth = Chart.kSideWidth - 1; if (Event.current.type == EventType.Repaint) { styles.profilerGraphBackground.Draw(fullRect, false, false, false, false); // The bar in the lower left side that fills the space next to the horizontal scrollbar. EditorStyles.toolbar.Draw(new Rect(0, ypos + height - 15, sideWidth, 15), false, false, false, false); } bool initializing = false; if (m_TimeArea == null) { initializing = true; m_TimeArea = new ZoomableArea(); m_TimeArea.hRangeLocked = false; m_TimeArea.vRangeLocked = true; m_TimeArea.hSlider = true; m_TimeArea.vSlider = false; m_TimeArea.scaleWithWindow = true; m_TimeArea.rect = new Rect(fullRect.x + sideWidth - 1, fullRect.y, fullRect.width - sideWidth, fullRect.height); m_TimeArea.margin = 10; } if (initializing) { NativeProfilerTimeline_InitializeArgs args = new NativeProfilerTimeline_InitializeArgs(); args.Reset(); args.ghostAlpha = 0.3f; args.nonSelectedAlpha = 0.75f; args.guiStyle = styles.bar.m_Ptr; args.lineHeight = kLineHeight; args.textFadeOutWidth = kTextFadeOutWidth; args.textFadeStartWidth = kTextFadeStartWidth; NativeProfilerTimeline.Initialize(ref args); } var iter = new ProfilerFrameDataIterator(); int threadCount = iter.GetThreadCount(frameDataView.frameIndex); iter.SetRoot(frameDataView.frameIndex, 0); m_TimeArea.hBaseRangeMin = 0; m_TimeArea.hBaseRangeMax = iter.frameTimeMS; if (initializing) { PerformFrameSelected(iter.frameTimeMS); } m_TimeArea.rect = new Rect(fullRect.x + sideWidth, fullRect.y, fullRect.width - sideWidth, fullRect.height); m_TimeArea.BeginViewGUI(); m_TimeArea.EndViewGUI(); fullRect = m_TimeArea.drawRect; DrawGrid(fullRect, iter.frameTimeMS); MarkDeadOrClearThread(); CalculateBars(ref iter, fullRect, frameDataView.frameIndex, animationTime); DrawBars(fullRect, frameDataView.frameIndex); DoRangeSelection(m_TimeArea.drawRect); GUI.BeginClip(m_TimeArea.drawRect); fullRect.x = 0; fullRect.y = 0; bool oldEnabled = GUI.enabled; GUI.enabled = false; // Walk backwards to find how many previous frames we need to show. int maxContextFramesToShow = m_Window.IsRecording() ? 1 : 3; int numContextFramesToShow = maxContextFramesToShow; int currentFrame = frameDataView.frameIndex; float currentTime = 0; do { int prevFrame = ProfilerDriver.GetPreviousFrameIndex(currentFrame); if (prevFrame == -1) { break; } iter.SetRoot(prevFrame, 0); currentTime -= iter.frameTimeMS; currentFrame = prevFrame; --numContextFramesToShow; }while (currentTime > m_TimeArea.shownArea.x && numContextFramesToShow > 0); // Draw previous frames while (currentFrame != -1 && currentFrame != frameDataView.frameIndex) { iter.SetRoot(currentFrame, 0); DoProfilerFrame(currentFrame, fullRect, true, threadCount, currentTime); currentTime += iter.frameTimeMS; currentFrame = ProfilerDriver.GetNextFrameIndex(currentFrame); } // Draw next frames numContextFramesToShow = maxContextFramesToShow; currentFrame = frameDataView.frameIndex; currentTime = 0; while (currentTime < m_TimeArea.shownArea.x + m_TimeArea.shownArea.width && numContextFramesToShow >= 0) { if (frameDataView.frameIndex != currentFrame) { DoProfilerFrame(currentFrame, fullRect, true, threadCount, currentTime); } iter.SetRoot(currentFrame, 0); currentFrame = ProfilerDriver.GetNextFrameIndex(currentFrame); if (currentFrame == -1) { break; } currentTime += iter.frameTimeMS; --numContextFramesToShow; } GUI.enabled = oldEnabled; // Draw center frame last to get on top threadCount = 0; DoProfilerFrame(frameDataView.frameIndex, fullRect, false, threadCount, 0); GUI.EndClip(); // Draw tooltips on top of clip to be able to extend outside of timeline area DoSelectionTooltip(frameDataView.frameIndex, m_TimeArea.drawRect); }
public static void UpdateInstrumentableFunctions() { ProfilerDriver.QueryInstrumentableFunctions(); }
public void DoGUI(int frameIndex, float width, float ypos, float height) { Rect drawRect = new Rect(0f, ypos - 1f, width, height + 1f); float num = 169f; if (Event.current.type == EventType.Repaint) { ProfilerTimelineGUI.styles.profilerGraphBackground.Draw(drawRect, false, false, false, false); EditorStyles.toolbar.Draw(new Rect(0f, ypos + height - 15f, num, 15f), false, false, false, false); } bool flag = false; if (this.m_TimeArea == null) { flag = true; this.m_TimeArea = new ZoomableArea(); this.m_TimeArea.hRangeLocked = false; this.m_TimeArea.vRangeLocked = true; this.m_TimeArea.hSlider = true; this.m_TimeArea.vSlider = false; this.m_TimeArea.scaleWithWindow = true; this.m_TimeArea.rect = new Rect(drawRect.x + num - 1f, drawRect.y, drawRect.width - num, drawRect.height); this.m_TimeArea.margin = 10f; this.m_TimeArea.OnEnable(); } ProfilerFrameDataIterator profilerFrameDataIterator = new ProfilerFrameDataIterator(); profilerFrameDataIterator.SetRoot(frameIndex, 0); this.m_TimeArea.hBaseRangeMin = 0f; this.m_TimeArea.hBaseRangeMax = profilerFrameDataIterator.frameTimeMS; if (flag) { this.PerformFrameSelected(profilerFrameDataIterator.frameTimeMS); } this.m_TimeArea.rect = new Rect(drawRect.x + num, drawRect.y, drawRect.width - num, drawRect.height); this.m_TimeArea.BeginViewGUI(); this.m_TimeArea.EndViewGUI(); drawRect = this.m_TimeArea.drawRect; this.DrawBars(drawRect, frameIndex); GUI.BeginClip(this.m_TimeArea.drawRect); drawRect.x = 0f; drawRect.y = 0f; int num2 = 0; this.DoProfilerFrame(frameIndex, drawRect, false, ref num2, 0f); bool enabled = GUI.enabled; GUI.enabled = false; int previousFrameIndex = ProfilerDriver.GetPreviousFrameIndex(frameIndex); if (previousFrameIndex != -1) { ProfilerFrameDataIterator profilerFrameDataIterator2 = new ProfilerFrameDataIterator(); profilerFrameDataIterator2.SetRoot(previousFrameIndex, 0); this.DoProfilerFrame(previousFrameIndex, drawRect, true, ref num2, -profilerFrameDataIterator2.frameTimeMS); } int nextFrameIndex = ProfilerDriver.GetNextFrameIndex(frameIndex); if (nextFrameIndex != -1) { ProfilerFrameDataIterator profilerFrameDataIterator3 = new ProfilerFrameDataIterator(); profilerFrameDataIterator3.SetRoot(frameIndex, 0); this.DoProfilerFrame(nextFrameIndex, drawRect, true, ref num2, profilerFrameDataIterator3.frameTimeMS); } GUI.enabled = enabled; GUI.EndClip(); }
public void DoGUI(FrameDataView frameDataView, float width, float ypos, float height) { if (frameDataView == null || !frameDataView.IsValid()) { GUILayout.Label(ProfilerFrameDataViewBase.BaseStyles.noData, ProfilerFrameDataViewBase.BaseStyles.label, new GUILayoutOption[0]); } else { Rect drawRect = new Rect(0f, ypos - 1f, width, height + 1f); float num = 179f; if (Event.current.type == EventType.Repaint) { ProfilerTimelineGUI.styles.profilerGraphBackground.Draw(drawRect, false, false, false, false); EditorStyles.toolbar.Draw(new Rect(0f, ypos + height - 15f, num, 15f), false, false, false, false); } bool flag = false; if (this.m_TimeArea == null) { flag = true; this.m_TimeArea = new ZoomableArea(); this.m_TimeArea.hRangeLocked = false; this.m_TimeArea.vRangeLocked = true; this.m_TimeArea.hSlider = true; this.m_TimeArea.vSlider = false; this.m_TimeArea.scaleWithWindow = true; this.m_TimeArea.rect = new Rect(drawRect.x + num - 1f, drawRect.y, drawRect.width - num, drawRect.height); this.m_TimeArea.margin = 10f; } if (flag) { NativeProfilerTimeline_InitializeArgs nativeProfilerTimeline_InitializeArgs = default(NativeProfilerTimeline_InitializeArgs); nativeProfilerTimeline_InitializeArgs.Reset(); nativeProfilerTimeline_InitializeArgs.ghostAlpha = 0.3f; nativeProfilerTimeline_InitializeArgs.nonSelectedAlpha = 0.75f; nativeProfilerTimeline_InitializeArgs.guiStyle = ProfilerTimelineGUI.styles.bar.m_Ptr; nativeProfilerTimeline_InitializeArgs.lineHeight = 16f; nativeProfilerTimeline_InitializeArgs.textFadeOutWidth = 20f; nativeProfilerTimeline_InitializeArgs.textFadeStartWidth = 50f; NativeProfilerTimeline.Initialize(ref nativeProfilerTimeline_InitializeArgs); } ProfilerFrameDataIterator profilerFrameDataIterator = new ProfilerFrameDataIterator(); int threadCount = profilerFrameDataIterator.GetThreadCount(frameDataView.frameIndex); profilerFrameDataIterator.SetRoot(frameDataView.frameIndex, 0); this.m_TimeArea.hBaseRangeMin = 0f; this.m_TimeArea.hBaseRangeMax = profilerFrameDataIterator.frameTimeMS; if (flag) { this.PerformFrameSelected(profilerFrameDataIterator.frameTimeMS); } this.m_TimeArea.rect = new Rect(drawRect.x + num, drawRect.y, drawRect.width - num, drawRect.height); this.m_TimeArea.BeginViewGUI(); this.m_TimeArea.EndViewGUI(); drawRect = this.m_TimeArea.drawRect; this.DrawGrid(drawRect, profilerFrameDataIterator.frameTimeMS); this.MarkDeadOrClearThread(); this.CalculateBars(ref profilerFrameDataIterator, drawRect, frameDataView.frameIndex, this.animationTime); this.DrawBars(drawRect, frameDataView.frameIndex); this.DoRangeSelection(this.m_TimeArea.drawRect); GUI.BeginClip(this.m_TimeArea.drawRect); drawRect.x = 0f; drawRect.y = 0f; bool enabled = GUI.enabled; GUI.enabled = false; int num2 = (!this.m_Window.IsRecording()) ? 3 : 1; int num3 = num2; int num4 = frameDataView.frameIndex; float num5 = 0f; do { int previousFrameIndex = ProfilerDriver.GetPreviousFrameIndex(num4); if (previousFrameIndex == -1) { break; } profilerFrameDataIterator.SetRoot(previousFrameIndex, 0); num5 -= profilerFrameDataIterator.frameTimeMS; num4 = previousFrameIndex; num3--; }while (num5 > this.m_TimeArea.shownArea.x && num3 > 0); while (num4 != -1 && num4 != frameDataView.frameIndex) { profilerFrameDataIterator.SetRoot(num4, 0); this.DoProfilerFrame(num4, drawRect, true, threadCount, num5); num5 += profilerFrameDataIterator.frameTimeMS; num4 = ProfilerDriver.GetNextFrameIndex(num4); } num3 = num2; num4 = frameDataView.frameIndex; num5 = 0f; while (num5 < this.m_TimeArea.shownArea.x + this.m_TimeArea.shownArea.width && num3 >= 0) { if (frameDataView.frameIndex != num4) { this.DoProfilerFrame(num4, drawRect, true, threadCount, num5); } profilerFrameDataIterator.SetRoot(num4, 0); num4 = ProfilerDriver.GetNextFrameIndex(num4); if (num4 == -1) { break; } num5 += profilerFrameDataIterator.frameTimeMS; num3--; } GUI.enabled = enabled; threadCount = 0; this.DoProfilerFrame(frameDataView.frameIndex, drawRect, false, threadCount, 0f); GUI.EndClip(); this.DoSelectionTooltip(frameDataView.frameIndex, this.m_TimeArea.drawRect); } }
public void DoGUI(int frameIndex, float width, float ypos, float height) { Rect drawRect = new Rect(0f, ypos - 1f, width, height + 1f); float num = 169f; if (Event.current.type == EventType.Repaint) { ProfilerTimelineGUI.styles.profilerGraphBackground.Draw(drawRect, false, false, false, false); EditorStyles.toolbar.Draw(new Rect(0f, ypos + height - 15f, num, 15f), false, false, false, false); } bool flag = false; if (this.m_TimeArea == null) { flag = true; this.m_TimeArea = new ZoomableArea(); this.m_TimeArea.hRangeLocked = false; this.m_TimeArea.vRangeLocked = true; this.m_TimeArea.hSlider = true; this.m_TimeArea.vSlider = false; this.m_TimeArea.scaleWithWindow = true; this.m_TimeArea.rect = new Rect(drawRect.x + num - 1f, drawRect.y, drawRect.width - num, drawRect.height); this.m_TimeArea.margin = 10f; } if (flag) { NativeProfilerTimeline_InitializeArgs nativeProfilerTimeline_InitializeArgs = default(NativeProfilerTimeline_InitializeArgs); nativeProfilerTimeline_InitializeArgs.Reset(); nativeProfilerTimeline_InitializeArgs.profilerColors = ProfilerColors.colors; nativeProfilerTimeline_InitializeArgs.allocationSampleColor = ProfilerColors.allocationSample; nativeProfilerTimeline_InitializeArgs.internalSampleColor = ProfilerColors.internalSample; nativeProfilerTimeline_InitializeArgs.ghostAlpha = 0.3f; nativeProfilerTimeline_InitializeArgs.nonSelectedAlpha = 0.75f; nativeProfilerTimeline_InitializeArgs.guiStyle = ProfilerTimelineGUI.styles.bar.m_Ptr; nativeProfilerTimeline_InitializeArgs.lineHeight = 16f; nativeProfilerTimeline_InitializeArgs.textFadeOutWidth = 20f; nativeProfilerTimeline_InitializeArgs.textFadeStartWidth = 50f; NativeProfilerTimeline.Initialize(ref nativeProfilerTimeline_InitializeArgs); } ProfilerFrameDataIterator profilerFrameDataIterator = new ProfilerFrameDataIterator(); profilerFrameDataIterator.SetRoot(frameIndex, 0); this.m_TimeArea.hBaseRangeMin = 0f; this.m_TimeArea.hBaseRangeMax = profilerFrameDataIterator.frameTimeMS; if (flag) { this.PerformFrameSelected(profilerFrameDataIterator.frameTimeMS); } this.m_TimeArea.rect = new Rect(drawRect.x + num, drawRect.y, drawRect.width - num, drawRect.height); this.m_TimeArea.BeginViewGUI(); this.m_TimeArea.EndViewGUI(); drawRect = this.m_TimeArea.drawRect; this.CalculateBars(drawRect, frameIndex, this.animationTime); this.DrawBars(drawRect, frameIndex); GUI.BeginClip(this.m_TimeArea.drawRect); drawRect.x = 0f; drawRect.y = 0f; bool enabled = GUI.enabled; GUI.enabled = false; ProfilerFrameDataIterator profilerFrameDataIterator2 = new ProfilerFrameDataIterator(); int threadCount = profilerFrameDataIterator2.GetThreadCount(frameIndex); int previousFrameIndex = ProfilerDriver.GetPreviousFrameIndex(frameIndex); if (previousFrameIndex != -1) { profilerFrameDataIterator2.SetRoot(previousFrameIndex, 0); this.DoProfilerFrame(previousFrameIndex, drawRect, true, threadCount, -profilerFrameDataIterator2.frameTimeMS); } int nextFrameIndex = ProfilerDriver.GetNextFrameIndex(frameIndex); if (nextFrameIndex != -1) { profilerFrameDataIterator2.SetRoot(frameIndex, 0); this.DoProfilerFrame(nextFrameIndex, drawRect, true, threadCount, profilerFrameDataIterator2.frameTimeMS); } GUI.enabled = enabled; threadCount = 0; this.DoProfilerFrame(frameIndex, drawRect, false, threadCount, 0f); GUI.EndClip(); this.DoSelectionTooltip(frameIndex, this.m_TimeArea.drawRect); }