Пример #1
0
 /// <summary>
 /// Initializes an instance of a memory profiling run.
 /// </summary>
 /// <param name="unityApiWrapper">An instance of unityApiWrapper to make unity calls.</param>
 /// <param name="arrayMemoryPool">A pool of memory to allocate arrays from.</param>
 /// <param name="name">The name of the run.</param>
 public void Initialize(IUnityApiWrapper unityApiWrapper, MemoryPoolOfArraySegments <uint> arrayMemoryPool,
                        string name)
 {
     m_unityApiWrapper = unityApiWrapper;
     Name       = name;
     StartFrame = m_unityApiWrapper.GetFrameCount();
     FrameCount = 0;
     TotalGarbageGeneratedBytes = 0;
     GarbageCollectionCount     = 0;
     m_memoryUsedPerFrame.SetMemoryPool(arrayMemoryPool);
     m_memoryUsedLastFrame = 0;
 }
Пример #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);
        }
Пример #3
0
 /// <summary>
 /// Sets the memory pool used to allocate elements for the container.
 /// </summary>
 /// <param name="memoryPool">The memory pool to set.</param>
 public void SetMemoryPool(MemoryPoolOfArraySegments <T> memoryPool)
 {
     m_arrayMemoryPool = memoryPool;
 }