少年修仙传客户端基础资源
client_Wu Xijin
2019-02-13 d00aa1407d1cb0bc6098d0b114780d468af79d43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System;
using UnityEditor.MemoryProfiler;
using UnityEngine;
 
namespace MemoryProfilerWindow
{
    using System.Linq;
 
    //this is the highest level dataformat. it can be unpacked from the PackedCrawledMemorySnapshot, which contains all the interesting information we want. The Packed format
    //however is designed to be serializable and relatively storage compact.  This dataformat is designed to give a nice c# api experience. so while the packed version uses typeIndex,
    //this version has TypeReferences,  and also uses references to ThingInObject, instead of the more obscure object indexing pattern that the packed format uses.
    public class CrawledMemorySnapshot
    {
        public NativeUnityEngineObject[] nativeObjects;
        public GCHandle[] gcHandles;
        public ManagedObject[] managedObjects;
        public StaticFields[] staticFields;
 
        //contains concatenation of nativeObjects, gchandles, managedobjects and staticfields
        public ThingInMemory[] allObjects { get; private set; }
        public long totalSize { get; private set; }
 
        public MemorySection[] managedHeap;
        public TypeDescription[] typeDescriptions;
        public PackedNativeType[] nativeTypes;
        public VirtualMachineInformation virtualMachineInformation;
 
        public void FinishSnapshot()
        {
            allObjects = new ThingInMemory[0].Concat(gcHandles).Concat(nativeObjects).Concat(staticFields).Concat(managedObjects).ToArray();
            totalSize = allObjects != null ? allObjects.Sum(o => o.size) : 0;
        }
    }
 
    public class ThingInMemory
    {
        public long size;
        public string caption;
        public ThingInMemory[] references;
        public ThingInMemory[] referencedBy;
    }
 
    public class ManagedObject : ThingInMemory
    {
        public UInt64 address;
        public TypeDescription typeDescription;
    }
 
    public class NativeUnityEngineObject : ThingInMemory
    {
        public int instanceID;
        public int classID;
        public string className;
        public string name;
        public bool isPersistent;
        public bool isDontDestroyOnLoad;
        public bool isManager;
        public HideFlags hideFlags;
    }
 
    public class GCHandle : ThingInMemory
    {
    }
 
    public class StaticFields : ThingInMemory
    {
        public TypeDescription typeDescription;
        public byte[] storage;
    }
}