AddChild() public method

public AddChild ( MemoryElement node ) : void
node MemoryElement
return void
        public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices)
        {
            UnityEditor.ObjectInfo[] array = new UnityEditor.ObjectInfo[memoryObjectList.Length];
            for (int i = 0; i < memoryObjectList.Length; i++)
            {
                array[i] = new UnityEditor.ObjectInfo {
                    instanceId = memoryObjectList[i].instanceId, memorySize = memoryObjectList[i].memorySize, reason = memoryObjectList[i].reason, name = memoryObjectList[i].name, className = memoryObjectList[i].className
                };
            }
            int num2 = 0;

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

            Array.Sort <UnityEditor.ObjectInfo>(array, new Comparison <UnityEditor.ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName));
            element.AddChild(new MemoryElement("Scene Memory", GenerateObjectTypeGroups(array, ObjectTypeFilter.Scene)));
            element.AddChild(new MemoryElement("Assets", GenerateObjectTypeGroups(array, ObjectTypeFilter.Asset)));
            element.AddChild(new MemoryElement("Builtin Resources", GenerateObjectTypeGroups(array, ObjectTypeFilter.BuiltinResource)));
            element.AddChild(new MemoryElement("Not Saved", GenerateObjectTypeGroups(array, ObjectTypeFilter.DontSave)));
            element.AddChild(new MemoryElement("Other", GenerateObjectTypeGroups(array, ObjectTypeFilter.Other)));
            element.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
            return(element);
        }
 public static MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices)
 {
     UnityEditor.ObjectInfo[] array = new UnityEditor.ObjectInfo[memoryObjectList.Length];
     for (int i = 0; i < memoryObjectList.Length; i++)
     {
         array[i] = new UnityEditor.ObjectInfo { instanceId = memoryObjectList[i].instanceId, memorySize = memoryObjectList[i].memorySize, reason = memoryObjectList[i].reason, name = memoryObjectList[i].name, className = memoryObjectList[i].className };
     }
     int num2 = 0;
     for (int j = 0; j < memoryObjectList.Length; j++)
     {
         for (int k = 0; k < memoryObjectList[j].count; k++)
         {
             int index = referencesIndices[k + num2];
             if (array[index].referencedBy == null)
             {
                 array[index].referencedBy = new List<UnityEditor.ObjectInfo>();
             }
             array[index].referencedBy.Add(array[j]);
         }
         num2 += memoryObjectList[j].count;
     }
     MemoryElement element = new MemoryElement();
     Array.Sort<UnityEditor.ObjectInfo>(array, new Comparison<UnityEditor.ObjectInfo>(MemoryElementDataManager.SortByMemoryClassName));
     element.AddChild(new MemoryElement("Scene Memory", GenerateObjectTypeGroups(array, ObjectTypeFilter.Scene)));
     element.AddChild(new MemoryElement("Assets", GenerateObjectTypeGroups(array, ObjectTypeFilter.Asset)));
     element.AddChild(new MemoryElement("Builtin Resources", GenerateObjectTypeGroups(array, ObjectTypeFilter.BuiltinResource)));
     element.AddChild(new MemoryElement("Not Saved", GenerateObjectTypeGroups(array, ObjectTypeFilter.DontSave)));
     element.AddChild(new MemoryElement("Other", GenerateObjectTypeGroups(array, ObjectTypeFilter.Other)));
     element.children.Sort(new Comparison<MemoryElement>(MemoryElementDataManager.SortByMemorySize));
     return element;
 }
示例#3
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);
        }
        static public MemoryElement GetTreeRoot(ObjectMemoryInfo[] memoryObjectList, int[] referencesIndices)
        {
            // run through all objects and do conversion from references to referenced_by
            ObjectInfo[] allObjectInfo = new ObjectInfo[memoryObjectList.Length];

            for (int i = 0; i < memoryObjectList.Length; i++)
            {
                ObjectInfo info = new ObjectInfo();
                info.instanceId  = memoryObjectList[i].instanceId;
                info.memorySize  = memoryObjectList[i].memorySize;
                info.reason      = memoryObjectList[i].reason;
                info.name        = memoryObjectList[i].name;
                info.className   = memoryObjectList[i].className;
                allObjectInfo[i] = info;
            }
            int offset = 0;

            for (int i = 0; i < memoryObjectList.Length; i++)
            {
                for (int j = 0; j < memoryObjectList[i].count; j++)
                {
                    int referencedObjectIndex = referencesIndices[j + offset];
                    if (allObjectInfo[referencedObjectIndex].referencedBy == null)
                    {
                        allObjectInfo[referencedObjectIndex].referencedBy = new List <ObjectInfo>();
                    }
                    allObjectInfo[referencedObjectIndex].referencedBy.Add(allObjectInfo[i]);
                }
                offset += memoryObjectList[i].count;
            }

            MemoryElement root = new MemoryElement();

            System.Array.Sort(allObjectInfo, SortByMemoryClassName);
            root.AddChild(new MemoryElement("Scene Memory", GenerateObjectTypeGroups(allObjectInfo, ObjectTypeFilter.Scene)));
            root.AddChild(new MemoryElement("Assets", GenerateObjectTypeGroups(allObjectInfo, ObjectTypeFilter.Asset)));
            root.AddChild(new MemoryElement("Builtin Resources", GenerateObjectTypeGroups(allObjectInfo, ObjectTypeFilter.BuiltinResource)));
            root.AddChild(new MemoryElement("Not Saved", GenerateObjectTypeGroups(allObjectInfo, ObjectTypeFilter.DontSave)));
            root.AddChild(new MemoryElement("Other", GenerateObjectTypeGroups(allObjectInfo, ObjectTypeFilter.Other)));
            root.children.Sort(SortByMemorySize);

            return(root);
        }
示例#5
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);
        }
 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;
 }