コード例 #1
0
    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);
    }