private int DrawTreeView(ProfilerProperty property, int id) { this.m_SelectedIndex = -1; bool enterChildren = true; int num = 0; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; bool flag = (!this.m_DetailPane) ? (propertyPath == selectedPropertyPath) : (this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property)); if (flag) { this.m_SelectedIndex = num; } bool flag2 = Event.current.type != EventType.Layout; flag2 &= (this.m_ScrollViewHeight == 0 || ((float)num * 16f <= (float)this.m_ScrollViewHeight + this.m_TextScroll.y && (float)(num + 1) * 16f > this.m_TextScroll.y)); if (flag2) { enterChildren = this.DrawProfileDataItem(property, num, flag, id); } else { enterChildren = (property.HasChildren && this.IsExpanded(propertyPath)); } num++; } return(num); }
public ProfilerProperty GetDetailedProperty() { ProfilerProperty rootProfilerProperty = this.m_Window.GetRootProfilerProperty(this.sortType); bool enterChildren = true; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; ProfilerProperty result; while (rootProfilerProperty.Next(enterChildren)) { string propertyPath = rootProfilerProperty.propertyPath; if (propertyPath == selectedPropertyPath) { ProfilerProperty profilerProperty = new ProfilerProperty(); profilerProperty.InitializeDetailProperty(rootProfilerProperty); result = profilerProperty; return(result); } if (rootProfilerProperty.HasChildren) { enterChildren = this.IsExpanded(propertyPath); } } result = null; return(result); }
private int DrawTreeView(ProfilerProperty property, int id) { this.m_SelectedIndex = -1; bool enterChildren = true; int rowCount = 0; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; bool selected = !this.m_DetailPane ? (propertyPath == selectedPropertyPath) : ((this.m_DetailViewSelectedProperty != string.Empty) && (this.m_DetailViewSelectedProperty == DetailViewSelectedPropertyPath(property))); if (selected) { this.m_SelectedIndex = rowCount; } bool flag3 = Event.current.type != EventType.Layout; if (flag3 & ((this.m_ScrollViewHeight == 0) || (((rowCount * 16f) <= (this.m_ScrollViewHeight + this.m_TextScroll.y)) && (((rowCount + 1) * 16f) > this.m_TextScroll.y)))) { enterChildren = this.DrawProfileDataItem(property, rowCount, selected, id); } else { enterChildren = property.HasChildren && this.IsExpanded(propertyPath); } rowCount++; } return(rowCount); }
private void MoveSelection(int steps) { if (this.IsSearchActive()) { this.m_SearchResults.MoveSelection(steps, this); } else { int num1 = this.m_SelectedIndex + steps; if (num1 < 0) { num1 = 0; } ProfilerProperty property = this.m_Window.CreateProperty(this.m_DetailPane); if (this.m_DetailPane) { ProfilerProperty detailedProperty = this.GetDetailedProperty(property); property.Cleanup(); property = detailedProperty; } if (property == null) { return; } bool enterChildren = true; int num2 = 0; int instanceId = -1; while (property.Next(enterChildren)) { if (this.m_DetailPane && property.instanceIDs != null && (property.instanceIDs.Length > 0 && property.instanceIDs[0] != 0)) { instanceId = property.instanceIDs[0]; } if (num2 != num1) { if (property.HasChildren) { enterChildren = !this.m_DetailPane && this.IsExpanded(property.propertyPath); } ++num2; } else { break; } } if (this.m_DetailPane) { this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, instanceId); } else { this.m_Window.SetSelectedPropertyPath(property.propertyPath); } property.Cleanup(); } }
public static CPUElement Create(UnityEditorInternal.ProfilerProperty root) { allCPUEle = new List <CPUElement>(); if (allCPUEle == null) { return(null); } if (root == null) { return(null); } CPUElement rootEle = new CPUElement() { FunctionName = root.propertyName, TotalPercent = root.GetColumn(ProfilerColumn.TotalPercent), SelfPercent = root.GetColumn(ProfilerColumn.SelfPercent), Calls = root.GetColumn(ProfilerColumn.Calls), GCMemory = root.GetColumn(ProfilerColumn.GCMemory), TotalTime = root.GetColumn(ProfilerColumn.TotalTime), SelfTime = root.GetColumn(ProfilerColumn.SelfTime), RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName), Depth = root.depth }; if (allCPUEle != null) { allCPUEle.Add(rootEle); } while (root.Next(root.HasChildren)) { CPUElement ele = new CPUElement() { FunctionName = root.propertyName, TotalPercent = root.GetColumn(ProfilerColumn.TotalPercent), SelfPercent = root.GetColumn(ProfilerColumn.SelfPercent), Calls = root.GetColumn(ProfilerColumn.Calls), GCMemory = root.GetColumn(ProfilerColumn.GCMemory), TotalTime = root.GetColumn(ProfilerColumn.TotalTime), SelfTime = root.GetColumn(ProfilerColumn.SelfTime), RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName), Depth = root.depth }; if (allCPUEle != null) { allCPUEle.Add(ele); } } SetChildren(); return(rootEle); }
public static GPUElement Create(UnityEditorInternal.ProfilerProperty root) { allGPUEle = new List <GPUElement>(); if (allGPUEle == null) { return(null); } if (root == null) { return(null); } GPUElement rootEle = new GPUElement { FuncName = root.propertyName, TotalGPUPercent = root.GetColumn(ProfilerColumn.TotalGPUPercent), SelfGPUPercent = root.GetColumn(ProfilerColumn.SelfGPUPercent), DrawCalls = root.GetColumn(ProfilerColumn.DrawCalls), TotalGPUTime = root.GetColumn(ProfilerColumn.TotalGPUTime), SelfGPUTime = root.GetColumn(ProfilerColumn.SelfGPUTime), RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName), Depth = root.depth }; if (allGPUEle != null) { allGPUEle.Add(rootEle); } while (root.Next(root.HasChildren)) { GPUElement ele = new GPUElement { FuncName = root.propertyName, TotalGPUPercent = root.GetColumn(ProfilerColumn.TotalGPUPercent), DrawCalls = root.GetColumn(ProfilerColumn.DrawCalls), TotalGPUTime = root.GetColumn(ProfilerColumn.TotalGPUTime), RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName), Depth = root.depth }; if (allGPUEle != null) { allGPUEle.Add(ele); } } SetChildren(); return(rootEle); }
private void MoveSelection(int steps) { if (this.IsSearchActive()) { this.m_SearchResults.MoveSelection(steps, this); } else { int num = this.m_SelectedIndex + steps; if (num < 0) { num = 0; } ProfilerProperty profilerProperty = (!this.m_DetailPane) ? this.m_Window.GetRootProfilerProperty(this.m_SortType) : this.GetDetailedProperty(); if (profilerProperty != null) { bool enterChildren = true; int num2 = 0; int instanceId = -1; while (profilerProperty.Next(enterChildren)) { if (this.m_DetailPane && profilerProperty.instanceIDs != null && profilerProperty.instanceIDs.Length > 0 && profilerProperty.instanceIDs[0] != 0) { instanceId = profilerProperty.instanceIDs[0]; } if (num2 == num) { break; } if (profilerProperty.HasChildren) { enterChildren = (!this.m_DetailPane && this.IsExpanded(profilerProperty.propertyPath)); } num2++; } if (this.m_DetailPane) { this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(profilerProperty, instanceId); } else { this.m_Window.SetSelectedPropertyPath(profilerProperty.propertyPath); } } } }
private int DrawTreeView(ProfilerProperty property, int id) { this.m_SelectedIndex = -1; bool enterChildren = true; int rowCount = 0; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; bool selected = !this.m_DetailPane ? propertyPath == selectedPropertyPath : this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property); if (selected) { this.m_SelectedIndex = rowCount; } enterChildren = ((Event.current.type != EventType.Layout ? 1 : 0) & (this.m_ScrollViewHeight == 0 ? 1 : ((double)rowCount * 16.0 > (double)this.m_ScrollViewHeight + (double)this.m_TextScroll.y ? 0 : ((double)(rowCount + 1) * 16.0 > (double)this.m_TextScroll.y ? 1 : 0)))) == 0 ? property.HasChildren && this.IsExpanded(propertyPath) : this.DrawProfileDataItem(property, rowCount, selected, id); ++rowCount; } return(rowCount); }
public ProfilerProperty GetDetailedProperty(ProfilerProperty property) { bool enterChildren = true; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; if (propertyPath == selectedPropertyPath) { ProfilerProperty profilerProperty = new ProfilerProperty(); profilerProperty.InitializeDetailProperty(property); return(profilerProperty); } if (property.HasChildren) { enterChildren = this.IsExpanded(propertyPath); } } return(null); }
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; }
private void UpdateIfNeeded(int frameIndex, ProfilerViewType viewType, string selectedPropertyPath) { if (!this.m_CachedProfilerPropertyConfig.EqualsTo(frameIndex, viewType, ProfilerColumn.DontSort)) { ProfilerProperty rootProperty = this.m_MainProfilerHierarchyGUI.GetRootProperty(); string profilerPropertyName = ProfilerDetailedCallsView.GetProfilerPropertyName(selectedPropertyPath); this.m_TotalSelectedPropertyTime = 0f; Dictionary <string, ProfilerDetailedCallsView.CallInformation> dictionary = new Dictionary <string, ProfilerDetailedCallsView.CallInformation>(); Dictionary <string, ProfilerDetailedCallsView.CallInformation> dictionary2 = new Dictionary <string, ProfilerDetailedCallsView.CallInformation>(); Stack <ProfilerDetailedCallsView.ParentCallInfo> stack = new Stack <ProfilerDetailedCallsView.ParentCallInfo>(); bool flag = false; while (rootProperty.Next(true)) { string propertyName = rootProperty.propertyName; int depth = rootProperty.depth; if (stack.Count + 1 != depth) { while (stack.Count + 1 > depth) { stack.Pop(); } flag = (stack.Count != 0 && profilerPropertyName == stack.Peek().name); } if (stack.Count != 0) { ProfilerDetailedCallsView.ParentCallInfo parentCallInfo = stack.Peek(); if (profilerPropertyName == propertyName) { float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime); int num = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.Calls); int num2 = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.GCMemory); ProfilerDetailedCallsView.CallInformation callInformation; if (!dictionary.TryGetValue(parentCallInfo.name, out callInformation)) { dictionary.Add(parentCallInfo.name, new ProfilerDetailedCallsView.CallInformation { name = parentCallInfo.name, path = parentCallInfo.path, callsCount = num, gcAllocBytes = num2, totalCallTimeMs = (double)parentCallInfo.timeMs, totalSelfTimeMs = (double)columnAsSingle }); } else { callInformation.callsCount += num; callInformation.gcAllocBytes += num2; callInformation.totalCallTimeMs += (double)parentCallInfo.timeMs; callInformation.totalSelfTimeMs += (double)columnAsSingle; } this.m_TotalSelectedPropertyTime += columnAsSingle; } if (flag) { float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime); int num = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.Calls); int num2 = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.GCMemory); ProfilerDetailedCallsView.CallInformation callInformation; if (!dictionary2.TryGetValue(propertyName, out callInformation)) { dictionary2.Add(propertyName, new ProfilerDetailedCallsView.CallInformation { name = propertyName, path = rootProperty.propertyPath, callsCount = num, gcAllocBytes = num2, totalCallTimeMs = (double)columnAsSingle, totalSelfTimeMs = 0.0 }); } else { callInformation.callsCount += num; callInformation.gcAllocBytes += num2; callInformation.totalCallTimeMs += (double)columnAsSingle; } } } else if (profilerPropertyName == propertyName) { float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime); this.m_TotalSelectedPropertyTime += columnAsSingle; } if (rootProperty.HasChildren) { float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime); stack.Push(new ProfilerDetailedCallsView.ParentCallInfo { name = propertyName, path = rootProperty.propertyPath, timeMs = columnAsSingle }); flag = (profilerPropertyName == propertyName); } } this.m_CallersTreeView.SetCallsData(new ProfilerDetailedCallsView.CallsData { calls = dictionary.Values.ToList <ProfilerDetailedCallsView.CallInformation>(), totalSelectedPropertyTime = this.m_TotalSelectedPropertyTime }); this.m_CalleesTreeView.SetCallsData(new ProfilerDetailedCallsView.CallsData { calls = dictionary2.Values.ToList <ProfilerDetailedCallsView.CallInformation>(), totalSelectedPropertyTime = this.m_TotalSelectedPropertyTime }); this.m_TotalSelectedPropertyTimeLabel.text = profilerPropertyName + string.Format(" - Total time: {0:f2} ms", this.m_TotalSelectedPropertyTime); this.m_CachedProfilerPropertyConfig.Set(frameIndex, viewType, ProfilerColumn.TotalTime); } }
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; }
private int DrawTreeView(ProfilerProperty property, int id) { this.m_SelectedIndex = -1; bool enterChildren = true; int num = 0; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; bool flag = (!this.m_DetailPane) ? (propertyPath == selectedPropertyPath) : (this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property)); if (flag) { this.m_SelectedIndex = num; } bool flag2 = Event.current.type != EventType.Layout; flag2 &= (this.m_ScrollViewHeight == 0 || ((float)num * 16f <= (float)this.m_ScrollViewHeight + this.m_TextScroll.y && (float)(num + 1) * 16f > this.m_TextScroll.y)); if (flag2) { enterChildren = this.DrawProfileDataItem(property, num, flag, id); } else { enterChildren = (property.HasChildren && this.IsExpanded(propertyPath)); } num++; } return num; }
public ProfilerProperty GetDetailedProperty(ProfilerProperty property) { bool enterChildren = true; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; if (propertyPath == selectedPropertyPath) { ProfilerProperty profilerProperty = new ProfilerProperty(); profilerProperty.InitializeDetailProperty(property); return profilerProperty; } if (property.HasChildren) { enterChildren = this.IsExpanded(propertyPath); } } return null; }
private int DrawTreeView(ProfilerProperty property, int id) { this.m_SelectedIndex = -1; bool enterChildren = true; int rowCount = 0; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; bool selected = !this.m_DetailPane ? (propertyPath == selectedPropertyPath) : ((this.m_DetailViewSelectedProperty != string.Empty) && (this.m_DetailViewSelectedProperty == DetailViewSelectedPropertyPath(property))); if (selected) { this.m_SelectedIndex = rowCount; } bool flag3 = Event.current.type != EventType.Layout; if (flag3 & ((this.m_ScrollViewHeight == 0) || (((rowCount * 16f) <= (this.m_ScrollViewHeight + this.m_TextScroll.y)) && (((rowCount + 1) * 16f) > this.m_TextScroll.y)))) { enterChildren = this.DrawProfileDataItem(property, rowCount, selected, id); } else { enterChildren = property.HasChildren && this.IsExpanded(propertyPath); } rowCount++; } return rowCount; }
private int DrawTreeView(ProfilerProperty property, int id) { this.m_SelectedIndex = -1; bool enterChildren = true; int rowCount = 0; string selectedPropertyPath = ProfilerDriver.selectedPropertyPath; while (property.Next(enterChildren)) { string propertyPath = property.propertyPath; bool selected = !this.m_DetailPane ? propertyPath == selectedPropertyPath : this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property); if (selected) this.m_SelectedIndex = rowCount; enterChildren = ((Event.current.type != EventType.Layout ? 1 : 0) & (this.m_ScrollViewHeight == 0 ? 1 : ((double) rowCount * 16.0 > (double) this.m_ScrollViewHeight + (double) this.m_TextScroll.y ? 0 : ((double) (rowCount + 1) * 16.0 > (double) this.m_TextScroll.y ? 1 : 0)))) == 0 ? property.HasChildren && this.IsExpanded(propertyPath) : this.DrawProfileDataItem(property, rowCount, selected, id); ++rowCount; } return rowCount; }