示例#1
0
 /// <summary>
 /// The constructor for the serializable profiling run.
 /// </summary>
 /// <param name="run">A non-serializable profiling run to copy.</param>
 public SerializeableMemoryProfilingRunData(MemoryProfilingRun run)
 {
     name                    = run.Name;
     startFrame              = run.StartFrame;
     frameCount              = run.FrameCount;
     garbageGeneratedBytes   = run.TotalGarbageGeneratedBytes;
     gcCollectCount          = run.GarbageCollectionCount;
     memoryUsedPerFrameBytes = run.GetPerFrameMemoryUsage();
 }
示例#2
0
        /// <summary>
        /// Initializes this instance of the garbage profiler GameObject.
        /// </summary>
        /// <param name="unityApiWrapper">An instance of the unityApiWrapper to access memory usage.</param>
        public void Initialize(IUnityApiWrapper unityApiWrapper)
        {
            m_unityApiWrapper     = unityApiWrapper;
            m_memoryPool          = new MemoryPoolOfArraySegments <uint>(ARRAY_SEGMENT_COUNT, ARRAY_SEGMENT_LENGTH);
            m_memoryProfilingRuns = new MemoryProfilingRun[MAX_NUMBER_OF_SCENES_PROFILED];

            for (int i = 0; i < MAX_NUMBER_OF_SCENES_PROFILED; i++)
            {
                m_memoryProfilingRuns[i] = new MemoryProfilingRun();
            }

            unityApiWrapper.DontDestroyOnLoad(this);
        }