Esempio n. 1
0
        private void GrowMemory()
        {
            MemoryElement[] tempArray = new MemoryElement[elements.Length];
            elements.CopyTo(tempArray, 0);

            int newSize = elements.Length + ELEMENT_BLOCK_SIZE;
            elements = new MemoryElement[newSize];

            tempArray.CopyTo(elements, 0);
        }
Esempio n. 2
0
    public static MemoryElement GetMemoryDetailRoot(int filterDepth, float filterSize)
    {
        var windowDynamic = _GetWindow(ProfilerArea.Memory);

        if (windowDynamic == null)
        {
            return(null);
        }
        var listViewDynamic = new Dynamic(windowDynamic.PrivateInstanceField("m_MemoryListView"));
        var rootDynamic     = listViewDynamic.PrivateInstanceField("m_Root");

        return(rootDynamic != null?MemoryElement.Create(new Dynamic(rootDynamic), 0, filterDepth, filterSize) : null);
    }
Esempio n. 3
0
 public static void WriteMemoryDetail(StreamWriter writer, MemoryElement root)
 {
     if (null == root)
     {
         return;
     }
     writer.WriteLine(root.ToString());
     foreach (var memoryElement in root.children)
     {
         if (null != memoryElement)
         {
             WriteMemoryDetail(writer, memoryElement);
         }
     }
 }
 internal void CheckIfExistsInGame()
 {
     try
     {
         //bool retV = false;
         MemoryElement oldTargeted = new MemoryElement();
         Target();
         MemoryElement currentTargeted = new MemoryElement();
         if (currentTargeted.Label == Label)
         {
             //retV = true;
             SetAsSpawned();
         }
         oldTargeted.Target();
         //return retV;
     }
     catch (Exception)
     {
     }
 }
    private void ExtractMemory(float memSize, int memDepth)
    {
        var filterSize = memSize * 1024 * 1024;
        var parent     = Directory.GetParent(Application.dataPath);
        var outputPath = string.Format("{0}/MemoryDetailed{1:yyyy_MM_dd_HH_mm_ss}.txt", parent.FullName, DateTime.Now);

        File.Create(outputPath).Dispose();
        _memoryElementRoot = ProfilerWindow.GetMemoryDetailRoot(memDepth, filterSize);

        if (null != _memoryElementRoot)
        {
            var writer = new StreamWriter(outputPath);
            writer.WriteLine("Memory Size: >= {0}MB", _memorySize);
            writer.WriteLine("Memory Depth: {0}", _memoryDepth);
            writer.WriteLine("Current Target: {0}", ProfilerDriver.GetConnectionIdentifier(ProfilerDriver.connectedProfiler));
            writer.WriteLine("**********************");
            ProfilerWindow.WriteMemoryDetail(writer, _memoryElementRoot);
            writer.Flush();
            writer.Close();
        }

        Process.Start(outputPath);
    }
 /// <summary>
 /// 应用程序当前状态的快照
 /// </summary>
 void ExtractMemory(int depth, float size)
 {
     memoryElement = ProfilerWindow.GetMemoryDetail(depth, size * 1024 * 1024);
     PrintMemoryData();
 }