private static List <MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter)
        {
            List <MemoryElement> list          = new List <MemoryElement>();
            MemoryElement        memoryElement = null;

            for (int i = 0; i < memory.Length; i++)
            {
                ObjectInfo objectInfo = memory[i];
                if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter)
                {
                    if (memoryElement == null || objectInfo.className != memoryElement.name)
                    {
                        memoryElement = new MemoryElement(objectInfo.className);
                        list.Add(memoryElement);
                    }
                    memoryElement.AddChild(new MemoryElement(objectInfo, true));
                }
            }
            list.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
            foreach (MemoryElement current in list)
            {
                current.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
                if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children))
                {
                    current.children.Clear();
                }
            }
            return(list);
        }
 private static List<MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter)
 {
   List<MemoryElement> memoryElementList = new List<MemoryElement>();
   MemoryElement memoryElement = (MemoryElement) null;
   foreach (ObjectInfo objectInfo in memory)
   {
     if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter)
     {
       if (memoryElement == null || objectInfo.className != memoryElement.name)
       {
         memoryElement = new MemoryElement(objectInfo.className);
         memoryElementList.Add(memoryElement);
       }
       memoryElement.AddChild(new MemoryElement(objectInfo, true));
     }
   }
   memoryElementList.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize));
   using (List<MemoryElement>.Enumerator enumerator = memoryElementList.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       MemoryElement current = enumerator.Current;
       current.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize));
       if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children))
         current.children.Clear();
     }
   }
   return memoryElementList;
 }
Example #3
0
        private static List <MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter)
        {
            List <MemoryElement> memoryElementList = new List <MemoryElement>();
            MemoryElement        memoryElement     = (MemoryElement)null;

            foreach (ObjectInfo objectInfo in memory)
            {
                if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter)
                {
                    if (memoryElement == null || objectInfo.className != memoryElement.name)
                    {
                        memoryElement = new MemoryElement(objectInfo.className);
                        memoryElementList.Add(memoryElement);
                    }
                    memoryElement.AddChild(new MemoryElement(objectInfo, true));
                }
            }
            memoryElementList.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
            using (List <MemoryElement> .Enumerator enumerator = memoryElementList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    MemoryElement current = enumerator.Current;
                    current.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
                    if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children))
                    {
                        current.children.Clear();
                    }
                }
            }
            return(memoryElementList);
        }
		private static List<MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter)
		{
			List<MemoryElement> list = new List<MemoryElement>();
			MemoryElement memoryElement = null;
			for (int i = 0; i < memory.Length; i++)
			{
				ObjectInfo objectInfo = memory[i];
				if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter)
				{
					if (memoryElement == null || objectInfo.className != memoryElement.name)
					{
						memoryElement = new MemoryElement(objectInfo.className);
						list.Add(memoryElement);
					}
					memoryElement.AddChild(new MemoryElement(objectInfo, true));
				}
			}
			list.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize));
			foreach (MemoryElement current in list)
			{
				current.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize));
				if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children))
				{
					current.children.Clear();
				}
			}
			return list;
		}
Example #5
0
 private static void SetMemoryProfilerInfo(ObjectMemoryInfo[] memoryInfo, int[] referencedIndices)
 {
     foreach (ProfilerWindow current in ProfilerWindow.m_ProfilerWindows)
     {
         if (current.wantsMemoryRefresh)
         {
             current.m_MemoryListView.SetRoot(MemoryElementDataManager.GetTreeRoot(memoryInfo, referencedIndices));
         }
     }
 }
Example #6
0
        public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices)
        {
            ObjectInfo[] array = new ObjectInfo[memoryObjectList.Length];
            for (int i = 0; i < memoryObjectList.Length; i++)
            {
                array[i] = new ObjectInfo
                {
                    instanceId = memoryObjectList[i].instanceId,
                    memorySize = memoryObjectList[i].memorySize,
                    reason     = memoryObjectList[i].reason,
                    name       = memoryObjectList[i].name,
                    className  = memoryObjectList[i].className
                };
            }
            int num = 0;

            for (int j = 0; j < memoryObjectList.Length; j++)
            {
                for (int k = 0; k < memoryObjectList[j].count; k++)
                {
                    int num2 = referencesIndices[k + num];
                    if (array[num2].referencedBy == null)
                    {
                        array[num2].referencedBy = new List <ObjectInfo>();
                    }
                    array[num2].referencedBy.Add(array[j]);
                }
                num += memoryObjectList[j].count;
            }
            MemoryElement memoryElement = new MemoryElement();

            ObjectInfo[] arg_113_0 = array;
            if (MemoryElementDataManager.< > f__mg$cache2 == null)
            {
                MemoryElementDataManager.< > f__mg$cache2 = new Comparison <ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName);
            }
            Array.Sort <ObjectInfo>(arg_113_0, MemoryElementDataManager.< > f__mg$cache2);
            memoryElement.AddChild(new MemoryElement("Scene Memory", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.Scene)));
            memoryElement.AddChild(new MemoryElement("Assets", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.Asset)));
            memoryElement.AddChild(new MemoryElement("Builtin Resources", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.BuiltinResource)));
            memoryElement.AddChild(new MemoryElement("Not Saved", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.DontSave)));
            memoryElement.AddChild(new MemoryElement("Other", MemoryElementDataManager.GenerateObjectTypeGroups(array, MemoryElementDataManager.ObjectTypeFilter.Other)));
            List <MemoryElement> arg_1B4_0 = memoryElement.children;

            if (MemoryElementDataManager.< > f__mg$cache3 == null)
            {
                MemoryElementDataManager.< > f__mg$cache3 = new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize);
            }
            arg_1B4_0.Sort(MemoryElementDataManager.< > f__mg$cache3);
            return(memoryElement);
        }
Example #7
0
        public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices)
        {
            ObjectInfo[] objectInfoArray = new ObjectInfo[memoryObjectList.Length];
            for (int index = 0; index < memoryObjectList.Length; ++index)
            {
                objectInfoArray[index] = new ObjectInfo()
                {
                    instanceId = memoryObjectList[index].instanceId,
                    memorySize = memoryObjectList[index].memorySize,
                    reason     = memoryObjectList[index].reason,
                    name       = memoryObjectList[index].name,
                    className  = memoryObjectList[index].className
                }
            }
            ;
            int num = 0;

            for (int index1 = 0; index1 < memoryObjectList.Length; ++index1)
            {
                for (int index2 = 0; index2 < memoryObjectList[index1].count; ++index2)
                {
                    int referencesIndex = referencesIndices[index2 + num];
                    if (objectInfoArray[referencesIndex].referencedBy == null)
                    {
                        objectInfoArray[referencesIndex].referencedBy = new List <ObjectInfo>();
                    }
                    objectInfoArray[referencesIndex].referencedBy.Add(objectInfoArray[index1]);
                }
                num += memoryObjectList[index1].count;
            }
            MemoryElement memoryElement = new MemoryElement();

            Array.Sort <ObjectInfo>(objectInfoArray, new Comparison <ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName));
            memoryElement.AddChild(new MemoryElement("Scene Memory", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.Scene)));
            memoryElement.AddChild(new MemoryElement("Assets", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.Asset)));
            memoryElement.AddChild(new MemoryElement("Builtin Resources", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.BuiltinResource)));
            memoryElement.AddChild(new MemoryElement("Not Saved", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.DontSave)));
            memoryElement.AddChild(new MemoryElement("Other", MemoryElementDataManager.GenerateObjectTypeGroups(objectInfoArray, MemoryElementDataManager.ObjectTypeFilter.Other)));
            memoryElement.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
            return(memoryElement);
        }