コード例 #1
0
 public ProfilerHierarchyGUI(IProfilerWindowController window, string columnSettingsName, ProfilerColumn[] columnsToShow, string[] columnNames, bool detailPane, ProfilerColumn sort)
 {
     this.m_Window             = window;
     this.m_ColumnNames        = columnNames;
     this.m_ColumnSettingsName = columnSettingsName;
     this.m_ColumnsToShow      = columnsToShow;
     this.m_DetailPane         = detailPane;
     this.m_SortType           = sort;
     this.m_HeaderContent      = new GUIContent[columnNames.Length];
     this.m_Splitter           = null;
     for (int i = 0; i < this.m_HeaderContent.Length; i++)
     {
         this.m_HeaderContent[i] = EditorGUIUtility.TextContent(this.m_ColumnNames[i]);
     }
     if (columnsToShow.Length != columnNames.Length)
     {
         throw new ArgumentException("Number of columns to show does not match number of column names.");
     }
     this.m_SearchHeader   = new GUIContent("Search");
     this.m_VisibleColumns = new bool[columnNames.Length];
     for (int j = 0; j < this.m_VisibleColumns.Length; j++)
     {
         this.m_VisibleColumns[j] = true;
     }
     this.m_SearchResults = new ProfilerHierarchyGUI.SearchResults();
     this.m_SearchResults.Init(100);
     this.m_Window.Repaint();
 }
コード例 #2
0
 public void Set(int frameIndex, ProfilerViewType viewType, ProfilerColumn sortType)
 {
     this.frameIndex   = frameIndex;
     this.sortType     = sortType;
     this.viewType     = viewType;
     this.propertyPath = ProfilerDriver.selectedPropertyPath;
 }
コード例 #3
0
 public ProfilerHierarchyGUI(IProfilerWindowController window, string columnSettingsName, ProfilerColumn[] columnsToShow, string[] columnNames, bool detailPane, ProfilerColumn sort)
 {
     this.m_Window             = window;
     this.m_ColumnNames        = columnNames;
     this.m_ColumnSettingsName = columnSettingsName;
     this.m_ColumnsToShow      = columnsToShow;
     this.m_DetailPane         = detailPane;
     this.m_SortType           = sort;
     this.m_HeaderContent      = new GUIContent[columnNames.Length];
     this.m_Splitter           = (SplitterState)null;
     for (int index = 0; index < this.m_HeaderContent.Length; ++index)
     {
         this.m_HeaderContent[index] = !this.m_ColumnNames[index].StartsWith("|") ? new GUIContent(this.m_ColumnNames[index]) : EditorGUIUtility.IconContent("ProfilerColumn." + columnsToShow[index].ToString(), this.m_ColumnNames[index]);
     }
     if (columnsToShow.Length != columnNames.Length)
     {
         throw new ArgumentException("Number of columns to show does not match number of column names.");
     }
     this.m_SearchHeader   = new GUIContent("Search");
     this.m_VisibleColumns = new bool[columnNames.Length];
     for (int index = 0; index < this.m_VisibleColumns.Length; ++index)
     {
         this.m_VisibleColumns[index] = true;
     }
     this.m_SearchResults = new ProfilerHierarchyGUI.SearchResults();
     this.m_SearchResults.Init(100);
     this.m_Window.Repaint();
 }
コード例 #4
0
 public ProfilerHierarchyGUI(IProfilerWindowController window, string columnSettingsName, ProfilerColumn[] columnsToShow, string[] columnNames, bool detailPane, ProfilerColumn sort)
 {
     this.m_Window = window;
     this.m_ColumnNames = columnNames;
     this.m_ColumnSettingsName = columnSettingsName;
     this.m_ColumnsToShow = columnsToShow;
     this.m_DetailPane = detailPane;
     this.m_SortType = sort;
     this.m_HeaderContent = new GUIContent[columnNames.Length];
     this.m_Splitter = null;
     for (int i = 0; i < this.m_HeaderContent.Length; i++)
     {
         this.m_HeaderContent[i] = !this.m_ColumnNames[i].StartsWith("|") ? new GUIContent(this.m_ColumnNames[i]) : EditorGUIUtility.IconContent("ProfilerColumn." + columnsToShow[i].ToString(), this.m_ColumnNames[i]);
     }
     if (columnsToShow.Length != columnNames.Length)
     {
         throw new ArgumentException("Number of columns to show does not match number of column names.");
     }
     this.m_SearchHeader = new GUIContent("Search");
     this.m_VisibleColumns = new bool[columnNames.Length];
     for (int j = 0; j < this.m_VisibleColumns.Length; j++)
     {
         this.m_VisibleColumns[j] = true;
     }
     this.m_SearchResults = new SearchResults();
     this.m_SearchResults.Init(100);
     this.m_Window.Repaint();
 }
コード例 #5
0
        private void DrawTitle(GUIContent name, int index)
        {
            if (!this.ColIsVisible(index))
            {
                return;
            }
            ProfilerColumn profilerColumn = this.m_ColumnsToShow[index];
            bool           flag           = this.sortType == profilerColumn;
            int            num;

            if (index == 0)
            {
                num = GUILayout.Toggle(flag, name, ProfilerHierarchyGUI.styles.header, new GUILayoutOption[0]) ? 1 : 0;
            }
            else
            {
                num = GUILayout.Toggle((flag ? 1 : 0) != 0, name, ProfilerHierarchyGUI.styles.rightHeader, new GUILayoutOption[1]
                {
                    GUILayout.Width((float)this.m_SplitterMinWidths[index])
                }) ? 1 : 0;
            }
            if (num == 0)
            {
                return;
            }
            this.sortType = profilerColumn;
        }
コード例 #6
0
        /// <summary>
        /// 获取CPU一段时间的耗时走势
        /// </summary>
        /// <param name="beginFrame"></param>
        /// <param name="endFrame"></param>
        /// <returns></returns>
        public static List <float> CPUOrGPUUsedTime(int beginFrame, int endFrame, ProfilerColumn column)
        {
            List <float> usedTime = new List <float>();

            if (usedTime == null)
            {
                return(null);
            }

            float totalTime = 0;

            for (int i = beginFrame - 1; i < endFrame; i++)
            {
                SetCurrentFrame(i);
                float time = GetCPUOrGPUTotalTimeOneFrame(column);
                //if (time < 0)
                //{
                //    UnityEngine.Debug.LogError("获取数据错误,检查当前帧是否存在数据");
                //    return null;
                //}

                usedTime.Add(time);
                totalTime += time;
            }
            return(usedTime);
        }
コード例 #7
0
 private void InitIfNeeded()
 {
     if (!this.m_Initialized)
     {
         ProfilerColumn[] array = new ProfilerColumn[]
         {
             ProfilerColumn.ObjectName,
             ProfilerColumn.TotalPercent,
             ProfilerColumn.GCMemory,
             ProfilerColumn.TotalTime
         };
         ProfilerColumn[] array2 = new ProfilerColumn[]
         {
             ProfilerColumn.ObjectName,
             ProfilerColumn.TotalGPUPercent,
             ProfilerColumn.DrawCalls,
             ProfilerColumn.TotalGPUTime
         };
         ProfilerColumn[] profilerColumns   = (!this.gpuView) ? array : array2;
         ProfilerColumn   defaultSortColumn = (!this.gpuView) ? ProfilerColumn.TotalTime : ProfilerColumn.TotalGPUTime;
         ProfilerFrameDataMultiColumnHeader.Column[] columns = ProfilerFrameDataHierarchyView.CreateColumns(profilerColumns);
         MultiColumnHeaderState multiColumnHeaderState       = ProfilerFrameDataHierarchyView.CreateDefaultMultiColumnHeaderState(columns, defaultSortColumn);
         multiColumnHeaderState.columns[0].minWidth              = 60f;
         multiColumnHeaderState.columns[0].autoResize            = true;
         multiColumnHeaderState.columns[0].allowToggleVisibility = false;
         if (MultiColumnHeaderState.CanOverwriteSerializedFields(this.m_MultiColumnHeaderState, multiColumnHeaderState))
         {
             MultiColumnHeaderState.OverwriteSerializedFields(this.m_MultiColumnHeaderState, multiColumnHeaderState);
         }
         bool flag = this.m_MultiColumnHeaderState == null;
         this.m_MultiColumnHeaderState = multiColumnHeaderState;
         this.m_MultiColumnHeader      = new ProfilerFrameDataMultiColumnHeader(this.m_MultiColumnHeaderState, columns)
         {
             height = 25f
         };
         if (flag)
         {
             this.m_MultiColumnHeader.ResizeToFit();
         }
         if (this.m_TreeViewState == null)
         {
             this.m_TreeViewState = new TreeViewState();
         }
         this.m_TreeView = new ProfilerDetailedObjectsView.ObjectsTreeView(this.m_TreeViewState, this.m_MultiColumnHeader);
         this.m_TreeView.frameItemEvent += this.frameItemEvent;
         if (this.m_VertSplit == null || this.m_VertSplit.relativeSizes == null || this.m_VertSplit.relativeSizes.Length == 0)
         {
             this.m_VertSplit = new SplitterState(new float[]
             {
                 60f,
                 40f
             }, new int[]
             {
                 50,
                 50
             }, null);
         }
         this.m_Initialized = true;
     }
 }
コード例 #8
0
        public static void SetSortType(SortType sortType)
        {
            switch (sortType)
            {
            case SortType.TotalPercent:
                sSortCollum = ProfilerColumn.TotalPercent;
                break;

            case SortType.SelfPercent:
                sSortCollum = ProfilerColumn.SelfPercent;
                break;

            case SortType.Calls:
                sSortCollum = ProfilerColumn.Calls;
                break;

            case SortType.GCMemory:
                sSortCollum = ProfilerColumn.GCMemory;
                break;

            case SortType.TotalTime:
                sSortCollum = ProfilerColumn.TotalTime;
                break;

            case SortType.SelfTime:
                sSortCollum = ProfilerColumn.SelfTime;
                break;
            }
        }
コード例 #9
0
        public static float GetCPUOrGPUTotalTimeOneFrame(ProfilerColumn colume)
        {
            if (IsPropertyEmpty())
            {
                return(-1);
            }

            string ans = CPUOrGPUproperty.GetColumn(colume);
            float  ret = 0;

            if (string.IsNullOrEmpty(ans))
            {
                return(-1);
            }

            bool canConvert = float.TryParse(ans, out ret);

            if (canConvert)
            {
                return(float.Parse(ans));
            }
            else
            {
                return(-1);
            }
        }
コード例 #10
0
        public ProfilerProperty CreateProperty(bool details)
        {
            ProfilerProperty profilerProperty   = new ProfilerProperty();
            ProfilerColumn   profilerSortColumn = (this.m_CurrentArea != ProfilerArea.CPU) ? ((!details) ? this.m_GPUHierarchyGUI.sortType : this.m_GPUDetailHierarchyGUI.sortType) : ((!details) ? this.m_CPUHierarchyGUI.sortType : this.m_CPUDetailHierarchyGUI.sortType);

            profilerProperty.SetRoot(this.GetActiveVisibleFrameIndex(), profilerSortColumn, this.m_ViewType);
            profilerProperty.onlyShowGPUSamples = (this.m_CurrentArea == ProfilerArea.GPU);
            return(profilerProperty);
        }
コード例 #11
0
 public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
 {
     if (!(searchString == this.m_LastSearchString) || frameIndex != this.m_LastFrameIndex || sortType != this.m_LastSortType)
     {
         this.m_LastSearchString = searchString;
         this.m_LastFrameIndex   = frameIndex;
         this.m_LastSortType     = sortType;
         this.IterateProfilingData(property, columns, searchString);
     }
 }
コード例 #12
0
			public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
			{
				if (searchString == this.m_LastSearchString && frameIndex == this.m_LastFrameIndex && sortType == this.m_LastSortType)
				{
					return;
				}
				this.m_LastSearchString = searchString;
				this.m_LastFrameIndex = frameIndex;
				this.m_LastSortType = sortType;
				this.IterateProfilingData(property, columns, searchString);
			}
コード例 #13
0
 public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
 {
     if (searchString == this.m_LastSearchString && frameIndex == this.m_LastFrameIndex && sortType == this.m_LastSortType)
     {
         return;
     }
     this.m_LastSearchString = searchString;
     this.m_LastFrameIndex   = frameIndex;
     this.m_LastSortType     = sortType;
     this.IterateProfilingData(property, columns, searchString);
 }
コード例 #14
0
 private void DrawTitle(GUIContent name, int index)
 {
     if (this.ColIsVisible(index))
     {
         ProfilerColumn column = this.m_ColumnsToShow[index];
         bool           flag   = this.sortType == column;
         if ((index != 0) ? GUILayout.Toggle(flag, name, styles.rightHeader, new GUILayoutOption[] { GUILayout.Width((float)this.m_SplitterMinWidths[index]) }) : GUILayout.Toggle(flag, name, styles.header, new GUILayoutOption[0]))
         {
             this.sortType = column;
         }
     }
 }
コード例 #15
0
        public int GetMultiColumnHeaderIndex(ProfilerColumn profilerColumn)
        {
            for (var i = 0; i < m_Columns.Length; ++i)
            {
                if (m_Columns[i].profilerColumn == profilerColumn)
                {
                    return(i);
                }
            }

            return(0);
        }
コード例 #16
0
    private void DrawColumnHeader(string label, ProfilerColumn column, float width, GUIStyle style)
    {
        bool toggleResult = GUI.Toggle(new Rect(headerLeftOffset, columnHeadersRect.y, width, columnHeadersRect.height),
                                       columnToSort == column, label, style);

        if (toggleResult == true)
        {
            ColumnToSort = column;
        }

        headerLeftOffset += width;
    }
コード例 #17
0
        public static int GetMultiColumnHeaderIndex(Column[] columns, ProfilerColumn profilerColumn)
        {
            for (var i = 0; i < columns.Length; ++i)
            {
                if (columns[i].profilerColumn == profilerColumn)
                {
                    return(i);
                }
            }

            return(0);
        }
コード例 #18
0
        FunctionDataValue FindDataValue(ProfilerColumn column)
        {
            var length = Values.Length;

            for (var i = 0; i < length; ++i)
            {
                var value = Values[i];
                if (value.Column == column)
                {
                    return(value);
                }
            }
            return(null);
        }
コード例 #19
0
        static string GetProfilerColumnName(ProfilerColumn column)
        {
            switch (column)
            {
            case ProfilerColumn.FunctionName:
                return(LocalizationDatabase.GetLocalizedString("Overview"));

            case ProfilerColumn.TotalPercent:
                return(LocalizationDatabase.GetLocalizedString("Total"));

            case ProfilerColumn.SelfPercent:
                return(LocalizationDatabase.GetLocalizedString("Self"));

            case ProfilerColumn.Calls:
                return(LocalizationDatabase.GetLocalizedString("Calls"));

            case ProfilerColumn.GCMemory:
                return(LocalizationDatabase.GetLocalizedString("GC Alloc"));

            case ProfilerColumn.TotalTime:
                return(LocalizationDatabase.GetLocalizedString("Time ms"));

            case ProfilerColumn.SelfTime:
                return(LocalizationDatabase.GetLocalizedString("Self ms"));

            case ProfilerColumn.DrawCalls:
                return(LocalizationDatabase.GetLocalizedString("DrawCalls"));

            case ProfilerColumn.TotalGPUTime:
                return(LocalizationDatabase.GetLocalizedString("GPU ms"));

            case ProfilerColumn.SelfGPUTime:
                return(LocalizationDatabase.GetLocalizedString("Self ms"));

            case ProfilerColumn.TotalGPUPercent:
                return(LocalizationDatabase.GetLocalizedString("Total"));

            case ProfilerColumn.SelfGPUPercent:
                return(LocalizationDatabase.GetLocalizedString("Self"));

            case ProfilerColumn.WarningCount:
                return(LocalizationDatabase.GetLocalizedString("|Warnings"));

            case ProfilerColumn.ObjectName:
                return(LocalizationDatabase.GetLocalizedString("Name"));

            default:
                return("ProfilerColumn." + column);
            }
        }
コード例 #20
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);
        }
コード例 #21
0
        public int GetMultiColumnHeaderIndex(ProfilerColumn profilerColumn)
        {
            int result;

            for (int i = 0; i < this.m_Columns.Length; i++)
            {
                if (this.m_Columns[i].profilerColumn == profilerColumn)
                {
                    result = i;
                    return(result);
                }
            }
            result = 0;
            return(result);
        }
コード例 #22
0
 private void DrawTitle(GUIContent name, int index)
 {
     if (this.ColIsVisible(index))
     {
         ProfilerColumn profilerColumn = this.m_ColumnsToShow[index];
         bool           value          = this.sortType == profilerColumn;
         bool           flag           = (index != 0) ? GUILayout.Toggle(value, name, ProfilerHierarchyGUI.styles.rightHeader, new GUILayoutOption[]
         {
             GUILayout.Width((float)this.m_SplitterMinWidths[index])
         }) : GUILayout.Toggle(value, name, ProfilerHierarchyGUI.styles.header, new GUILayoutOption[0]);
         if (flag)
         {
             this.sortType = profilerColumn;
         }
     }
 }
コード例 #23
0
 public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState(ProfilerFrameDataMultiColumnHeader.Column[] columns, ProfilerColumn defaultSortColumn)
 {
     MultiColumnHeaderState.Column[] array = new MultiColumnHeaderState.Column[columns.Length];
     for (int i = 0; i < columns.Length; i++)
     {
         int            num                   = 80;
         int            num2                  = 50;
         float          maxWidth              = 1000000f;
         bool           autoResize            = false;
         bool           allowToggleVisibility = true;
         ProfilerColumn profilerColumn        = columns[i].profilerColumn;
         if (profilerColumn != ProfilerColumn.FunctionName)
         {
             if (profilerColumn == ProfilerColumn.WarningCount)
             {
                 num      = 25;
                 num2     = 25;
                 maxWidth = 25f;
             }
         }
         else
         {
             num                   = 200;
             num2                  = 200;
             autoResize            = true;
             allowToggleVisibility = false;
         }
         MultiColumnHeaderState.Column column = new MultiColumnHeaderState.Column
         {
             headerContent         = columns[i].headerLabel,
             headerTextAlignment   = TextAlignment.Left,
             sortingArrowAlignment = TextAlignment.Right,
             width                 = (float)num,
             minWidth              = (float)num2,
             maxWidth              = maxWidth,
             autoResize            = autoResize,
             allowToggleVisibility = allowToggleVisibility,
             sortedAscending       = (i == 0)
         };
         array[i] = column;
     }
     return(new MultiColumnHeaderState(array)
     {
         sortedColumnIndex = ProfilerFrameDataMultiColumnHeader.GetMultiColumnHeaderIndex(columns, defaultSortColumn)
     });
 }
コード例 #24
0
 private void BuildColumns()
 {
   ProfilerColumn[] profilerColumnArray1 = new ProfilerColumn[8]{ ProfilerColumn.FunctionName, ProfilerColumn.TotalPercent, ProfilerColumn.SelfPercent, ProfilerColumn.Calls, ProfilerColumn.GCMemory, ProfilerColumn.TotalTime, ProfilerColumn.SelfTime, ProfilerColumn.WarningCount };
   ProfilerColumn[] profilerColumnArray2 = new ProfilerColumn[7]{ ProfilerColumn.ObjectName, ProfilerColumn.TotalPercent, ProfilerColumn.SelfPercent, ProfilerColumn.Calls, ProfilerColumn.GCMemory, ProfilerColumn.TotalTime, ProfilerColumn.SelfTime };
   this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerColumnsV2", profilerColumnArray1, ProfilerWindow.ProfilerColumnNames(profilerColumnArray1), false, ProfilerColumn.TotalTime);
   this.m_CPUTimelineGUI = new ProfilerTimelineGUI((IProfilerWindowController) this);
   string text = EditorGUIUtility.TextContent("Object").text;
   string[] columnNames1 = ProfilerWindow.ProfilerColumnNames(profilerColumnArray2);
   columnNames1[0] = text;
   this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerDetailColumns", profilerColumnArray2, columnNames1, true, ProfilerColumn.TotalTime);
   ProfilerColumn[] profilerColumnArray3 = new ProfilerColumn[4]{ ProfilerColumn.FunctionName, ProfilerColumn.TotalGPUPercent, ProfilerColumn.DrawCalls, ProfilerColumn.TotalGPUTime };
   ProfilerColumn[] profilerColumnArray4 = new ProfilerColumn[4]{ ProfilerColumn.ObjectName, ProfilerColumn.TotalGPUPercent, ProfilerColumn.DrawCalls, ProfilerColumn.TotalGPUTime };
   this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerGPUColumns", profilerColumnArray3, ProfilerWindow.ProfilerColumnNames(profilerColumnArray3), false, ProfilerColumn.TotalGPUTime);
   string[] columnNames2 = ProfilerWindow.ProfilerColumnNames(profilerColumnArray4);
   columnNames2[0] = text;
   this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerGPUDetailColumns", profilerColumnArray4, columnNames2, true, ProfilerColumn.TotalGPUTime);
 }
コード例 #25
0
        public IList <FunctionData> CalculateStats(ProfilerColumn[] columnsToShow, ProfilerColumn sortColumn)
        {
            //using (Profiler.AddSample(Profiler.SamplerType.CalculateStats))
            {
                var firstFrameIndex = ProfilerDriver.firstFrameIndex;
                var lastFrameIndex  = ProfilerDriver.lastFrameIndex;
                var profilerData    = ProfilerData.GetProfilerData(firstFrameIndex, lastFrameIndex);

                var frames = profilerData.frames;
                for (int i = 0; i < frames.Count; ++i)
                {
                    var frameData = frames[i];
                    var functions = frameData.functions;
                    for (int j = 0; j < functions.Count; ++j)
                    {
                        var functionData = functions[j];
                        var functionName = functionData.GetValue(ProfilerColumn.FunctionName);
                        List <FunctionData> functionsData;
                        if (!functionsDataByName.TryGetValue(functionName, out functionsData))
                        {
                            functionsData = new List <FunctionData>();
                            functionsDataByName.Add(functionName, functionsData);
                        }
                        functionsData.Add(functionData);
                    }
                }

                this.columnsToShow = columnsToShow;

                var functionStats = new List <FunctionData>(functionsDataByName.Count);
                foreach (var pair in functionsDataByName)
                {
                    var functionName  = pair.Key;
                    var functionsData = pair.Value;
                    functionStats.Add(AggregateFunction(functionName, functionsData));
                }

                this.sortColumn = sortColumn;
                functionStats.Sort(FunctionStatsSorter);

                functionsDataByName.Clear();
                profilerData.Clear();
                return(functionStats);
            }
        }
        private FunctionDataValue GetValue(FunctionData[] framesData, ProfilerColumn column)
        {
            var functionDataValue = new FunctionDataValue {
                column = ProfilerColumnNames[(int)column]
            };
            var getFunctionValue = getFunctionValues[(int)column];

            if (column != ProfilerColumn.GCMemory)
            {
                functionDataValue.value =
                    AggregateValues(framesData.Select(getFunctionValue)).ToString("F2");
            }
            else
            {
                functionDataValue.value =
                    ByteSize.FromBytes(AggregateValues(framesData.Select(getFunctionValue)))
                    .ToString();
            }
            return(functionDataValue);
        }
コード例 #27
0
        private FunctionDataValue GetValue(IList <FunctionData> framesData, ProfilerColumn column)
        {
            var functionDataValue = new FunctionDataValue {
                column = ProfilerColumnNames[(int)column]
            };
            var getFunctionValue = getFunctionValues[(int)column];

            for (int i = 0; i < framesData.Count; ++i)
            {
                values.Add(getFunctionValue(framesData[i]));
            }

            if (column != ProfilerColumn.GCMemory)
            {
                functionDataValue.value = AggregateValues(values).ToString("F2");
            }
            else
            {
                functionDataValue.value = ByteSize.FromBytes(AggregateValues(values)).ToString();
            }

            values.Clear();
            return(functionDataValue);
        }
コード例 #28
0
ファイル: ProfilerWindow.cs プロジェクト: randomize/VimConfig
        private static string[] ProfilerColumnNames(ProfilerColumn[] columns)
        {
            string[] names = Enum.GetNames(typeof(ProfilerColumn));
            string[] strArray2 = new string[columns.Length];
            for (int i = 0; i < columns.Length; i++)
            {
                switch (columns[i])
                {
                    case ProfilerColumn.FunctionName:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Overview");
                        break;

                    case ProfilerColumn.TotalPercent:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Total");
                        break;

                    case ProfilerColumn.SelfPercent:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Self");
                        break;

                    case ProfilerColumn.Calls:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Calls");
                        break;

                    case ProfilerColumn.GCMemory:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("GC Alloc");
                        break;

                    case ProfilerColumn.TotalTime:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Time ms");
                        break;

                    case ProfilerColumn.SelfTime:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Self ms");
                        break;

                    case ProfilerColumn.DrawCalls:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("DrawCalls");
                        break;

                    case ProfilerColumn.TotalGPUTime:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("GPU ms");
                        break;

                    case ProfilerColumn.SelfGPUTime:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Self ms");
                        break;

                    case ProfilerColumn.TotalGPUPercent:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Total");
                        break;

                    case ProfilerColumn.SelfGPUPercent:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Self");
                        break;

                    case ProfilerColumn.WarningCount:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("|Warnings");
                        break;

                    case ProfilerColumn.ObjectName:
                        strArray2[i] = LocalizationDatabase.GetLocalizedString("Name");
                        break;

                    default:
                        strArray2[i] = "ProfilerColumn." + names[(int) columns[i]];
                        break;
                }
            }
            return strArray2;
        }
コード例 #29
0
ファイル: ProfilerWindow.cs プロジェクト: randomize/VimConfig
 private void BuildColumns()
 {
     ProfilerColumn[] columnArray1 = new ProfilerColumn[8];
     columnArray1[1] = ProfilerColumn.TotalPercent;
     columnArray1[2] = ProfilerColumn.SelfPercent;
     columnArray1[3] = ProfilerColumn.Calls;
     columnArray1[4] = ProfilerColumn.GCMemory;
     columnArray1[5] = ProfilerColumn.TotalTime;
     columnArray1[6] = ProfilerColumn.SelfTime;
     columnArray1[7] = ProfilerColumn.WarningCount;
     ProfilerColumn[] columnsToShow = columnArray1;
     ProfilerColumn[] columns = new ProfilerColumn[] { ProfilerColumn.ObjectName, ProfilerColumn.TotalPercent, ProfilerColumn.SelfPercent, ProfilerColumn.Calls, ProfilerColumn.GCMemory, ProfilerColumn.TotalTime, ProfilerColumn.SelfTime };
     this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerColumnsV2", columnsToShow, ProfilerColumnNames(columnsToShow), false, ProfilerColumn.TotalTime);
     this.m_CPUTimelineGUI = new ProfilerTimelineGUI(this);
     string text = EditorGUIUtility.TextContent("Object").text;
     string[] columnNames = ProfilerColumnNames(columns);
     columnNames[0] = text;
     this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerDetailColumns", columns, columnNames, true, ProfilerColumn.TotalTime);
     ProfilerColumn[] columnArray6 = new ProfilerColumn[4];
     columnArray6[1] = ProfilerColumn.TotalGPUPercent;
     columnArray6[2] = ProfilerColumn.DrawCalls;
     columnArray6[3] = ProfilerColumn.TotalGPUTime;
     ProfilerColumn[] columnArray3 = columnArray6;
     ProfilerColumn[] columnArray4 = new ProfilerColumn[] { ProfilerColumn.ObjectName, ProfilerColumn.TotalGPUPercent, ProfilerColumn.DrawCalls, ProfilerColumn.TotalGPUTime };
     this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUColumns", columnArray3, ProfilerColumnNames(columnArray3), false, ProfilerColumn.TotalGPUTime);
     columnNames = ProfilerColumnNames(columnArray4);
     columnNames[0] = text;
     this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUDetailColumns", columnArray4, columnNames, true, ProfilerColumn.TotalGPUTime);
 }
コード例 #30
0
 public extern string GetColumn(ProfilerColumn column);
コード例 #31
0
 public extern string GetTooltip(ProfilerColumn column);
コード例 #32
0
 public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
 {
     if (((searchString != this.m_LastSearchString) || (frameIndex != this.m_LastFrameIndex)) || (sortType != this.m_LastSortType))
     {
         this.m_LastSearchString = searchString;
         this.m_LastFrameIndex = frameIndex;
         this.m_LastSortType = sortType;
         this.IterateProfilingData(property, columns, searchString);
     }
 }
コード例 #33
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);
		}
コード例 #34
0
		private void DrawTitle(GUIContent name, int index)
		{
			if (!this.ColIsVisible(index))
			{
				return;
			}
			ProfilerColumn profilerColumn = this.m_ColumnsToShow[index];
			bool value = this.sortType == profilerColumn;
			bool flag = (index != 0) ? GUILayout.Toggle(value, name, ProfilerHierarchyGUI.styles.rightHeader, new GUILayoutOption[]
			{
				GUILayout.Width((float)this.m_SplitterMinWidths[index])
			}) : GUILayout.Toggle(value, name, ProfilerHierarchyGUI.styles.header, new GUILayoutOption[0]);
			if (flag)
			{
				this.sortType = profilerColumn;
			}
		}
コード例 #35
0
 public extern string GetColumn(ProfilerColumn column);
コード例 #36
0
			private void IterateProfilingData(ProfilerProperty property, ProfilerColumn[] columns, string searchString)
			{
				this.m_NumResultsUsed = 0;
				this.m_ColumnsToShow = columns;
				this.m_FoundAllResults = true;
				this.m_SelectedSearchIndex = -1;
				int num = 0;
				string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
				while (property.Next(true))
				{
					if (num >= this.m_SearchResults.Length)
					{
						this.m_FoundAllResults = false;
						break;
					}
					string propertyPath = property.propertyPath;
					int startIndex = Mathf.Max(propertyPath.LastIndexOf('/'), 0);
					if (propertyPath.IndexOf(searchString, startIndex, StringComparison.CurrentCultureIgnoreCase) > -1)
					{
						string[] array = new string[this.m_ColumnsToShow.Length];
						for (int i = 0; i < this.m_ColumnsToShow.Length; i++)
						{
							array[i] = property.GetColumn(this.m_ColumnsToShow[i]);
						}
						this.m_SearchResults[num].propertyPath = propertyPath;
						this.m_SearchResults[num].columnValues = array;
						if (propertyPath == selectedPropertyPath)
						{
							this.m_SelectedSearchIndex = num;
						}
						num++;
					}
				}
				this.m_NumResultsUsed = num;
			}
コード例 #37
0
 public extern string GetTooltip(ProfilerColumn column);
コード例 #38
0
 public bool EqualsTo(int frameIndex, ProfilerViewType viewType, ProfilerColumn sortType)
 {
     return(this.frameIndex == frameIndex && this.sortType == sortType && this.viewType == viewType && this.propertyPath == ProfilerDriver.selectedPropertyPath);
 }
コード例 #39
0
 public extern void SetRoot(int frame, ProfilerColumn profilerSortColumn, ProfilerViewType viewType);
コード例 #40
0
 public string GetTooltip(ProfilerColumn column);
コード例 #41
0
 public string GetColumn(ProfilerColumn column);
コード例 #42
0
		private static string[] ProfilerColumnNames(ProfilerColumn[] columns)
		{
			string[] names = Enum.GetNames(typeof(ProfilerColumn));
			string[] array = new string[columns.Length];
			for (int i = 0; i < columns.Length; i++)
			{
				array[i] = "ProfilerColumn." + names[(int)columns[i]];
			}
			return array;
		}
コード例 #43
0
        public string GetValue(ProfilerColumn column)
        {
            var columnName = ColumnNames[(int)column];

            return(FindDataValue(columnName).value);
        }
コード例 #44
0
 private void BuildColumns()
 {
     ProfilerColumn[] columnsToShow = new ProfilerColumn[] { ProfilerColumn.FunctionName };
     ProfilerColumn[] columns = new ProfilerColumn[] { ProfilerColumn.ObjectName };
     this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerColumnsV2", columnsToShow, ProfilerColumnNames(columnsToShow), false, ProfilerColumn.TotalTime);
     this.m_CPUTimelineGUI = new ProfilerTimelineGUI(this);
     string text = EditorGUIUtility.TextContent("Object").text;
     string[] columnNames = ProfilerColumnNames(columns);
     columnNames[0] = text;
     this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerDetailColumns", columns, columnNames, true, ProfilerColumn.TotalTime);
     ProfilerColumn[] columnArray3 = new ProfilerColumn[] { ProfilerColumn.FunctionName };
     ProfilerColumn[] columnArray4 = new ProfilerColumn[] { ProfilerColumn.ObjectName };
     this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUColumns", columnArray3, ProfilerColumnNames(columnArray3), false, ProfilerColumn.TotalGPUTime);
     columnNames = ProfilerColumnNames(columnArray4);
     columnNames[0] = text;
     this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUDetailColumns", columnArray4, columnNames, true, ProfilerColumn.TotalGPUTime);
 }
コード例 #45
0
 public extern void SetRoot(int frame, ProfilerColumn profilerSortColumn, ProfilerViewType viewType);
コード例 #46
0
 private void DrawTitle(GUIContent name, int index)
 {
   if (!this.ColIsVisible(index))
     return;
   ProfilerColumn profilerColumn = this.m_ColumnsToShow[index];
   bool flag = this.sortType == profilerColumn;
   int num;
   if (index == 0)
     num = GUILayout.Toggle(flag, name, ProfilerHierarchyGUI.styles.header, new GUILayoutOption[0]) ? 1 : 0;
   else
     num = GUILayout.Toggle((flag ? 1 : 0) != 0, name, ProfilerHierarchyGUI.styles.rightHeader, new GUILayoutOption[1]
     {
       GUILayout.Width((float) this.m_SplitterMinWidths[index])
     }) ? 1 : 0;
   if (num == 0)
     return;
   this.sortType = profilerColumn;
 }
コード例 #47
0
 public FunctionDataValue(ProfilerColumn column, string value)
 {
     Column = column;
     Value  = value;
 }