Exemplo n.º 1
0
 public override void OnEnable(IProfilerWindowController profilerWindow)
 {
     base.OnEnable(profilerWindow);
     if (m_FrameDataHierarchyView == null)
     {
         m_FrameDataHierarchyView = new ProfilerFrameDataHierarchyView(HierarchyViewSettingsKeyPrefix);
     }
     m_FrameDataHierarchyView.OnEnable(this, false);
     m_FrameDataHierarchyView.viewTypeChanged  += CPUOrGPUViewTypeChanged;
     m_FrameDataHierarchyView.selectionChanged += CPUOrGPUViewSelectionChanged;
     m_ProfilerWindow.selectionChanged         += m_FrameDataHierarchyView.SetSelectionFromLegacyPropertyPath;
     m_ViewType = (ProfilerViewType)EditorPrefs.GetInt(ViewTypeSettingsKey, (int)DefaultViewTypeSetting);
     m_ProfilerViewFilteringOptions = SessionState.GetInt(ProfilerViewFilteringOptionsKey, m_ProfilerViewFilteringOptions);
 }
        public override void OnEnable(IProfilerWindowController profilerWindow)
        {
            base.OnEnable(profilerWindow);
            if (m_FrameDataHierarchyView == null)
            {
                m_FrameDataHierarchyView = new ProfilerFrameDataHierarchyView();
            }
            m_FrameDataHierarchyView.gpuView           = false;
            m_FrameDataHierarchyView.viewTypeChanged  += CPUOrGPUViewTypeChanged;
            m_FrameDataHierarchyView.selectionChanged += CPUOrGPUViewSelectionChanged;
            m_ProfilerWindow.selectionChanged         += m_FrameDataHierarchyView.SetSelectionFromLegacyPropertyPath;

            // Automatic Serialization on Domain Reload does not work yet as the base is abstract and the array on the ProfilerWindwo is of type ProfilerModuleBase
            m_ViewType = (ProfilerViewType)EditorPrefs.GetInt(ViewTypeSettingsKey, (int)DefaultViewTypeSetting);
        }
Exemplo n.º 3
0
 public static ProfilerFrameDataMultiColumnHeader.Column[] CreateColumns(ProfilerColumn[] profilerColumns)
 {
     ProfilerFrameDataMultiColumnHeader.Column[] array = new ProfilerFrameDataMultiColumnHeader.Column[profilerColumns.Length];
     for (int i = 0; i < profilerColumns.Length; i++)
     {
         string     profilerColumnName = ProfilerFrameDataHierarchyView.GetProfilerColumnName(profilerColumns[i]);
         GUIContent headerLabel        = (!profilerColumnName.StartsWith("|")) ? new GUIContent(profilerColumnName) : EditorGUIUtility.IconContent("ProfilerColumn." + profilerColumns[i], profilerColumnName);
         ProfilerFrameDataMultiColumnHeader.Column column = new ProfilerFrameDataMultiColumnHeader.Column
         {
             profilerColumn = profilerColumns[i],
             headerLabel    = headerLabel
         };
         array[i] = column;
     }
     return(array);
 }
Exemplo n.º 4
0
        void InitIfNeeded()
        {
            if (m_Initialized)
            {
                return;
            }

            if (m_CachedCallstack == null)
            {
                m_CachedCallstack = new List <ulong>();
            }

            var cpuDetailColumns = new[]
            {
                HierarchyFrameDataView.columnObjectName,
                HierarchyFrameDataView.columnTotalPercent,
                HierarchyFrameDataView.columnGcMemory,
                HierarchyFrameDataView.columnTotalTime
            };
            var gpuDetailColumns = new[]
            {
                HierarchyFrameDataView.columnObjectName,
                HierarchyFrameDataView.columnTotalGpuPercent,
                HierarchyFrameDataView.columnDrawCalls,
                HierarchyFrameDataView.columnTotalGpuTime
            };
            var profilerColumns   = gpuView ? gpuDetailColumns : cpuDetailColumns;
            var defaultSortColumn = gpuView ? HierarchyFrameDataView.columnTotalGpuTime : HierarchyFrameDataView.columnTotalTime;

            var columns     = ProfilerFrameDataHierarchyView.CreateColumns(profilerColumns);
            var headerState = ProfilerFrameDataHierarchyView.CreateDefaultMultiColumnHeaderState(columns, defaultSortColumn);

            headerState.columns[0].minWidth              = 60;
            headerState.columns[0].autoResize            = true;
            headerState.columns[0].allowToggleVisibility = false;

            var multiColumnHeaderStateData = SessionState.GetString(multiColumnHeaderStatePrefKey, "");

            if (!string.IsNullOrEmpty(multiColumnHeaderStateData))
            {
                try
                {
                    var restoredHeaderState = JsonUtility.FromJson <MultiColumnHeaderState>(multiColumnHeaderStateData);
                    if (restoredHeaderState != null)
                    {
                        m_MultiColumnHeaderState = restoredHeaderState;
                    }
                }
                catch {} // Nevermind, we'll just fall back to the default
            }

            if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState))
            {
                MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState);
            }

            var firstInit = m_MultiColumnHeaderState == null;

            m_MultiColumnHeaderState = headerState;

            m_MultiColumnHeader = new ProfilerFrameDataMultiColumnHeader(m_MultiColumnHeaderState, columns)
            {
                height = 25
            };
            if (firstInit)
            {
                m_MultiColumnHeader.ResizeToFit();
            }

            m_MultiColumnHeader.visibleColumnsChanged += OnMultiColumnHeaderChanged;
            m_MultiColumnHeader.sortingChanged        += OnMultiColumnHeaderChanged;

            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }
            m_TreeView = new ObjectsTreeView(m_TreeViewState, m_MultiColumnHeader);
            m_TreeView.frameItemEvent += frameItemEvent;

            if (m_VertSplit == null || m_VertSplit.relativeSizes == null || m_VertSplit.relativeSizes.Length == 0)
            {
                m_VertSplit = new SplitterState(new[] { SessionState.GetFloat(splitter0StatePrefKey, 60f), SessionState.GetFloat(splitter1StatePrefKey, 40f) }, new[] { 50, 50 }, null);
            }

            m_Initialized = true;
        }
Exemplo n.º 5
0
        void InitIfNeeded()
        {
            if (m_Initialized)
            {
                return;
            }

            var cpuDetailColumns = new[]
            {
                HierarchyFrameDataView.columnObjectName,
                HierarchyFrameDataView.columnTotalPercent,
                HierarchyFrameDataView.columnGcMemory,
                HierarchyFrameDataView.columnTotalTime
            };
            var gpuDetailColumns = new[]
            {
                HierarchyFrameDataView.columnObjectName,
                HierarchyFrameDataView.columnTotalGpuPercent,
                HierarchyFrameDataView.columnDrawCalls,
                HierarchyFrameDataView.columnTotalGpuTime
            };
            var profilerColumns   = gpuView ? gpuDetailColumns : cpuDetailColumns;
            var defaultSortColumn = gpuView ? HierarchyFrameDataView.columnTotalGpuTime : HierarchyFrameDataView.columnTotalTime;

            var columns     = ProfilerFrameDataHierarchyView.CreateColumns(profilerColumns);
            var headerState = ProfilerFrameDataHierarchyView.CreateDefaultMultiColumnHeaderState(columns, defaultSortColumn);

            headerState.columns[0].minWidth              = 60;
            headerState.columns[0].autoResize            = true;
            headerState.columns[0].allowToggleVisibility = false;
            if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState))
            {
                MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState);
            }

            var firstInit = m_MultiColumnHeaderState == null;

            m_MultiColumnHeaderState = headerState;

            m_MultiColumnHeader = new ProfilerFrameDataMultiColumnHeader(m_MultiColumnHeaderState, columns)
            {
                height = 25
            };
            if (firstInit)
            {
                m_MultiColumnHeader.ResizeToFit();
            }

            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }
            m_TreeView = new ObjectsTreeView(m_TreeViewState, m_MultiColumnHeader);
            m_TreeView.frameItemEvent += frameItemEvent;

            if (m_VertSplit == null || m_VertSplit.relativeSizes == null || m_VertSplit.relativeSizes.Length == 0)
            {
                m_VertSplit = new SplitterState(new[] { 60f, 40f }, new[] { 50, 50 }, null);
            }

            m_Initialized = true;
        }
 public override void OnEnable(CPUOrGPUProfilerModule cpuOrGpuProfilerModule, ProfilerFrameDataHierarchyView profilerFrameDataHierarchyView)
 {
     base.OnEnable(cpuOrGpuProfilerModule, profilerFrameDataHierarchyView);
 }
Exemplo n.º 7
0
 public virtual void OnEnable(CPUOrGPUProfilerModule cpuOrGpuProfilerModule, ProfilerFrameDataHierarchyView profilerFrameDataHierarchyView)
 {
     m_CPUOrGPUProfilerModule         = cpuOrGpuProfilerModule;
     m_ProfilerFrameDataHierarchyView = profilerFrameDataHierarchyView;
 }
Exemplo n.º 8
0
 private void InitIfNeeded()
 {
     if (!this.m_Initialized)
     {
         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.FunctionName,
             ProfilerColumn.TotalGPUPercent,
             ProfilerColumn.DrawCalls,
             ProfilerColumn.TotalGPUTime
         };
         ProfilerColumn[] profilerColumns   = (!base.gpuView) ? array : array2;
         ProfilerColumn   defaultSortColumn = (!base.gpuView) ? ProfilerColumn.TotalTime : ProfilerColumn.TotalGPUTime;
         ProfilerFrameDataMultiColumnHeader.Column[] columns = ProfilerFrameDataHierarchyView.CreateColumns(profilerColumns);
         MultiColumnHeaderState multiColumnHeaderState       = ProfilerFrameDataHierarchyView.CreateDefaultMultiColumnHeaderState(columns, defaultSortColumn);
         if (MultiColumnHeaderState.CanOverwriteSerializedFields(this.m_MultiColumnHeaderState, multiColumnHeaderState))
         {
             MultiColumnHeaderState.OverwriteSerializedFields(this.m_MultiColumnHeaderState, multiColumnHeaderState);
         }
         bool flag = this.m_MultiColumnHeaderState == null;
         this.m_MultiColumnHeaderState = multiColumnHeaderState;
         ProfilerFrameDataMultiColumnHeader profilerFrameDataMultiColumnHeader = new ProfilerFrameDataMultiColumnHeader(this.m_MultiColumnHeaderState, columns)
         {
             height = 25f
         };
         if (flag)
         {
             profilerFrameDataMultiColumnHeader.ResizeToFit();
         }
         if (this.m_TreeViewState == null)
         {
             this.m_TreeViewState = new TreeViewState();
         }
         this.m_TreeView = new ProfilerFrameDataTreeView(this.m_TreeViewState, profilerFrameDataMultiColumnHeader);
         this.m_TreeView.selectionChanged += new ProfilerFrameDataTreeView.SelectionChangedCallback(this.OnMainTreeViewSelectionChanged);
         this.m_TreeView.searchChanged    += new ProfilerFrameDataTreeView.SearchChangedCallback(this.OnMainTreeViewSearchChanged);
         this.m_SearchField = new SearchField();
         this.m_SearchField.downOrUpArrowKeyPressed += new SearchField.SearchFieldCallback(this.m_TreeView.SetFocusAndEnsureSelectedItem);
         if (this.m_DetailedObjectsView == null)
         {
             this.m_DetailedObjectsView = new ProfilerDetailedObjectsView();
         }
         this.m_DetailedObjectsView.gpuView         = base.gpuView;
         this.m_DetailedObjectsView.frameItemEvent += new ProfilerDetailedObjectsView.FrameItemCallback(this.FrameItem);
         if (this.m_DetailedCallsView == null)
         {
             this.m_DetailedCallsView = new ProfilerDetailedCallsView();
         }
         this.m_DetailedCallsView.frameItemEvent += new ProfilerDetailedCallsView.FrameItemCallback(this.FrameItem);
         if (this.m_DetailedViewSpliterState == null || this.m_DetailedViewSpliterState.relativeSizes == null || this.m_DetailedViewSpliterState.relativeSizes.Length == 0)
         {
             this.m_DetailedViewSpliterState = new SplitterState(new float[]
             {
                 70f,
                 30f
             }, new int[]
             {
                 450,
                 50
             }, null);
         }
         this.m_Initialized = true;
     }
 }