internal void DrawUIPane(IProfilerWindowController win) { if (win.IsRecording()) { GUILayout.Label("Cannot analyze FileIO markers while profiler is recording."); } else { if (!DataPulled) { GUILayout.Label("Select 'Analyze Markers' to view detailed File Access metrics for the captured Profiler data."); return; } int visibleFrameIndex = win.GetActiveVisibleFrameIndex(); if (GetSelectedFrame() != visibleFrameIndex || m_CaptureData.m_FileAccessData.Count == 0 || NewData || ViewSelectionChanged || FrameSelectionChanged) { SetSelectedFrame(visibleFrameIndex); if (selectedViewType == FileIOViewType.Accesses) { UpdateFileAccessTable(); } else if (selectedViewType == FileIOViewType.FileSummary) { CalculateFileSummaries(); UpdateFileSummaryTable(); } ViewSelectionChanged = false; FrameSelectionChanged = false; NewData = false; } string text; if (selectedViewType == FileIOViewType.Accesses) { text = "File accesses: " + m_FileAccessTreeView.GetCount(); } else { text = "Files accessed: " + m_FileSummaryTreeView.GetCount(); } GUILayout.Label(text); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); if (selectedViewType == FileIOViewType.Accesses) { DrawFileAccesses(); } else if (selectedViewType == FileIOViewType.FileSummary) { DrawFileSummaries(); } GUILayout.EndHorizontal(); } }
protected void DrawOverviewText(ProfilerArea?area, Rect position) { if (!area.HasValue) { return; } string activeText = ProfilerDriver.GetOverviewText(area.Value, m_ProfilerWindow.GetActiveVisibleFrameIndex()); float height = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(activeText), position.width); m_PaneScroll = GUILayout.BeginScrollView(m_PaneScroll, ProfilerWindow.Styles.background); EditorGUILayout.SelectableLabel(activeText, EditorStyles.wordWrappedLabel, GUILayout.MinHeight(height)); GUILayout.EndScrollView(); }
// Used with via Reflection (see MemoryProfilerModuleBridge.cs) from the Profiler Memory Profiler Package for the Memory Profiler Module UI Override. (Only when showing old (pre-2020.2 aka pre-memory-counters) profiler data) static string GetSimpleMemoryPaneText(RawFrameDataView f, IProfilerWindowController profilerWindow, bool summary = true) { if (f.valid) { var totalReservedMemoryId = GetCounterValue(f, "Total Reserved Memory"); if (totalReservedMemoryId != -1) { // Counter Data is available, a text form display is not needed return(string.Empty); } else { // Old data compatibility. return(ProfilerDriver.GetOverviewText(ProfilerArea.Memory, profilerWindow.GetActiveVisibleFrameIndex())); } } return(string.Empty); }
internal void DrawUIPane(IProfilerWindowController win) { if (win.IsRecording()) { GUILayout.Label("Cannot analyze Asset Loading markers while profiler is recording."); } else { if (!DataPulled) { GUILayout.Label("Select 'Analyze Markers' to view detailed Asset Loading metrics for the captured Profiler data."); return; } int visibleFrameIndex = win.GetActiveVisibleFrameIndex(); if (GetSelectedFrame() != visibleFrameIndex || m_CaptureData.m_AssetLoadMarkers.Count == 0 || FrameSelectionChanged || NewData /*|| ViewSelectionChanged*/) { SetSelectedFrame(visibleFrameIndex); FrameSelectionChanged = false; NewData = false; UpdateAssetMarkerTable(); } string text; if (m_AssetMarkerTreeViewState != null) { text = "Asset Load Markers: " + m_AssetMarkerTreeView.GetCount(); } else { text = ""; } GUILayout.Label(text); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); DrawAssetMarkers(); GUILayout.EndHorizontal(); } }
internal void DrawUIPane(IProfilerWindowController win) { InitIfNeeded(win); EditorGUILayout.BeginVertical(); if (m_DetachedPreview != null && !m_DetachedPreview) { m_DetachedPreview = null; } bool detachPreview = m_DetachedPreview; if (!detachPreview) { GUILayout.BeginHorizontal(); // Horizontal render SplitterGUILayout.BeginHorizontalSplit(m_TreePreviewHorizontalSplitState); } var treeRect = EditorGUILayout.GetControlRect(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); treeRect.yMin -= EditorGUIUtility.standardVerticalSpacing; var newVisibleFrame = win.GetActiveVisibleFrameIndex(); if (m_TreeViewControl.property == null || (m_UGUIProfilerTreeViewState != null && m_UGUIProfilerTreeViewState.lastFrame != newVisibleFrame)) { if (m_TreeViewControl.property != null) { m_TreeViewControl.property.Dispose(); } m_TreeViewControl.property = win.CreateProperty(); m_UGUIProfilerTreeViewState.lastFrame = newVisibleFrame; currentFrame = ProfilerDriver.lastFrameIndex - newVisibleFrame; m_TreeViewControl.Reload(); } if (m_TreeViewControl.property != null && !m_TreeViewControl.property.frameDataReady) { m_TreeViewControl.property.Dispose(); m_TreeViewControl.property = null; GUI.Label(treeRect, Styles.noData); } else { m_TreeViewControl.OnGUI(treeRect); } if (!detachPreview) { using (new EditorGUILayout.VerticalScope()) { using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar, GUILayout.ExpandWidth(true))) { detachPreview = GUILayout.Button(Styles.contentDetachRender, EditorStyles.toolbarButton, GUILayout.Width(75)); if (detachPreview) { m_DetachedPreview = EditorWindow.GetWindow <UISystemPreviewWindow>(); m_DetachedPreview.profiler = this; m_DetachedPreview.Show(); } DrawPreviewToolbarButtons(); } DrawRenderUI(); } GUILayout.EndHorizontal(); // Horizontal render SplitterGUILayout.EndHorizontalSplit(); // m_TreePreviewHorizontalSplitState // Draw separator EditorGUI.DrawRect( new Rect(m_TreePreviewHorizontalSplitState.realSizes[0] + treeRect.xMin, treeRect.y, 1, treeRect.height), Styles.separatorColor); } EditorGUILayout.EndVertical(); if (m_DetachedPreview) { m_DetachedPreview.Repaint(); } }
internal void DrawUIPane(IProfilerWindowController win) { if (Styles.backgroundStyle == null) { Styles.CreateStyles(); } //make sure all background textures exist Styles.CheckBackgroundTextures(); EditorGUILayout.BeginVertical(); var rect = EditorGUILayout.GetControlRect(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); const int padding = 1; Rect aggregateHeader = rect; aggregateHeader.width = Mathf.Min(434, rect.width); aggregateHeader.height = 34; Rect aggregateData = aggregateHeader; aggregateData.y += aggregateHeader.height + padding; float aggregateBoxHeight = rect.height / 2 - aggregateHeader.height - padding * 2; aggregateData.height = aggregateBoxHeight; Rect infoBox = new Rect(); if (ProfilerDriver.GetStatisticsAvailabilityState(ProfilerArea.VirtualTexturing, win.GetActiveVisibleFrameIndex()) == 0) { GUI.Label(aggregateHeader, "No Virtual Texturing data was collected."); EditorGUILayout.EndVertical(); return; } GUI.Box(rect, "", Styles.backgroundStyle); using (RawFrameDataView frameDataView = ProfilerDriver.GetRawFrameDataView(win.GetActiveVisibleFrameIndex(), 0)) { if (frameDataView.valid) { Assert.IsTrue(frameDataView.threadName == "Main Thread"); RawFrameDataView fRender = GetRenderThread(frameDataView); //system statistics var stringBuilder = new StringBuilder(1024); int requiredTiles = (int)GetCounterValue(frameDataView, "Required Tiles"); stringBuilder.AppendLine($" Tiles required this frame: {requiredTiles}"); stringBuilder.AppendLine($" Max Cache Mip Bias: {GetCounterValueAsFloat(frameDataView, "Max Cache Mip Bias")}"); stringBuilder.AppendLine($" Max Cache Demand: {GetCounterValue(frameDataView, "Max Cache Demand")}%"); stringBuilder.AppendLine($" Total CPU Cache Size: {EditorUtility.FormatBytes(GetCounterValue(frameDataView, "Total CPU Cache Size"))}"); stringBuilder.AppendLine($" Total GPU Cache Size: {EditorUtility.FormatBytes(GetCounterValue(frameDataView, "Total GPU Cache Size"))}"); stringBuilder.AppendLine($" Atlases: {GetCounterValue(frameDataView, "Atlases")}"); string aggregatedText = stringBuilder.ToString(); float aggregateTextHeight = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(aggregatedText), rect.width); float actualHeight = Mathf.Max(aggregateBoxHeight, aggregateTextHeight); DrawScrollBackground(new Rect(aggregateData.width - 12, aggregateData.y, 14, aggregateData.height)); GUI.Box(aggregateHeader, " System Statistics", Styles.headerStyle); m_SystemScroll = GUI.BeginScrollView(aggregateData, m_SystemScroll, new Rect(0, 0, aggregateData.width / 2, actualHeight)); GUI.Box(new Rect(0, 0, aggregateData.width, actualHeight), aggregatedText, Styles.statStyle); GUI.EndScrollView(); //player build statistics aggregateHeader.y += aggregateHeader.height + aggregateData.height + padding * 2; aggregateData.y += aggregateHeader.height + aggregateData.height + padding * 2; stringBuilder.Clear(); stringBuilder.AppendLine($" Missing Disk Data: {EditorUtility.FormatBytes(GetCounterValue(frameDataView, "Missing Disk Data"))}"); stringBuilder.AppendLine($" Missing Streaming Tiles: {GetCounterValue(frameDataView, "Missing Streaming Tiles")}"); stringBuilder.AppendLine($" Read From Disk: {EditorUtility.FormatBytes(GetCounterValue(frameDataView, "Read From Disk"))}"); aggregatedText = stringBuilder.ToString(); aggregateTextHeight = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(aggregatedText), rect.width); actualHeight = Mathf.Max(aggregateBoxHeight, aggregateTextHeight); DrawScrollBackground(new Rect(aggregateData.width - 12, aggregateData.y, 14, aggregateData.height)); GUI.Box(aggregateHeader, " Player Build Statistics", Styles.headerStyle); m_PlayerScroll = GUI.BeginScrollView(aggregateData, m_PlayerScroll, new Rect(0, 0, aggregateData.width / 2, actualHeight)); GUI.Box(new Rect(0, 0, aggregateData.width, actualHeight), aggregatedText, Styles.statStyle); GUI.EndScrollView(); //PER CACHE DATA Rect perCacheHeader = rect; perCacheHeader.width = rect.width - aggregateHeader.width - padding; perCacheHeader.height = 34; perCacheHeader.x += aggregateHeader.width + padding; Rect formatBox = perCacheHeader; formatBox.height = rect.height - perCacheHeader.height - padding; formatBox.y += perCacheHeader.height + padding; GUI.Box(perCacheHeader, " Per Cache Statistics", Styles.headerStyle); if (m_Header == null || m_HeaderState == null) { Init(); } //Keep using the last VT tick untill a new one is available. if (requiredTiles > 0) { ReadFrameData(fRender); } if (m_SortingChanged) { SortFrameData(); } DrawFormatData(formatBox); if (fRender != frameDataView) { fRender.Dispose(); } } else { GUI.Label(aggregateData, "No frame data available"); } } EditorGUILayout.EndVertical(); infoBox.y = rect.y; infoBox.x = rect.width - 33; infoBox.width = 34; infoBox.height = 34; DrawDocLink(infoBox); }