public static Color32 GetMarkerCategoryColor(int category) { Color32 result; FrameDataView.GetMarkerCategoryColor_Injected(category, out result); return(result); }
void DrawToolbar(FrameDataView frameDataView, bool showDetailedView) { EditorGUILayout.BeginHorizontal(BaseStyles.toolbar); if (frameDataView != null) { DrawViewTypePopup(frameDataView.viewType); } GUILayout.FlexibleSpace(); if (frameDataView != null) { DrawCPUGPUTime(frameDataView.frameTime, frameDataView.frameGpuTime); } GUILayout.FlexibleSpace(); DrawSearchBar(); if (!showDetailedView) { DrawDetailedViewPopup(); } EditorGUILayout.EndHorizontal(); }
private void UpdateIfNeeded(FrameDataView frameDataView, int selectedId) { if (this.m_SelectedID != selectedId || !object.Equals(this.m_FrameDataView, frameDataView)) { this.m_FrameDataView = frameDataView; this.m_SelectedID = selectedId; this.m_TreeView.SetSelection(new List <int>()); int itemSamplesCount = this.m_FrameDataView.GetItemSamplesCount(selectedId); int num = this.m_MultiColumnHeader.columns.Length; List <ProfilerDetailedObjectsView.ObjectInformation> list = new List <ProfilerDetailedObjectsView.ObjectInformation>(); string[][] array = new string[num][]; int[] itemInstanceIDs = this.m_FrameDataView.GetItemInstanceIDs(selectedId); for (int i = 0; i < num; i++) { array[i] = this.m_FrameDataView.GetItemColumnDatas(selectedId, this.m_MultiColumnHeader.columns[i].profilerColumn); } for (int j = 0; j < itemSamplesCount; j++) { ProfilerDetailedObjectsView.ObjectInformation objectInformation = new ProfilerDetailedObjectsView.ObjectInformation { columnStrings = new string[num] }; objectInformation.id = selectedId; objectInformation.instanceId = ((j >= itemInstanceIDs.Length) ? 0 : itemInstanceIDs[j]); for (int k = 0; k < num; k++) { objectInformation.columnStrings[k] = ((j >= array[k].Length) ? string.Empty : array[k][j]); } list.Add(objectInformation); } this.m_TreeView.SetData(list); } }
public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { DrawEmptyPane(headerStyle); return; } var selectedId = selection[0]; InitIfNeeded(); UpdateIfNeeded(frameDataView, selectedId); GUILayout.Label(m_TotalSelectedPropertyTimeLabel, EditorStyles.label); SplitterGUILayout.BeginVerticalSplit(m_VertSplit, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); // Callees var rect = EditorGUILayout.BeginHorizontal(); m_CalleesTreeView.OnGUI(rect); EditorGUILayout.EndHorizontal(); // Callers rect = EditorGUILayout.BeginHorizontal(); m_CallersTreeView.OnGUI(rect); EditorGUILayout.EndHorizontal(); SplitterGUILayout.EndVerticalSplit(); }
public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { base.DrawEmptyPane(headerStyle); } else { int selectedId = selection[0]; this.InitIfNeeded(); this.UpdateIfNeeded(frameDataView, selectedId); GUILayout.Label(this.m_TotalSelectedPropertyTimeLabel, EditorStyles.label, new GUILayoutOption[0]); SplitterGUILayout.BeginVerticalSplit(this.m_VertSplit, new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); Rect r = EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); this.m_CalleesTreeView.OnGUI(r); EditorGUILayout.EndHorizontal(); r = EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); this.m_CallersTreeView.OnGUI(r); EditorGUILayout.EndHorizontal(); SplitterGUILayout.EndVerticalSplit(); } }
private void DisposeInternal() { if (this.m_Ptr != IntPtr.Zero) { FrameDataView.Internal_Destroy(this.m_Ptr); this.m_Ptr = IntPtr.Zero; } }
static long GetCounterValue(FrameDataView frameData, string name) { var id = frameData.GetMarkerId(name); if (id == FrameDataView.invalidMarkerId) { return(-1); } return(frameData.GetCounterValueAsLong(id)); }
public void DoGUI(FrameDataView frameDataView) { this.InitIfNeeded(); bool flag = frameDataView != null && frameDataView.IsValid(); this.m_TreeView.SetFrameDataView(frameDataView); bool flag2 = flag && this.m_DetailedViewType != ProfilerFrameDataHierarchyView.DetailedViewType.None; if (flag2) { SplitterGUILayout.BeginHorizontalSplit(this.m_DetailedViewSpliterState, new GUILayoutOption[0]); } GUILayout.BeginVertical(new GUILayoutOption[0]); this.DrawToolbar(frameDataView, flag2); if (!flag) { GUILayout.Label(ProfilerFrameDataViewBase.BaseStyles.noData, ProfilerFrameDataViewBase.BaseStyles.label, new GUILayoutOption[0]); } else { Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, new GUILayoutOption[] { GUILayout.ExpandHeight(true), GUILayout.ExpandHeight(true) }); this.m_TreeView.OnGUI(rect); } GUILayout.EndVertical(); if (flag2) { GUILayout.BeginVertical(new GUILayoutOption[0]); EditorGUILayout.BeginHorizontal(ProfilerFrameDataViewBase.BaseStyles.toolbar, new GUILayoutOption[0]); this.DrawDetailedViewPopup(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); ProfilerFrameDataHierarchyView.DetailedViewType detailedViewType = this.m_DetailedViewType; if (detailedViewType != ProfilerFrameDataHierarchyView.DetailedViewType.Objects) { if (detailedViewType == ProfilerFrameDataHierarchyView.DetailedViewType.CallersAndCallees) { this.detailedCallsView.DoGUI(ProfilerFrameDataViewBase.BaseStyles.header, frameDataView, this.m_TreeView.GetSelection()); } } else { this.detailedObjectsView.DoGUI(ProfilerFrameDataViewBase.BaseStyles.header, frameDataView, this.m_TreeView.GetSelection()); } GUILayout.EndVertical(); SplitterGUILayout.EndHorizontalSplit(); } this.HandleKeyboardEvents(); }
public override bool Equals(object obj) { bool result; if (this.m_Ptr == IntPtr.Zero) { result = false; } else { FrameDataView frameDataView = obj as FrameDataView; result = (frameDataView != null && (this.frameIndex.Equals(frameDataView.frameIndex) && this.threadIndex.Equals(frameDataView.threadIndex)) && this.viewType.Equals(frameDataView.viewType)); } return(result); }
public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { DrawEmptyPane(headerStyle); return; } InitIfNeeded(); UpdateIfNeeded(frameDataView, selection[0]); string callstack = null; var selectedSampleId = m_TreeView.GetSelectedFrameDataViewId(); if (selectedSampleId != -1) { callstack = frameDataView.ResolveItemCallstack(selectedSampleId, m_TreeView.state.selectedIDs[0]); } var showCallstack = !string.IsNullOrEmpty(callstack); if (showCallstack) { SplitterGUILayout.BeginVerticalSplit(m_VertSplit, Styles.expandedArea); } // Detailed list var rect = EditorGUILayout.BeginVertical(Styles.expandedArea); m_TreeView.OnGUI(rect); EditorGUILayout.EndVertical(); if (showCallstack) { // Callstack area EditorGUILayout.BeginVertical(Styles.expandedArea); m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(m_CallstackScrollViewPos, Styles.callstackScroll); var text = kCallstackText + '\n' + callstack; EditorGUILayout.TextArea(text, Styles.callstackTextArea); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); } }
void UpdateIfNeeded(FrameDataView frameDataView, int selectedId) { var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView); if (!needReload) { return; } m_FrameDataView = frameDataView; m_SelectedID = selectedId; m_TreeView.SetSelection(new List <int>()); var samplesCount = m_FrameDataView.GetItemSamplesCount(selectedId); var columnsCount = m_MultiColumnHeader.columns.Length; var objectsData = new List <ObjectInformation>(); var objectsDatas = new string[columnsCount][]; // Collect all the data var instanceIDs = m_FrameDataView.GetItemInstanceIDs(selectedId); for (var i = 0; i < columnsCount; i++) { objectsDatas[i] = m_FrameDataView.GetItemColumnDatas(selectedId, m_MultiColumnHeader.columns[i].profilerColumn); } // Store it per sample for (var i = 0; i < samplesCount; i++) { var objData = new ObjectInformation() { columnStrings = new string[columnsCount] }; objData.id = selectedId; objData.instanceId = (i < instanceIDs.Length) ? instanceIDs[i] : 0; for (var j = 0; j < columnsCount; j++) { objData.columnStrings[j] = (i < objectsDatas[j].Length) ? objectsDatas[j][i] : string.Empty; } objectsData.Add(objData); } m_TreeView.SetData(objectsData); }
private void DrawToolbar(FrameDataView frameDataView, bool showDetailedView) { EditorGUILayout.BeginHorizontal(ProfilerFrameDataViewBase.BaseStyles.toolbar, new GUILayoutOption[0]); base.DrawViewTypePopup(frameDataView.viewType); GUILayout.FlexibleSpace(); if (frameDataView != null) { GUILayout.Label(string.Format("CPU:{0}ms GPU:{1}ms", frameDataView.frameTime, frameDataView.frameGpuTime), EditorStyles.miniLabel, new GUILayoutOption[0]); } GUILayout.FlexibleSpace(); this.DrawSearchBar(); if (!showDetailedView) { this.DrawDetailedViewPopup(); } EditorGUILayout.EndHorizontal(); }
void UpdateIfNeeded(FrameDataView frameDataView, int selectedId) { var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView); if (!needReload) { return; } m_FrameDataView = frameDataView; m_SelectedID = selectedId; callersAndCalleeData.UpdateData(m_FrameDataView, m_FrameDataView.GetItemMarkerID(m_SelectedID)); m_CallersTreeView.SetCallsData(callersAndCalleeData.callersData); m_CalleesTreeView.SetCallsData(callersAndCalleeData.calleesData); m_TotalSelectedPropertyTimeLabel.text = m_FrameDataView.GetItemFunctionName(selectedId) + string.Format(" - Total time: {0:f2} ms", callersAndCalleeData.totalSelectedPropertyTime); }
public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection) { if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0) { base.DrawEmptyPane(headerStyle); } else { this.InitIfNeeded(); this.UpdateIfNeeded(frameDataView, selection[0]); string text = null; int selectedFrameDataViewId = this.m_TreeView.GetSelectedFrameDataViewId(); if (selectedFrameDataViewId != -1) { text = frameDataView.ResolveItemCallstack(selectedFrameDataViewId, this.m_TreeView.state.selectedIDs[0]); } bool flag = !string.IsNullOrEmpty(text); if (flag) { SplitterGUILayout.BeginVerticalSplit(this.m_VertSplit, ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]); } Rect rect = EditorGUILayout.BeginVertical(ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]); this.m_TreeView.OnGUI(rect); EditorGUILayout.EndVertical(); if (flag) { EditorGUILayout.BeginVertical(ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]); this.m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(this.m_CallstackScrollViewPos, ProfilerDetailedView.Styles.callstackScroll, new GUILayoutOption[0]); string text2 = ProfilerDetailedObjectsView.kCallstackText + '\n' + text; EditorGUILayout.TextArea(text2, ProfilerDetailedView.Styles.callstackTextArea, new GUILayoutOption[0]); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); SplitterGUILayout.EndVerticalSplit(); } } }
void DrawToolbar(FrameDataView frameDataView, bool showDetailedView) { EditorGUILayout.BeginHorizontal(BaseStyles.toolbar); DrawViewTypePopup(frameDataView.viewType); GUILayout.FlexibleSpace(); if (frameDataView != null) { GUILayout.Label(string.Format("CPU:{0}ms GPU:{1}ms", frameDataView.frameTime, frameDataView.frameGpuTime), EditorStyles.miniLabel); } GUILayout.FlexibleSpace(); DrawSearchBar(); if (!showDetailedView) { DrawDetailedViewPopup(); } EditorGUILayout.EndHorizontal(); }
void UpdateIfNeeded(FrameDataView frameDataView, int selectedId) { var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView); if (!needReload) { return; } m_FrameDataView = frameDataView; m_SelectedID = selectedId; m_TotalSelectedPropertyTime = 0; var selectedMarkerId = m_FrameDataView.GetItemMarkerID(m_SelectedID); var callers = new Dictionary <int, CallInformation>(); var callees = new Dictionary <int, CallInformation>(); var childrenIds = new List <int>(256); var stack = new Stack <int>(); stack.Push(m_FrameDataView.GetRootItemID()); while (stack.Count > 0) { var current = stack.Pop(); if (m_FrameDataView.HasItemChildren(current)) { continue; } var markerId = m_FrameDataView.GetItemMarkerID(current); m_FrameDataView.GetItemChildren(current, childrenIds); foreach (var childId in childrenIds) { var childMarkerId = m_FrameDataView.GetItemMarkerID(childId); if (childMarkerId == selectedMarkerId) { var totalSelfTime = m_FrameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.TotalTime); m_TotalSelectedPropertyTime += totalSelfTime; if (current != 0) { // Add markerId to callers (except root) CallInformation callInfo; var totalTime = m_FrameDataView.GetItemColumnDataAsSingle(current, ProfilerColumn.TotalTime); var calls = (int)m_FrameDataView.GetItemColumnDataAsSingle(current, ProfilerColumn.Calls); var gcAlloc = (int)m_FrameDataView.GetItemColumnDataAsSingle(current, ProfilerColumn.GCMemory); if (!callers.TryGetValue(markerId, out callInfo)) { callers.Add(markerId, new CallInformation() { id = current, name = m_FrameDataView.GetItemFunctionName(current), callsCount = calls, gcAllocBytes = gcAlloc, totalCallTimeMs = totalTime, totalSelfTimeMs = totalSelfTime }); } else { callInfo.callsCount += calls; callInfo.gcAllocBytes += gcAlloc; callInfo.totalCallTimeMs += totalTime; callInfo.totalSelfTimeMs += totalSelfTime; } } } if (markerId == selectedMarkerId) { // Add childMarkerId to callees CallInformation callInfo; var totalTime = m_FrameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.TotalTime); var calls = (int)m_FrameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.Calls); var gcAlloc = (int)m_FrameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.GCMemory); if (!callees.TryGetValue(childMarkerId, out callInfo)) { callees.Add(childMarkerId, new CallInformation() { id = childId, name = m_FrameDataView.GetItemFunctionName(childId), callsCount = calls, gcAllocBytes = gcAlloc, totalCallTimeMs = totalTime, totalSelfTimeMs = 0 }); } else { callInfo.callsCount += calls; callInfo.gcAllocBytes += gcAlloc; callInfo.totalCallTimeMs += totalTime; } } stack.Push(childId); } } m_CallersTreeView.SetCallsData(new CallsData() { calls = callers.Values.ToList(), totalSelectedPropertyTime = m_TotalSelectedPropertyTime }); m_CalleesTreeView.SetCallsData(new CallsData() { calls = callees.Values.ToList(), totalSelectedPropertyTime = m_TotalSelectedPropertyTime }); m_TotalSelectedPropertyTimeLabel.text = m_FrameDataView.GetItemFunctionName(selectedId) + string.Format(" - Total time: {0:f2} ms", m_TotalSelectedPropertyTime); }
public FrameDataView(ProfilerViewType viewType, int frameIndex, int threadIndex, ProfilerColumn profilerSortColumn, bool sortAscending) { this.m_Ptr = FrameDataView.Internal_Create(viewType, frameIndex, threadIndex, profilerSortColumn, sortAscending); }
internal void CompileCallStack(System.Text.StringBuilder sb, List <ulong> m_CachedCallstack, FrameDataView frameDataView) { sb.Append(BaseStyles.callstackText); sb.Append('\n'); var fullCallStack = showFullDetailsForCallStacks; foreach (var addr in m_CachedCallstack) { var methodInfo = frameDataView.ResolveMethodInfo(addr); if (string.IsNullOrEmpty(methodInfo.methodName)) { if (fullCallStack) { sb.AppendFormat("0x{0:X}\n", addr); } } else if (string.IsNullOrEmpty(methodInfo.sourceFileName)) { if (fullCallStack) { sb.AppendFormat("0x{0:X}\t\t{1}\n", addr, methodInfo.methodName); } else { sb.AppendFormat("{0}\n", methodInfo.methodName); } } else { var normalizedPath = methodInfo.sourceFileName.Replace('\\', '/'); if (methodInfo.sourceFileLine == 0) { if (fullCallStack) { sb.AppendFormat("0x{0:X}\t\t{1}\t<a href=\"{2}\" line=\"1\">{2}</a>\n", addr, methodInfo.methodName, normalizedPath); } else { sb.AppendFormat("{0}\t<a href=\"{1}\" line=\"1\">{1}</a>\n", methodInfo.methodName, normalizedPath); } } else { if (fullCallStack) { sb.AppendFormat("0x{0:X}\t\t{1}\t<a href=\"{2}\" line=\"{3}\">{2}:{3}</a>\n", addr, methodInfo.methodName, normalizedPath, methodInfo.sourceFileLine); } else { sb.AppendFormat("{0}\t<a href=\"{1}\" line=\"{2}\">{1}:{2}</a>\n", methodInfo.methodName, normalizedPath, methodInfo.sourceFileLine); } } } } }
public void DoGUI(FrameDataView frameDataView) { InitIfNeeded(); var collectingSamples = ProfilerDriver.enabled && (ProfilerDriver.profileEditor || EditorApplication.isPlaying); var isSearchAllowed = string.IsNullOrEmpty(treeView.searchString) || !(collectingSamples && ProfilerDriver.deepProfiling); var isDataAvailable = frameDataView != null && frameDataView.IsValid(); if (isDataAvailable && isSearchAllowed) { if (isDataAvailable) { m_TreeView.SetFrameDataView(frameDataView); } } var showDetailedView = isDataAvailable && m_DetailedViewType != DetailedViewType.None; if (showDetailedView) { SplitterGUILayout.BeginHorizontalSplit(m_DetailedViewSpliterState); } // Hierarchy view area GUILayout.BeginVertical(); DrawToolbar(frameDataView, showDetailedView); if (!isDataAvailable) { GUILayout.Label(BaseStyles.noData, BaseStyles.label); } else if (!isSearchAllowed) { GUILayout.Label(BaseStyles.disabledSearchText, BaseStyles.label); } else { var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandHeight(true)); m_TreeView.OnGUI(rect); } GUILayout.EndVertical(); if (showDetailedView) { GUILayout.BeginVertical(); // Detailed view area EditorGUILayout.BeginHorizontal(BaseStyles.toolbar); DrawDetailedViewPopup(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); switch (m_DetailedViewType) { case DetailedViewType.Objects: detailedObjectsView.DoGUI(BaseStyles.header, frameDataView, m_TreeView.GetSelection()); break; case DetailedViewType.CallersAndCallees: detailedCallsView.DoGUI(BaseStyles.header, frameDataView, m_TreeView.GetSelection()); break; } GUILayout.EndVertical(); SplitterGUILayout.EndHorizontalSplit(); } HandleKeyboardEvents(); }
public void DoGUI(FrameDataView frameDataView) { InitIfNeeded(); var isDataAvailable = frameDataView != null && frameDataView.IsValid(); m_TreeView.SetFrameDataView(frameDataView); var showDetailedView = isDataAvailable && m_DetailedViewType != DetailedViewType.None; if (showDetailedView) { SplitterGUILayout.BeginHorizontalSplit(m_DetailedViewSpliterState); } // Hierarchy view area GUILayout.BeginVertical(); DrawToolbar(frameDataView, showDetailedView); if (!isDataAvailable) { GUILayout.Label(BaseStyles.noData, BaseStyles.label); } else { var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandHeight(true)); m_TreeView.OnGUI(rect); } GUILayout.EndVertical(); if (showDetailedView) { GUILayout.BeginVertical(); // Detailed view area EditorGUILayout.BeginHorizontal(BaseStyles.toolbar); DrawDetailedViewPopup(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); switch (m_DetailedViewType) { case DetailedViewType.Objects: detailedObjectsView.DoGUI(BaseStyles.header, frameDataView, m_TreeView.GetSelection()); break; case DetailedViewType.CallersAndCallees: detailedCallsView.DoGUI(BaseStyles.header, frameDataView, m_TreeView.GetSelection()); break; } GUILayout.EndVertical(); SplitterGUILayout.EndHorizontalSplit(); } HandleKeyboardEvents(); }
private void UpdateIfNeeded(FrameDataView frameDataView, int selectedId) { if (this.m_SelectedID != selectedId || !object.Equals(this.m_FrameDataView, frameDataView)) { this.m_FrameDataView = frameDataView; this.m_SelectedID = selectedId; this.m_TotalSelectedPropertyTime = 0f; int itemMarkerID = this.m_FrameDataView.GetItemMarkerID(this.m_SelectedID); Dictionary <int, ProfilerDetailedCallsView.CallInformation> dictionary = new Dictionary <int, ProfilerDetailedCallsView.CallInformation>(); Dictionary <int, ProfilerDetailedCallsView.CallInformation> dictionary2 = new Dictionary <int, ProfilerDetailedCallsView.CallInformation>(); Stack <int> stack = new Stack <int>(); stack.Push(this.m_FrameDataView.GetRootItemID()); while (stack.Count > 0) { int num = stack.Pop(); if (this.m_FrameDataView.HasItemChildren(num)) { int itemMarkerID2 = this.m_FrameDataView.GetItemMarkerID(num); int[] itemChildren = this.m_FrameDataView.GetItemChildren(num); int[] array = itemChildren; for (int i = 0; i < array.Length; i++) { int num2 = array[i]; int itemMarkerID3 = this.m_FrameDataView.GetItemMarkerID(num2); if (itemMarkerID3 == itemMarkerID) { float itemColumnDataAsSingle = this.m_FrameDataView.GetItemColumnDataAsSingle(num2, ProfilerColumn.TotalTime); this.m_TotalSelectedPropertyTime += itemColumnDataAsSingle; if (num != 0) { float itemColumnDataAsSingle2 = this.m_FrameDataView.GetItemColumnDataAsSingle(num, ProfilerColumn.TotalTime); int num3 = (int)this.m_FrameDataView.GetItemColumnDataAsSingle(num, ProfilerColumn.Calls); int num4 = (int)this.m_FrameDataView.GetItemColumnDataAsSingle(num, ProfilerColumn.GCMemory); ProfilerDetailedCallsView.CallInformation callInformation; if (!dictionary.TryGetValue(itemMarkerID2, out callInformation)) { dictionary.Add(itemMarkerID2, new ProfilerDetailedCallsView.CallInformation { id = num, name = this.m_FrameDataView.GetItemFunctionName(num), callsCount = num3, gcAllocBytes = num4, totalCallTimeMs = (double)itemColumnDataAsSingle2, totalSelfTimeMs = (double)itemColumnDataAsSingle }); } else { callInformation.callsCount += num3; callInformation.gcAllocBytes += num4; callInformation.totalCallTimeMs += (double)itemColumnDataAsSingle2; callInformation.totalSelfTimeMs += (double)itemColumnDataAsSingle; } } } if (itemMarkerID2 == itemMarkerID) { float itemColumnDataAsSingle3 = this.m_FrameDataView.GetItemColumnDataAsSingle(num2, ProfilerColumn.TotalTime); int num5 = (int)this.m_FrameDataView.GetItemColumnDataAsSingle(num2, ProfilerColumn.Calls); int num6 = (int)this.m_FrameDataView.GetItemColumnDataAsSingle(num2, ProfilerColumn.GCMemory); ProfilerDetailedCallsView.CallInformation callInformation2; if (!dictionary2.TryGetValue(itemMarkerID3, out callInformation2)) { dictionary2.Add(itemMarkerID3, new ProfilerDetailedCallsView.CallInformation { id = num2, name = this.m_FrameDataView.GetItemFunctionName(num2), callsCount = num5, gcAllocBytes = num6, totalCallTimeMs = (double)itemColumnDataAsSingle3, totalSelfTimeMs = 0.0 }); } else { callInformation2.callsCount += num5; callInformation2.gcAllocBytes += num6; callInformation2.totalCallTimeMs += (double)itemColumnDataAsSingle3; } } stack.Push(num2); } } } 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 = this.m_FrameDataView.GetItemFunctionName(selectedId) + string.Format(" - Total time: {0:f2} ms", this.m_TotalSelectedPropertyTime); } }
internal float UpdateData(FrameDataView frameDataView, int selectedMarkerId) { totalSelectedPropertyTime = 0; m_Callers.Clear(); m_Callees.Clear(); m_ChildrenIds.Clear(); m_Stack.Clear(); m_Stack.Push(frameDataView.GetRootItemID()); while (m_Stack.Count > 0) { var current = m_Stack.Pop(); if (!frameDataView.HasItemChildren(current)) { continue; } var markerId = frameDataView.GetItemMarkerID(current); frameDataView.GetItemChildren(current, m_ChildrenIds); foreach (var childId in m_ChildrenIds) { var childMarkerId = frameDataView.GetItemMarkerID(childId); if (childMarkerId == selectedMarkerId) { var totalSelfTime = frameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.TotalTime); totalSelectedPropertyTime += totalSelfTime; if (current != 0) { // Add markerId to callers (except root) CallInformation callInfo; var totalTime = frameDataView.GetItemColumnDataAsSingle(current, ProfilerColumn.TotalTime); var calls = (int)frameDataView.GetItemColumnDataAsSingle(current, ProfilerColumn.Calls); var gcAlloc = (int)frameDataView.GetItemColumnDataAsSingle(current, ProfilerColumn.GCMemory); if (!m_Callers.TryGetValue(markerId, out callInfo)) { m_Callers.Add(markerId, new CallInformation() { id = current, name = frameDataView.GetItemFunctionName(current), callsCount = calls, gcAllocBytes = gcAlloc, totalCallTimeMs = totalTime, totalSelfTimeMs = totalSelfTime }); } else { callInfo.callsCount += calls; callInfo.gcAllocBytes += gcAlloc; callInfo.totalCallTimeMs += totalTime; callInfo.totalSelfTimeMs += totalSelfTime; } } } if (markerId == selectedMarkerId) { // Add childMarkerId to callees CallInformation callInfo; var totalTime = frameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.TotalTime); var calls = (int)frameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.Calls); var gcAlloc = (int)frameDataView.GetItemColumnDataAsSingle(childId, ProfilerColumn.GCMemory); if (!m_Callees.TryGetValue(childMarkerId, out callInfo)) { m_Callees.Add(childMarkerId, new CallInformation() { id = childId, name = frameDataView.GetItemFunctionName(childId), callsCount = calls, gcAllocBytes = gcAlloc, totalCallTimeMs = totalTime, totalSelfTimeMs = 0 }); } else { callInfo.callsCount += calls; callInfo.gcAllocBytes += gcAlloc; callInfo.totalCallTimeMs += totalTime; } } m_Stack.Push(childId); } } UpdateCallsData(ref m_CallersData, m_Callers, totalSelectedPropertyTime); UpdateCallsData(ref m_CalleesData, m_Callees, totalSelectedPropertyTime); return(totalSelectedPropertyTime); }