// Token: 0x06007FFE RID: 32766 public int CompareTo(ref MemoryProfiler.ObjMemDef other) { if (this._Size != other._Size) { return(this._Size - other._Size); } if (this._IsADependency != other._IsADependency) { return((this._IsADependency ? 1 : 0) - (other._IsADependency ? 1 : 0)); } int num = string.Compare(this._Name, other._Name); if (num != 0) { return(num); } return(string.Compare(this._ObjType, other._ObjType)); }
// Token: 0x06007FF7 RID: 32759 private bool RemoveLastSnapShotElement(ref Dictionary <string, List <MemoryProfiler.ObjMemDef> > LastSnapshot, MemoryProfiler.ObjMemDef ObjDef) { List <MemoryProfiler.ObjMemDef> list = null; if (!LastSnapshot.TryGetValue(ObjDef._Name, out list)) { return(false); } int num = list.FindIndex((MemoryProfiler.ObjMemDef p) => ObjDef._ObjType == p._ObjType); if (num < 0) { return(false); } list.RemoveAt(num); return(true); }
// Token: 0x06007FEE RID: 32750 private void RenderGUI_List(List <MemoryProfiler.ObjMemDef> mListDef) { this.mScrollViewPos_Stats = GUILayout.BeginScrollView(this.mScrollViewPos_Stats, new GUILayoutOption[] { GUILayout.ExpandHeight(true) }); float lineHeight = GUI.skin.button.lineHeight + (float)GUI.skin.button.margin.top + (float)GUI.skin.button.padding.top + (float)GUI.skin.button.padding.bottom; int viewportStartLine = (int)(this.mScrollViewPos_Stats.y / lineHeight); int viewportEndLine = viewportStartLine + (int)((float)Screen.height / lineHeight); int extraSpacingLines = 0; int renderedLines = 0; TextAnchor alignment = GUI.skin.label.alignment; GUI.skin.label.alignment = TextAnchor.MiddleRight; int count = mListDef.Count; bool doReflect = false; string filterText = ""; string[] reflectPath = null; if (!string.IsNullOrEmpty(this.mFilter_Text)) { doReflect = this.mFilter_Text.EndsWith("@reflect"); if (doReflect) { reflectPath = this.mFilter_Text.Replace("@reflect", "").ToLowerInvariant().Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); } else { filterText = this.mFilter_Text.ToLowerInvariant(); } } for (int i = 0; i < count; i++) { MemoryProfiler.ObjMemDef objMemDef = mListDef[i]; if (doReflect) { if (objMemDef._Name.ToLowerInvariant().Equals(reflectPath[0]) || objMemDef._ObjType.ToLowerInvariant().Equals(reflectPath[0])) { this.RenderContentInfoRecursive(objMemDef.GetContentInfo(), 0, 20f, ref renderedLines, viewportStartLine, viewportEndLine, ref extraSpacingLines, lineHeight, reflectPath); } } else if ((this.mFilter_ShowDependencies || !objMemDef._IsADependency) && (filterText.Equals("") || objMemDef._Name.ToLowerInvariant().Contains(filterText) || objMemDef._ObjType.ToLowerInvariant().Contains(filterText))) { if (renderedLines > 0 && (renderedLines < viewportStartLine || renderedLines > viewportEndLine)) { extraSpacingLines++; } else { if (extraSpacingLines > 0) { GUILayout.Space((float)extraSpacingLines * lineHeight); extraSpacingLines = 0; } GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Label((objMemDef._Size < 1048576) ? ((objMemDef._Size / 1024).ToString() + " Kb") : ((objMemDef._Size / 1048576).ToString("0.00") + " Mb"), new GUILayoutOption[] { GUILayout.Width(80f) }); if (GUILayout.Button("reflect on type", new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { this.mFilter_Text = objMemDef._ObjType + "@reflect"; } if (GUILayout.Button("reflect on name", new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { this.mFilter_Text = objMemDef._Name + "@reflect"; } if (GUILayout.Button(objMemDef._ObjType, new GUILayoutOption[] { GUILayout.Width(200f) })) { this.mFilter_Text = objMemDef._ObjType; } if (GUILayout.Button(objMemDef._Name, Array.Empty <GUILayoutOption>())) { this.mFilter_Text = objMemDef._Name; } GUILayout.EndHorizontal(); } renderedLines++; } } GUI.skin.label.alignment = alignment; if (extraSpacingLines > 0) { GUILayout.Space((float)extraSpacingLines * lineHeight); } GUILayout.EndScrollView(); }
// Token: 0x06007FF6 RID: 32758 private void AddLastSnapShotElement(ref Dictionary <string, List <MemoryProfiler.ObjMemDef> > LastSnapshot, MemoryProfiler.ObjMemDef ObjDef) { List <MemoryProfiler.ObjMemDef> list = null; if (!LastSnapshot.TryGetValue(ObjDef._Name, out list)) { list = new List <MemoryProfiler.ObjMemDef>(); LastSnapshot[ObjDef._Name] = list; } list.Add(ObjDef); }
// Token: 0x06000872 RID: 2162 public void TakeLightSnapShot() { Dictionary <string, List <MemoryProfiler.ObjMemDef> > dictionary = new Dictionary <string, List <MemoryProfiler.ObjMemDef> >(); int i = 0; int count = this.mList_LastSnapshot.Count; while (i < count) { this.AddLastSnapShotElement(ref dictionary, this.mList_LastSnapshot[i]); i++; } this.mList_Differences.Clear(); this.mList_Snapshot.Clear(); int num = 0; this.mStats_Current.Clear(); this.mStats_Dif.Clear(); UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(UnityEngine.Object)); int j = 0; int num2 = array.Length; while (j < num2) { UnityEngine.Object @object = array[j]; int num3 = (int)Profiler.GetRuntimeMemorySizeLong(@object); num += num3; string text = @object.GetType().ToString(); if (text.StartsWith("UnityEngine.")) { text = text.Substring(12); } int num4 = 0; this.mStats_Current.TryGetValue(text, out num4); this.mStats_Current[text] = num4 + num3; MemoryProfiler.ObjMemDef objMemDef = new MemoryProfiler.ObjMemDef(num3, text, @object.name, this.HasADependantInTheList(@object, ref array), @object); this.mList_Snapshot.Add(objMemDef); if (!this.RemoveLastSnapShotElement(ref dictionary, objMemDef)) { this.mList_Differences.Add(objMemDef); num4 = 0; this.mStats_Dif.TryGetValue(text, out num4); this.mStats_Dif[text] = num4 + num3; } j++; } this.mStats_Dif1.Clear(); this.mStats_Current1.Clear(); foreach (KeyValuePair <string, int> item in this.mStats_Dif) { this.mStats_Dif1.Add(item); } this.mStats_Dif1.Sort((KeyValuePair <string, int> v1, KeyValuePair <string, int> v2) => v2.Value - v1.Value); foreach (KeyValuePair <string, int> item2 in this.mStats_Current) { this.mStats_Current1.Add(item2); } this.mStats_Current1.Sort((KeyValuePair <string, int> v1, KeyValuePair <string, int> v2) => v2.Value - v1.Value); this.mStats_Dif.Clear(); this.mStats_Current.Clear(); this.mList_Snapshot.Sort((MemoryProfiler.ObjMemDef p1, MemoryProfiler.ObjMemDef p2) => p2.CompareTo(ref p1)); this.mList_Differences.Sort((MemoryProfiler.ObjMemDef p1, MemoryProfiler.ObjMemDef p2) => p2.CompareTo(ref p1)); }