public override void OnGUI()
        {
            base.OnGUI();

            EditorGUI.BeginDisabledGroup(m_ObjectsControl.progress.value < 1);
            using (new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            var text = string.Format("{0} managed object duplicate(s) wasting {1} memory", m_ObjectsControl.managedObjectsCount, EditorUtility.FormatBytes(m_ObjectsControl.managedObjectsSize));
                            window.SetStatusbarString(text);

                            EditorGUILayout.LabelField(titleContent, EditorStyles.boldLabel);
                            if (m_ObjectsSearchField.OnToolbarGUI())
                            {
                                m_ObjectsControl.Search(m_ObjectsSearchField.text);
                            }
                        }
                        GUILayout.Space(2);

                        m_ObjectsControl.OnGUI();
                    }

                    m_SplitterVertConnections = HeEditorGUILayout.VerticalSplitter("m_splitterVertConnections".GetHashCode(), m_SplitterVertConnections, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.HorizontalScope(GUILayout.Height(window.position.height * m_SplitterVertConnections)))
                    {
                        m_ConnectionsView.OnGUI();
                    }
                }

                m_SplitterHorzPropertyGrid = HeEditorGUILayout.HorizontalSplitter("m_splitterHorzPropertyGrid".GetHashCode(), m_SplitterHorzPropertyGrid, 0.1f, 0.6f, window);

                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorzPropertyGrid)))
                    {
                        m_PropertyGridView.OnGUI();
                    }

                    m_SplitterVertRootPath = HeEditorGUILayout.VerticalSplitter("m_splitterVertRootPath".GetHashCode(), m_SplitterVertRootPath, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorzPropertyGrid), GUILayout.Height(window.position.height * m_SplitterVertRootPath)))
                    {
                        m_RootPathView.OnGUI();
                    }
                }
            }
            EditorGUI.EndDisabledGroup();

            if (m_ObjectsControl.progress.value < 1)
            {
                window.SetBusy(string.Format("Analyzing Managed Objects Memory, {0:F0}% done", m_ObjectsControl.progress.value * 100));
            }
        }
Exemplo n.º 2
0
        public override void OnGUI()
        {
            base.OnGUI();

            using (new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            OnDrawHeader();

                            if (m_ObjectsSearchField.OnToolbarGUI())
                            {
                                m_ObjectsControl.Search(m_ObjectsSearchField.text);
                            }
                        }
                        GUILayout.Space(2);

                        UnityEngine.Profiling.Profiler.BeginSample("m_objectsControl.OnGUI");
                        m_ObjectsControl.OnGUI();
                        UnityEngine.Profiling.Profiler.EndSample();
                    }

                    m_SplitterVertConnections = HeEditorGUILayout.VerticalSplitter("m_splitterVertConnections".GetHashCode(), m_SplitterVertConnections, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.HorizontalScope(GUILayout.Height(window.position.height * m_SplitterVertConnections)))
                    {
                        m_ConnectionsView.OnGUI();
                    }
                }

                m_SplitterHorzPropertyGrid = HeEditorGUILayout.HorizontalSplitter("m_splitterHorzPropertyGrid".GetHashCode(), m_SplitterHorzPropertyGrid, 0.1f, 0.6f, window);

                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorzPropertyGrid)))
                    {
                        m_PropertyGridView.OnGUI();
                    }

                    m_SplitterVertRootPath = HeEditorGUILayout.VerticalSplitter("m_splitterVertRootPath".GetHashCode(), m_SplitterVertRootPath, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorzPropertyGrid), GUILayout.Height(window.position.height * m_SplitterVertRootPath)))
                    {
                        m_RootPathView.OnGUI();
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override void OnGUI()
        {
            base.OnGUI();

            using (new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            var text = string.Format("{0} static fields in {1} types", snapshot.managedStaticFields.Length, snapshot.managedStaticTypes.Length);
                            window.SetStatusbarString(text);
                            EditorGUILayout.LabelField(titleContent, EditorStyles.boldLabel);
                            if (m_SearchField.OnToolbarGUI())
                            {
                                m_StaticFieldsControl.Search(m_SearchField.text);
                            }
                        }
                        GUILayout.Space(2);

                        m_StaticFieldsControl.OnGUI();
                    }

                    m_SplitterVert = HeEditorGUILayout.VerticalSplitter("m_splitterVert".GetHashCode(), m_SplitterVert, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.HorizontalScope(GUILayout.Height(window.position.height * m_SplitterVert)))
                    {
                        m_ConnectionsView.OnGUI();
                    }
                }

                m_SplitterHorz = HeEditorGUILayout.HorizontalSplitter("m_splitterHorz".GetHashCode(), m_SplitterHorz, 0.1f, 0.8f, window);

                using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorz)))
                {
                    m_PropertyGridView.OnGUI();
                }
            }
        }
Exemplo n.º 4
0
        public override void OnGUI()
        {
            base.OnGUI();

            using (new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            EditorGUILayout.LabelField(string.Format("{0} GCHandle(s)", snapshot.gcHandles.Length), EditorStyles.boldLabel);

                            if (m_HandlesSearchField.OnToolbarGUI())
                            {
                                m_HandlesControl.Search(m_HandlesSearchField.text);
                            }
                        }
                        GUILayout.Space(2);

                        m_HandlesControl.OnGUI();
                    }

                    m_SplitterVert = HeEditorGUILayout.VerticalSplitter("m_splitterVert".GetHashCode(), m_SplitterVert, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.HorizontalScope(GUILayout.Height(window.position.height * m_SplitterVert)))
                    {
                        m_ConnectionsView.OnGUI();
                    }
                }

                m_SplitterHorz = HeEditorGUILayout.HorizontalSplitter("m_splitterHorz".GetHashCode(), m_SplitterHorz, 0.1f, 0.8f, window);

                using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Width(window.position.width * m_SplitterHorz)))
                {
                    m_RootPathView.OnGUI();
                }
            }
        }
        public override void OnGUI()
        {
            base.OnGUI();

            if (m_ShowInternalSections != s_ShowInternalSections)
            {
                m_ManagedHeapAddressSpace = ~0ul;
                m_ManagedHeapSize         = ~0ul;
                m_ShowInternalSections    = s_ShowInternalSections;
                m_SectionsControl.SetTree(m_SectionsControl.BuildTree(snapshot, GetMemorySections()));
                ScheduleJob(new HeapFragmentationJob()
                {
                    snapshot = snapshot, texture = m_HeapFragTexture, sections = GetMemorySections(), addressSpace = GetHeapAddressSpace()
                });
            }

            using (new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            EditorGUILayout.LabelField(titleContent, EditorStyles.boldLabel);
                            if (m_SectionsSearchField.OnToolbarGUI())
                            {
                                m_SectionsControl.Search(m_SectionsSearchField.text);
                            }
                        }

                        GUILayout.Space(2);
                        m_SectionsControl.OnGUI();
                    }

                    // Managed heap fragmentation view
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        var text = string.Format("{0} managed heap sections ({1}) within an {2} address space", GetMemorySections().Length, EditorUtility.FormatBytes((long)GetTotalHeapSize()), EditorUtility.FormatBytes((long)GetHeapAddressSpace()));
                        GUILayout.Label(text, EditorStyles.boldLabel);
                        GUI.DrawTexture(GUILayoutUtility.GetRect(100, window.position.height * 0.1f, GUILayout.ExpandWidth(true)), m_HeapFragTexture, ScaleMode.StretchToFill);
                    }
                }

                m_SplitterHorz = HeEditorGUILayout.HorizontalSplitter("m_splitterHorz".GetHashCode(), m_SplitterHorz, 0.1f, 0.8f, window);

                using (new EditorGUILayout.VerticalScope(GUILayout.Width(window.position.width * m_SplitterHorz)))
                {
                    if (m_ShowAsHex)
                    {
                        using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                        {
                            using (new EditorGUILayout.HorizontalScope())
                            {
                                GUILayout.FlexibleSpace();
                                OnToggleHexViewGUI();
                            }

                            //GUILayout.Space(2);
                            m_HexView.OnGUI();
                        }
                    }
                    else
                    {
                        m_ConnectionsView.OnGUI();
                    }

                    // Managed heap section fragmentation view
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        GUILayout.Label("Memory section usage (Issue: static field memory and gchandle memory is missing due to limited MemoryProfiling API)", EditorStyles.boldLabel);
                        GUI.DrawTexture(GUILayoutUtility.GetRect(100, window.position.height * 0.1f, GUILayout.ExpandWidth(true)), m_SectionFragTexture, ScaleMode.StretchToFill);
                    }
                }
            }
        }
Exemplo n.º 6
0
        public override void OnGUI()
        {
            base.OnGUI();

            using (new EditorGUILayout.HorizontalScope())
            {
                using (new EditorGUILayout.VerticalScope())
                {
                    // Native objects list at the left side
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            OnDrawHeader();

                            if (m_SearchField.OnToolbarGUI())
                            {
                                m_NativeObjectsControl.Search(m_SearchField.text);
                            }
                        }
                        GUILayout.Space(2);

                        m_NativeObjectsControl.OnGUI();
                    }

                    m_SplitterVert = HeEditorGUILayout.VerticalSplitter("m_splitterVert".GetHashCode(), m_SplitterVert, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.HorizontalScope(GUILayout.Height(window.position.height * m_SplitterVert)))
                    {
                        m_ConnectionsView.OnGUI();
                    }
                }

                m_SplitterHorz = HeEditorGUILayout.HorizontalSplitter("m_splitterHorz".GetHashCode(), m_SplitterHorz, 0.1f, 0.8f, window);

                // Various panels at the right side
                using (new EditorGUILayout.VerticalScope(GUILayout.Width(window.position.width * m_SplitterHorz)))
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope(GUILayout.MaxWidth(16)))
                        {
                            if (m_Selected.HasValue)
                            {
                                HeEditorGUI.NativeObjectIcon(GUILayoutUtility.GetRect(16, 16), m_Selected.Value);
                                //GUI.DrawTexture(r, HeEditorStyles.assetImage);
                            }

                            EditorGUILayout.LabelField("Native UnityEngine object", EditorStyles.boldLabel);
                        }

                        GUILayout.Space(2);
                        m_NativeObjectControl.OnGUI();
                    }

                    m_PreviewSplitterVert = HeEditorGUILayout.VerticalSplitter("m_PreviewSplitterVert".GetHashCode(), m_PreviewSplitterVert, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Height(window.position.height * m_PreviewSplitterVert)))
                    {
                        m_PreviewView.OnGUI();
                    }

                    m_RootPathSplitterVert = HeEditorGUILayout.VerticalSplitter("m_RootPathSplitterVert".GetHashCode(), m_RootPathSplitterVert, 0.1f, 0.8f, window);

                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, GUILayout.Height(window.position.height * m_RootPathSplitterVert)))
                    {
                        m_RootPathView.OnGUI();
                    }
                }
            }
        }
Exemplo n.º 7
0
        public override void OnGUI()
        {
            base.OnGUI();

            if (showReferences)
            {
                using (new EditorGUI.DisabledGroupScope(showReferencesAsExcluded))
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            EditorGUILayout.LabelField(string.Format("References to {0} object(s)", m_ReferencesControl.count), EditorStyles.boldLabel);
                            if (m_ReferencesSearchField.OnToolbarGUI())
                            {
                                m_ReferencesControl.Search(m_ReferencesSearchField.text);
                            }
                            if (afterReferencesToolbarGUI != null)
                            {
                                afterReferencesToolbarGUI();
                            }
                        }

                        GUILayout.Space(2);
                        m_ReferencesControl.OnGUI();
                    }
                }

                if (showReferencesAsExcluded)
                {
                    GUI.Label(GUILayoutUtility.GetLastRect(), "This information was excluded from the memory snapshot.", HeEditorStyles.centeredBoldLabel);
                }
            }

            GUILayoutOption[] options = null;
            if (showReferences && showReferencedBy)
            {
                m_SplitterValue = HeEditorGUILayout.HorizontalSplitter("m_splitterValue".GetHashCode(), m_SplitterValue, 0.1f, 0.6f, window);
                options         = new[] { GUILayout.Width(window.position.width * m_SplitterValue) };
            }

            if (showReferencedBy)
            {
                using (new EditorGUI.DisabledGroupScope(showReferencedByAsExcluded))
                {
                    using (new EditorGUILayout.VerticalScope(HeEditorStyles.panel, options))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            EditorGUILayout.LabelField(string.Format("Referenced by {0} object(s)", m_ReferencedByControl.count), EditorStyles.boldLabel);
                            if (m_ReferencedBySearchField.OnToolbarGUI())
                            {
                                m_ReferencedByControl.Search(m_ReferencedBySearchField.text);
                            }

                            if (afterReferencedByToolbarGUI != null)
                            {
                                afterReferencedByToolbarGUI();
                            }
                        }
                        GUILayout.Space(2);
                        m_ReferencedByControl.OnGUI();
                    }
                }

                if (showReferencedByAsExcluded)
                {
                    GUI.Label(GUILayoutUtility.GetLastRect(), "This information was excluded from the memory snapshot.", HeEditorStyles.centeredBoldLabel);
                }
            }
        }