Наследование: EditorWindow, IProfilerWindowController
Пример #1
0
            static object OnProfilerDeepProfileChanged(string eventType, object[] args)
            {
                var deep    = Convert.ToBoolean(args[0]);
                var doApply = ProfilerWindow.SetEditorDeepProfiling(deep);

                return(doApply);
            }
Пример #2
0
            static void InitializeProfilerSlaveProcessDomain()
            {
                Console.WriteLine("[UMPE] Initialize Profiler Slave Process Domain Triggered");

                if (!SessionState.GetBool("OOPP.Initialized", false))
                    return;

                EditorApplication.update -= InitializeProfilerSlaveProcessDomain;

                s_SlaveProfilerWindow = EditorWindow.GetWindow<ProfilerWindow>();
                SetupProfilerWindow(s_SlaveProfilerWindow);

                EventService.On(nameof(EventType.UmpProfilerRecordToggle), HandleToggleRecording);
                EventService.On(nameof(EventType.UmpProfilerRequestRecordState), HandleRequestRecordState);
                EventService.On(nameof(EventType.UmpProfilerPing), HandlePingEvent);
                EventService.On(nameof(EventType.UmpProfilerExit), HandleExitEvent);

                EditorApplication.update -= SetupProfilerDriver;
                EditorApplication.update += SetupProfilerDriver;
                EditorApplication.updateMainWindowTitle -= SetProfilerWindowTitle;
                EditorApplication.updateMainWindowTitle += SetProfilerWindowTitle;
                EditorApplication.quitting -= SaveWindowLayout;
                EditorApplication.quitting += SaveWindowLayout;

                Console.WriteLine("[UMPE] Initialize Profiler Slave Process Domain Completed");
            }
Пример #3
0
        private void DrawMainToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            Rect rect = GUILayoutUtility.GetRect(ProfilerWindow.ms_Styles.addArea, EditorStyles.toolbarDropDown, new GUILayoutOption[]
            {
                GUILayout.Width(120f)
            });

            if (EditorGUI.ButtonMouseDown(rect, ProfilerWindow.ms_Styles.addArea, FocusType.Native, EditorStyles.toolbarDropDown))
            {
                int      num    = this.m_Charts.Length;
                string[] array  = new string[num];
                bool[]   array2 = new bool[num];
                for (int i = 0; i < num; i++)
                {
                    array[i]  = ((ProfilerArea)i).ToString();
                    array2[i] = !this.m_Charts[i].active;
                }
                EditorUtility.DisplayCustomMenu(rect, array, array2, null, new EditorUtility.SelectMenuItemFunction(this.AddAreaClick), null);
            }
            GUILayout.FlexibleSpace();
            this.m_Recording = GUILayout.Toggle(this.m_Recording, ProfilerWindow.ms_Styles.profilerRecord, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            Profiler.enabled = this.m_Recording;
            ProfilerWindow.SetProfileDeepScripts(GUILayout.Toggle(ProfilerDriver.deepProfiling, ProfilerWindow.ms_Styles.deepProfile, EditorStyles.toolbarButton, new GUILayoutOption[0]));
            ProfilerDriver.profileEditor = GUILayout.Toggle(ProfilerDriver.profileEditor, ProfilerWindow.ms_Styles.profileEditor, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            this.m_AttachProfilerUI.OnGUILayout(this);
            if (GUILayout.Button(ProfilerWindow.ms_Styles.clearData, EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                ProfilerDriver.ClearAllFrames();
            }
            GUILayout.Space(5f);
            GUILayout.FlexibleSpace();
            this.FrameNavigationControls();
            GUILayout.EndHorizontal();
        }
Пример #4
0
 private void GetProfiler()
 {
     if (m_ProfilerWindow == null)
     {
         m_ProfilerWindow = EditorWindow.GetWindow <ProfilerWindow>();
     }
     if (m_CpuProfilerModule == null)
     {
         m_CpuProfilerModule = m_ProfilerWindow.GetFrameTimeViewSampleSelectionController(ProfilerWindow.cpuModuleIdentifier);
     }
 }
Пример #5
0
            static void SetupProfilerWindow(ProfilerWindow profilerWindow)
            {
                profilerWindow.currentFrameChanged        -= OnProfilerCurrentFrameChanged;
                profilerWindow.recordingStateChanged      -= OnProfilerWindowRecordingStateChanged;
                profilerWindow.deepProfileChanged         -= OnProfilerWindowDeepProfileChanged;
                profilerWindow.memoryRecordingModeChanged -= OnProfilerWindowMemoryRecordModeChanged;

                profilerWindow.currentFrameChanged        += OnProfilerCurrentFrameChanged;
                profilerWindow.recordingStateChanged      += OnProfilerWindowRecordingStateChanged;
                profilerWindow.deepProfileChanged         += OnProfilerWindowDeepProfileChanged;
                profilerWindow.memoryRecordingModeChanged += OnProfilerWindowMemoryRecordModeChanged;
            }
Пример #6
0
        private void BuildColumns()
        {
            ProfilerColumn[] array = new ProfilerColumn[]
            {
                ProfilerColumn.FunctionName,
                ProfilerColumn.TotalPercent,
                ProfilerColumn.SelfPercent,
                ProfilerColumn.Calls,
                ProfilerColumn.GCMemory,
                ProfilerColumn.TotalTime,
                ProfilerColumn.SelfTime,
                ProfilerColumn.WarningCount
            };
            ProfilerColumn[] array2 = new ProfilerColumn[]
            {
                ProfilerColumn.ObjectName,
                ProfilerColumn.TotalPercent,
                ProfilerColumn.SelfPercent,
                ProfilerColumn.Calls,
                ProfilerColumn.GCMemory,
                ProfilerColumn.TotalTime,
                ProfilerColumn.SelfTime
            };
            this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerColumnsV2", array, ProfilerWindow.ProfilerColumnNames(array), false, ProfilerColumn.TotalTime);
            this.m_CPUTimelineGUI  = new ProfilerTimelineGUI(this);
            string text = EditorGUIUtility.TextContent("ProfilerColumn.DetailViewObject").text;

            string[] array3 = ProfilerWindow.ProfilerColumnNames(array2);
            array3[0] = text;
            this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerDetailColumns", array2, array3, true, ProfilerColumn.TotalTime);
            ProfilerColumn[] array4 = new ProfilerColumn[]
            {
                ProfilerColumn.FunctionName,
                ProfilerColumn.TotalGPUPercent,
                ProfilerColumn.DrawCalls,
                ProfilerColumn.TotalGPUTime
            };
            ProfilerColumn[] array5 = new ProfilerColumn[]
            {
                ProfilerColumn.ObjectName,
                ProfilerColumn.TotalGPUPercent,
                ProfilerColumn.DrawCalls,
                ProfilerColumn.TotalGPUTime
            };
            this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUColumns", array4, ProfilerWindow.ProfilerColumnNames(array4), false, ProfilerColumn.TotalGPUTime);
            array3    = ProfilerWindow.ProfilerColumnNames(array5);
            array3[0] = text;
            this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUDetailColumns", array5, array3, true, ProfilerColumn.TotalGPUTime);
        }
Пример #7
0
            static void InitializeProfilerSlaveProcessDomain()
            {
                if (s_SlaveProfilerWindow == null && EditorWindow.HasOpenInstances <ProfilerWindow>())
                {
                    s_SlaveProfilerWindow = EditorWindow.GetWindow <ProfilerWindow>();
                    SetupProfilerWindow(s_SlaveProfilerWindow);
                }

                EventService.On(nameof(EventType.UmpProfilerRecordToggle), HandleToggleRecording);
                EventService.On(nameof(EventType.UmpProfilerRequestRecordState), HandleRequestRecordState);
                EventService.On(nameof(EventType.UmpProfilerPing), HandlePingEvent);
                EventService.On(nameof(EventType.UmpProfilerExit), HandleExitEvent);

                EditorApplication.updateMainWindowTitle += SetProfilerWindowTitle;
                EditorApplication.quitting += () => WindowLayout.SaveWindowLayout(userPrefProfilerLayoutPath);
            }
Пример #8
0
            static void InitializeProfilerSlaveProcessDomain()
            {
                if (EditorWindow.HasOpenInstances <ProfilerWindow>())
                {
                    s_SlaveProfilerWindow = EditorWindow.GetWindow <ProfilerWindow>();
                    SetupProfilerWindow(s_SlaveProfilerWindow);
                }

                EditorApplication.updateMainWindowTitle += SetProfilerWindowTitle;

                EventService.On(nameof(EventType.UmpProfilerRecordToggle), HandleToggleRecording);
                EventService.On(nameof(EventType.UmpProfilerSyncPlayState), HandleSyncMasterPlayModeState);
                EventService.On(nameof(EventType.UmpProfilerSyncPlayPause), HandleSyncMasterPlayPause);
                EventService.On(nameof(EventType.UmpProfilerPing), HandlePingEvent);
                EventService.On(nameof(EventType.UmpProfilerExit), HandleExitEvent);
                EventService.On(nameof(EventType.UmpProfilerRequestRecordState), HandleRequestRecordState);
            }
Пример #9
0
            static void InitializeProfilerSlaveProcess()
            {
                if (!File.Exists(userPrefProfilerLayoutPath) ||
                    File.GetLastWriteTime(systemProfilerLayoutPath) > File.GetLastWriteTime(userPrefProfilerLayoutPath))
                {
                    var parentDir = Path.GetDirectoryName(userPrefProfilerLayoutPath);
                    if (parentDir != null && !System.IO.Directory.Exists(parentDir))
                    {
                        System.IO.Directory.CreateDirectory(parentDir);
                    }
                    File.Copy(systemProfilerLayoutPath, userPrefProfilerLayoutPath, true);
                }
                WindowLayout.LoadWindowLayout(userPrefProfilerLayoutPath, false);

                s_SlaveProfilerWindow = EditorWindow.GetWindowDontShow <ProfilerWindow>();
                SetupProfilerWindow(s_SlaveProfilerWindow);
                EditorApplication.delayCall += SetupProfilerDriver;
            }
Пример #10
0
        private void DrawCPUOrRenderingPane(ProfilerHierarchyGUI mainPane, ProfilerHierarchyGUI detailPane, ProfilerTimelineGUI timelinePane)
        {
            ProfilerProperty profilerProperty = this.CreateProperty(false);

            this.DrawCPUOrRenderingToolbar(profilerProperty);
            if (!ProfilerWindow.CheckFrameData(profilerProperty))
            {
                profilerProperty.Cleanup();
                return;
            }
            if (timelinePane != null && this.m_ViewType == ProfilerViewType.Timeline)
            {
                float num = (float)this.m_VertSplit.realSizes[1];
                num -= EditorStyles.toolbar.CalcHeight(GUIContent.none, 10f) + 2f;
                timelinePane.DoGUI(this.GetActiveVisibleFrameIndex(), base.position.width, base.position.height - num, num);
                profilerProperty.Cleanup();
            }
            else
            {
                SplitterGUILayout.BeginHorizontalSplit(this.m_ViewSplit, new GUILayoutOption[0]);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                bool expandAll = false;
                mainPane.DoGUI(profilerProperty, this.m_SearchString, expandAll);
                profilerProperty.Cleanup();
                GUILayout.EndVertical();
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                ProfilerProperty profilerProperty2 = this.CreateProperty(true);
                ProfilerProperty detailedProperty  = mainPane.GetDetailedProperty(profilerProperty2);
                profilerProperty2.Cleanup();
                if (detailedProperty != null)
                {
                    detailPane.DoGUI(detailedProperty, string.Empty, expandAll);
                    detailedProperty.Cleanup();
                }
                else
                {
                    ProfilerWindow.DrawEmptyCPUOrRenderingDetailPane();
                }
                GUILayout.EndVertical();
                SplitterGUILayout.EndHorizontalSplit();
            }
        }
Пример #11
0
            static void InitializeProfilerSlaveProcess()
            {
                s_SlaveProfilerWindow = ScriptableObject.CreateInstance <ProfilerWindow>();
                SetupProfilerWindow(s_SlaveProfilerWindow);

                var view = ScriptableObject.CreateInstance <HostView>();

                view.SetActualViewInternal(s_SlaveProfilerWindow, true);
                view.autoRepaintOnSceneChange = false;

                var cw = ScriptableObject.CreateInstance <ContainerWindow>();

                cw.m_DontSaveToLayout = true;
                cw.position           = k_ProfilerProcessInitialWindowRect;
                cw.rootView           = view;
                cw.rootView.position  = new Rect(0, 0, cw.position.width, cw.position.height);
                cw.Show(ShowMode.MainWindow, loadPosition: true, displayImmediately: false, setFocus: true);

                EditorApplication.delayCall += SetupProfilerDriver;
            }
            static void InitializeProfilerSlaveProcessDomain()
            {
                EditorApplication.update -= InitializeProfilerSlaveProcessDomain;

                if (!SessionState.GetBool("OOPP.Initialized", false))
                {
                    return;
                }

                s_SlaveProfilerWindow = EditorWindow.GetWindow <ProfilerWindow>();
                SetupProfilerWindow(s_SlaveProfilerWindow);

                EventService.On(nameof(EventType.UmpProfilerRecordToggle), HandleToggleRecording);
                EventService.On(nameof(EventType.UmpProfilerRequestRecordState), HandleRequestRecordState);
                EventService.On(nameof(EventType.UmpProfilerPing), HandlePingEvent);
                EventService.On(nameof(EventType.UmpProfilerExit), HandleExitEvent);

                EditorApplication.delayCall             -= SetupProfilerDriver;
                EditorApplication.delayCall             += SetupProfilerDriver;
                EditorApplication.updateMainWindowTitle -= SetProfilerWindowTitle;
                EditorApplication.updateMainWindowTitle += SetProfilerWindowTitle;
                EditorApplication.quitting -= SaveWindowLayout;
                EditorApplication.quitting += SaveWindowLayout;
            }
Пример #13
0
        internal void DrawUIPane(ProfilerWindow win, ProfilerArea profilerArea, UISystemProfilerChart detailsChart)
        {
            this.InitIfNeeded(win);
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            if (this.m_DetachedPreview != null && !this.m_DetachedPreview)
            {
                this.m_DetachedPreview = null;
            }
            bool flag = this.m_DetachedPreview;

            if (!flag)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                SplitterGUILayout.BeginHorizontalSplit(this.m_TreePreviewHorizontalSplitState, new GUILayoutOption[0]);
            }
            Rect controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(true)
            });

            controlRect.yMin -= EditorGUIUtility.standardVerticalSpacing;
            this.m_TreeViewControl.property = win.CreateProperty();
            if (!this.m_TreeViewControl.property.frameDataReady)
            {
                this.m_TreeViewControl.property.Cleanup();
                this.m_TreeViewControl.property = null;
                GUI.Label(controlRect, UISystemProfiler.Styles.noData);
            }
            else
            {
                int activeVisibleFrameIndex = win.GetActiveVisibleFrameIndex();
                if (this.m_UGUIProfilerTreeViewState != null && this.m_UGUIProfilerTreeViewState.lastFrame != activeVisibleFrameIndex)
                {
                    this.currentFrame = ProfilerDriver.lastFrameIndex - activeVisibleFrameIndex;
                    this.m_TreeViewControl.Reload();
                }
                this.m_TreeViewControl.OnGUI(controlRect);
                this.m_TreeViewControl.property.Cleanup();
            }
            if (!flag)
            {
                using (new EditorGUILayout.VerticalScope(new GUILayoutOption[0]))
                {
                    using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar, new GUILayoutOption[]
                    {
                        GUILayout.ExpandWidth(true)
                    }))
                    {
                        flag = GUILayout.Button(UISystemProfiler.Styles.contentDetachRender, EditorStyles.toolbarButton, new GUILayoutOption[]
                        {
                            GUILayout.Width(75f)
                        });
                        if (flag)
                        {
                            this.m_DetachedPreview          = EditorWindow.GetWindow <UISystemPreviewWindow>();
                            this.m_DetachedPreview.profiler = this;
                            this.m_DetachedPreview.Show();
                        }
                        UISystemProfiler.DrawPreviewToolbarButtons();
                    }
                    this.DrawRenderUI();
                }
                GUILayout.EndHorizontal();
                SplitterGUILayout.EndHorizontalSplit();
                EditorGUI.DrawRect(new Rect((float)this.m_TreePreviewHorizontalSplitState.realSizes[0] + controlRect.xMin, controlRect.y, 1f, controlRect.height), UISystemProfiler.Styles.separatorColor);
            }
            EditorGUILayout.EndVertical();
            if (this.m_DetachedPreview)
            {
                this.m_DetachedPreview.Repaint();
            }
        }
Пример #14
0
 private void InitIfNeeded(ProfilerWindow win)
 {
     if (this.m_ZoomablePreview == null)
     {
         this.m_ZoomablePreview = new ZoomableArea(true, false)
         {
             hRangeMin = 0f,
             vRangeMin = 0f,
             hRangeMax = 1f,
             vRangeMax = 1f
         };
         this.m_ZoomablePreview.SetShownHRange(0f, 1f);
         this.m_ZoomablePreview.SetShownVRange(0f, 1f);
         this.m_ZoomablePreview.uniformScale    = true;
         this.m_ZoomablePreview.scaleWithWindow = true;
         int num  = 100;
         int num2 = 200;
         this.m_MulticolumnHeaderState = new MultiColumnHeaderState(new MultiColumnHeaderState.Column[]
         {
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Object", null, null),
                 width         = 220f,
                 maxWidth      = 400f,
                 canSort       = true
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Self Batch Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Cumulative Batch Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Self Vertex Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Cumulative Vertex Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Batch Breaking Reason", null, null),
                 width         = 220f,
                 maxWidth      = 400f,
                 canSort       = false
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("GameObject Count", null, null),
                 width         = (float)num,
                 maxWidth      = 400f
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("GameObjects", null, null),
                 width         = 150f,
                 maxWidth      = 400f,
                 canSort       = false
             }
         });
         MultiColumnHeaderState.Column[] columns = this.m_MulticolumnHeaderState.columns;
         for (int i = 0; i < columns.Length; i++)
         {
             MultiColumnHeaderState.Column column = columns[i];
             column.sortingArrowAlignment = TextAlignment.Right;
         }
         this.m_UGUIProfilerTreeViewState = new UISystemProfilerTreeView.State
         {
             profilerWindow = win
         };
         UISystemProfiler.Headers headers = new UISystemProfiler.Headers(this.m_MulticolumnHeaderState)
         {
             canSort = true,
             height  = 21f
         };
         headers.sortingChanged += delegate(MultiColumnHeader header)
         {
             this.m_TreeViewControl.Reload();
         };
         this.m_TreeViewControl = new UISystemProfilerTreeView(this.m_UGUIProfilerTreeViewState, headers);
         this.m_TreeViewControl.Reload();
     }
 }
        internal void DrawUIPane(ProfilerWindow win, ProfilerArea profilerArea, UISystemProfilerChart detailsChart)
        {
            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;
            m_TreeViewControl.property = win.CreateProperty();

            if (!m_TreeViewControl.property.frameDataReady)
            {
                m_TreeViewControl.property.Cleanup();
                m_TreeViewControl.property = null;
                GUI.Label(treeRect, Styles.noData);
            }
            else
            {
                var newVisibleFrame = win.GetActiveVisibleFrameIndex();
                if (m_UGUIProfilerTreeViewState != null && m_UGUIProfilerTreeViewState.lastFrame != newVisibleFrame)
                {
                    currentFrame = ProfilerDriver.lastFrameIndex - newVisibleFrame;

                    m_TreeViewControl.Reload();
                }
                m_TreeViewControl.OnGUI(treeRect);
                m_TreeViewControl.property.Cleanup();
            }

            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();
            }
        }
        private void InitIfNeeded(ProfilerWindow win)
        {
            if (m_ZoomablePreview != null)
            {
                return;
            }

            m_ZoomablePreview = new ZoomableArea(true, false)
            {
                hRangeMin = 0.0f,
                vRangeMin = 0.0f,
                hRangeMax = 1.0f,
                vRangeMax = 1.0f
            };

            m_ZoomablePreview.SetShownHRange(0, 1);
            m_ZoomablePreview.SetShownVRange(0, 1);

            m_ZoomablePreview.uniformScale    = true;
            m_ZoomablePreview.scaleWithWindow = true;

            var initwidth = 100;
            var maxWidth  = 200;

            m_MulticolumnHeaderState = new MultiColumnHeaderState(new[]
            {
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Object"), width = 220, maxWidth = 400, canSort = true
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Self Batch Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Cumulative Batch Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Self Vertex Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Cumulative Vertex Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column
                {
                    headerContent = EditorGUIUtility.TrTextContent("Batch Breaking Reason"),
                    width         = 220,
                    maxWidth      = 400,
                    canSort       = false
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("GameObject Count"), width = initwidth, maxWidth = 400
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("GameObjects"), width = 150, maxWidth = 400, canSort = false
                },
            });
            foreach (var column in m_MulticolumnHeaderState.columns)
            {
                column.sortingArrowAlignment = TextAlignment.Right;
            }

            m_UGUIProfilerTreeViewState = new UISystemProfilerTreeView.State {
                profilerWindow = win
            };
            var multiColumnHeader = new Headers(m_MulticolumnHeaderState)
            {
                canSort = true, height = 21
            };

            multiColumnHeader.sortingChanged += header => { m_TreeViewControl.Reload(); };
            m_TreeViewControl = new UISystemProfilerTreeView(m_UGUIProfilerTreeViewState, multiColumnHeader);
            m_TreeViewControl.Reload();
        }
Пример #17
0
        private void DrawAudioPane()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            ProfilerAudioView profilerAudioView = this.m_ShowDetailedAudioPane;

            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Stats;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Channels, "Channels", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Channels;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Groups, "Groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Groups;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.ChannelsAndGroups, "Channels and groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.ChannelsAndGroups;
            }
            if (profilerAudioView != this.m_ShowDetailedAudioPane)
            {
                this.m_ShowDetailedAudioPane  = profilerAudioView;
                this.m_LastAudioProfilerFrame = -1;
            }
            if (this.m_ShowDetailedAudioPane == ProfilerAudioView.Stats)
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                this.DrawOverviewText(this.m_CurrentArea);
            }
            else
            {
                GUILayout.Space(5f);
                bool flag = GUILayout.Toggle(AudioUtil.resetAllAudioClipPlayCountsOnPlay, "Reset play count on play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                if (flag != AudioUtil.resetAllAudioClipPlayCountsOnPlay)
                {
                    AudioUtil.resetAllAudioClipPlayCountsOnPlay = flag;
                }
                if (Unsupported.IsDeveloperBuild())
                {
                    GUILayout.Space(5f);
                    bool @bool = EditorPrefs.GetBool("AudioProfilerShowAllGroups");
                    bool flag2 = GUILayout.Toggle(@bool, "Show all groups (dev-builds only)", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                    if (@bool != flag2)
                    {
                        EditorPrefs.SetBool("AudioProfilerShowAllGroups", flag2);
                    }
                }
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                Rect    rect         = GUILayoutUtility.GetRect(20f, 20000f, 10f, 10000f);
                Rect    position     = new Rect(rect.x, rect.y, 230f, rect.height);
                Rect    rect2        = new Rect(position.xMax, rect.y, rect.width - position.width, rect.height);
                string  overviewText = ProfilerDriver.GetOverviewText(this.m_CurrentArea, this.GetActiveVisibleFrameIndex());
                Vector2 vector       = EditorStyles.wordWrappedLabel.CalcSize(GUIContent.Temp(overviewText));
                this.m_PaneScroll[(int)this.m_CurrentArea] = GUI.BeginScrollView(position, this.m_PaneScroll[(int)this.m_CurrentArea], new Rect(0f, 0f, vector.x, vector.y));
                GUI.Box(position, string.Empty, ProfilerWindow.ms_Styles.background);
                GUI.Label(new Rect(3f, 3f, vector.x, vector.y), overviewText, EditorStyles.wordWrappedLabel);
                GUI.EndScrollView();
                EditorGUI.DrawRect(new Rect(position.xMax - 1f, position.y, 1f, position.height), Color.black);
                if (this.m_AudioProfilerTreeViewState == null)
                {
                    this.m_AudioProfilerTreeViewState = new AudioProfilerTreeViewState();
                }
                if (this.m_AudioProfilerBackend == null)
                {
                    this.m_AudioProfilerBackend = new AudioProfilerBackend(this.m_AudioProfilerTreeViewState);
                }
                ProfilerProperty profilerProperty = this.CreateProperty(false);
                if (ProfilerWindow.CheckFrameData(profilerProperty))
                {
                    if (this.m_CurrentFrame == -1 || this.m_LastAudioProfilerFrame != this.m_CurrentFrame)
                    {
                        this.m_LastAudioProfilerFrame = this.m_CurrentFrame;
                        AudioProfilerInfo[] audioProfilerInfo = profilerProperty.GetAudioProfilerInfo();
                        if (audioProfilerInfo != null && audioProfilerInfo.Length > 0)
                        {
                            List <AudioProfilerInfoWrapper> list  = new List <AudioProfilerInfoWrapper>();
                            AudioProfilerInfo[]             array = audioProfilerInfo;
                            for (int i = 0; i < array.Length; i++)
                            {
                                AudioProfilerInfo info = array[i];
                                bool flag3             = (info.flags & 64) != 0;
                                if (this.m_ShowDetailedAudioPane != ProfilerAudioView.Channels || !flag3)
                                {
                                    if (this.m_ShowDetailedAudioPane != ProfilerAudioView.Groups || flag3)
                                    {
                                        list.Add(new AudioProfilerInfoWrapper(info, profilerProperty.GetAudioProfilerNameByOffset(info.assetNameOffset), profilerProperty.GetAudioProfilerNameByOffset(info.objectNameOffset), this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels));
                                    }
                                }
                            }
                            this.m_AudioProfilerBackend.SetData(list);
                            if (this.m_AudioProfilerView == null)
                            {
                                this.m_AudioProfilerView = new AudioProfilerView(this, this.m_AudioProfilerTreeViewState);
                                this.m_AudioProfilerView.Init(rect2, this.m_AudioProfilerBackend);
                            }
                        }
                    }
                    if (this.m_AudioProfilerView != null)
                    {
                        this.m_AudioProfilerView.OnGUI(rect2, this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels);
                    }
                }
                profilerProperty.Cleanup();
            }
        }
Пример #18
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;
        }
Пример #19
0
 private void DrawPane(ProfilerArea area)
 {
     ProfilerWindow.DrawOtherToolbar();
     this.DrawOverviewText(area);
 }