Esempio n. 1
0
                    public static void *malloc(long size)
                    {
                        var ptr = Marshal.AllocHGlobal((int)size);

                        MemoryStats.Allocated();
                        return(ptr.ToPointer());
                    }
        public HelperContainer()
        {
            m_UnityStatic = new UnityStatic();

            m_Clock      = new Clock();
            m_ClockProxy = new Clock.Proxy(m_Clock);
            m_Clock.Start();

            m_MemoryStats      = new MemoryStats();
            m_MemoryStatsProxy = new MemoryStats.Proxy(m_MemoryStats);
        }
Esempio n. 3
0
                    public static void free(void *a)
                    {
                        if (a == null)
                        {
                            return;
                        }
                        var ptr = new IntPtr(a);

                        Marshal.FreeHGlobal(ptr);
                        MemoryStats.Freed();
                    }
        /// <summary>
        /// 結果書き出し
        /// </summary>
        protected override string GetResultText()
        {
            CsvStringGenerator csvStringGenerator = new CsvStringGenerator();

            AppendHeaderToStringBuilder(csvStringGenerator);

            for (int i = 0; i < memoryStatsList.Count; ++i)
            {
                MemoryStats memoryStats = memoryStatsList[i];
                csvStringGenerator.AppendColumn(frameIdxList[i]);
                csvStringGenerator.AppendColumn("");
                // Used Memory
                csvStringGenerator.AppendColumn(memoryStats.bytesUsedTotal);
                csvStringGenerator.AppendColumn(memoryStats.bytesUsedUnity);
                csvStringGenerator.AppendColumn(memoryStats.bytesUsedMono);
                csvStringGenerator.AppendColumn(memoryStats.bytesUsedGFX);
                csvStringGenerator.AppendColumn(memoryStats.bytesUsedFMOD);
                csvStringGenerator.AppendColumn(memoryStats.bytesUsedVideo);
                csvStringGenerator.AppendColumn(memoryStats.bytesUsedProfiler);
                csvStringGenerator.AppendColumn("");

                // Reserved Memory
                csvStringGenerator.AppendColumn(memoryStats.bytesReservedTotal);
                csvStringGenerator.AppendColumn(memoryStats.bytesReservedUnity);
                csvStringGenerator.AppendColumn(memoryStats.bytesReservedMono);
                csvStringGenerator.AppendColumn(memoryStats.bytesReservedFMOD);
                csvStringGenerator.AppendColumn(memoryStats.bytesReservedVideo);
                csvStringGenerator.AppendColumn(memoryStats.bytesReservedProfiler);
                csvStringGenerator.AppendColumn("");

                // by Assets
                csvStringGenerator.AppendColumn(memoryStats.textureCount);
                csvStringGenerator.AppendColumn(memoryStats.textureBytes);
                csvStringGenerator.AppendColumn(memoryStats.meshCount);
                csvStringGenerator.AppendColumn(memoryStats.meshBytes);
                csvStringGenerator.AppendColumn(memoryStats.materialCount);
                csvStringGenerator.AppendColumn(memoryStats.materialBytes);
                csvStringGenerator.AppendColumn(memoryStats.audioCount);
                csvStringGenerator.AppendColumn(memoryStats.audioBytes);
                csvStringGenerator.AppendColumn(memoryStats.assetCount);
                csvStringGenerator.AppendColumn(memoryStats.gameObjectCount);
                csvStringGenerator.AppendColumn(memoryStats.sceneObjectCount);
                csvStringGenerator.AppendColumn(memoryStats.totalObjectsCount);
                csvStringGenerator.AppendColumn("");

                // GC
                csvStringGenerator.AppendColumn(memoryStats.frameGCAllocCount);
                csvStringGenerator.AppendColumn(memoryStats.frameGCAllocBytes);
                csvStringGenerator.NextRow();
            }

            return(csvStringGenerator.ToString());
        }
        /// <summary>
        /// 結果書き出し
        /// </summary>
        public void WriteResultFile(string path)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder(1024 * 1024);

            AppendHeaderToStringBuilder(sb);

            for (int i = 0; i < memoryStatsList.Count; ++i)
            {
                MemoryStats memoryStats = memoryStatsList[i];
                sb.Append(frameIdxList[i]).Append(",");
                sb.Append(",");
                // Used Memory
                sb.Append(memoryStats.bytesUsedTotal).Append(",");
                sb.Append(memoryStats.bytesUsedUnity).Append(",");
                sb.Append(memoryStats.bytesUsedMono).Append(",");
                sb.Append(memoryStats.bytesUsedGFX).Append(",");
                sb.Append(memoryStats.bytesUsedFMOD).Append(",");
                sb.Append(memoryStats.bytesUsedVideo).Append(",");
                sb.Append(memoryStats.bytesUsedProfiler).Append(",");
                sb.Append(",");

                // Reserved Memory
                sb.Append(memoryStats.bytesReservedTotal).Append(",");
                sb.Append(memoryStats.bytesReservedUnity).Append(",");
                sb.Append(memoryStats.bytesReservedMono).Append(",");
                sb.Append(memoryStats.bytesReservedFMOD).Append(",");
                sb.Append(memoryStats.bytesReservedVideo).Append(",");
                sb.Append(memoryStats.bytesReservedProfiler).Append(",");
                sb.Append(",");

                // by Assets
                sb.Append(memoryStats.textureCount).Append(",");
                sb.Append(memoryStats.textureBytes).Append(",");
                sb.Append(memoryStats.meshCount).Append(",");
                sb.Append(memoryStats.meshBytes).Append(",");
                sb.Append(memoryStats.materialCount).Append(",");
                sb.Append(memoryStats.materialBytes).Append(",");
                sb.Append(memoryStats.audioCount).Append(",");
                sb.Append(memoryStats.audioBytes).Append(",");
                sb.Append(memoryStats.assetCount).Append(",");
                sb.Append(memoryStats.gameObjectCount).Append(",");
                sb.Append(memoryStats.sceneObjectCount).Append(",");
                sb.Append(memoryStats.totalObjectsCount).Append(",");
                sb.Append(",");

                // GC
                sb.Append(memoryStats.frameGCAllocCount).Append(",");
                sb.Append(memoryStats.frameGCAllocBytes).Append(",");
                sb.Append("\n");
            }

            System.IO.File.WriteAllText(path, sb.ToString());
        }
Esempio n. 6
0
		public MemoryStats GetMemoryStats ()
		{
			MemoryStats stats;
			using (Process proc = Process.GetCurrentProcess ()) {
				stats = new MemoryStats {
					PrivateMemory = proc.PrivateMemorySize64,
					PeakVirtualMemory = proc.PeakVirtualMemorySize64,
					PagedSystemMemory = proc.PagedSystemMemorySize64,
					PagedMemory = proc.PagedMemorySize64,
					NonPagedSystemMemory = proc.NonpagedSystemMemorySize64
				};
				return stats;
			}
		}
Esempio n. 7
0
        public Tasker.Conclusion CheckRemoteStorageRequirements(Tasker tasker, Object syncObject = null)
        {
            // calculating size constraints
            tasker.SetStatus(Resources.CalculatingFreeSpace);
            MemoryStats.Refresh();
            if (stats.TotalSize > MemoryStats.AvailableForGames())
            {
                throw new OutOfMemoryException(string.Format(Resources.MemoryFull, Shared.SizeSuffix(stats.TotalSize)) + "\r\n" +
                                               string.Format(Resources.MemoryStats.Replace("|", "\r\n"),
                                                             MemoryStats.StorageTotal / 1024.0 / 1024.0,
                                                             MemoryStats.AvailableForGames() / 1024.0 / 1024.0,
                                                             MemoryStats.SaveStatesSize / 1024.0 / 1024.0,
                                                             (MemoryStats.StorageUsed - MemoryStats.AllGamesSize - MemoryStats.SaveStatesSize) / 1024.0 / 1024.0));
            }

            return(Tasker.Conclusion.Success);
        }
Esempio n. 8
0
        private void SetMemoryStats(IGrouping <string, KeyValuePair <string, string> > memorystats)
        {
            if (memorystats != null)
            {
                var memorystatsdict = memorystats.ToDictionary(x => x.Key, x => x.Value);

                MemoryStatistics = new MemoryStats
                {
                    UsedMemory            = memorystatsdict["used_memory"],
                    UsedMemoryHuman       = memorystatsdict["used_memory_human"],
                    UsedMemoryLua         = memorystatsdict["used_memory_lua"],
                    UsedMemoryPeak        = memorystatsdict["used_memory_peak"],
                    UsedMemoryPeakHuman   = memorystatsdict["used_memory_peak_human"],
                    UsedMemoryRss         = memorystatsdict["used_memory_rss"],
                    MemFragmentationRatio = memorystatsdict["mem_fragmentation_ratio"],
                    MemAllocator          = memorystatsdict["mem_allocator"]
                };
            }
        }
Esempio n. 9
0
        public Tasker.Conclusion FinishRemoteTransfer(Tasker tasker, Object syncObject = null)
        {
            try
            {
                if (hakchi.Shell.IsOnline)
                {
                    hakchi.Shell.ExecuteSimple("hakchi overmount_games; uistart", 2000, true);
                    MemoryStats.Refresh();
                }
            }
            catch { }
#if !VERY_DEBUG
            try
            {
                Directory.Delete(tempDirectory, true);
            }
            catch { }
#endif
            return(Tasker.Conclusion.Success);
        }
Esempio n. 10
0
		public MemoryStats GetMemoryStats ()
		{
			MemoryStats stats;
			using (Process proc = Process.GetCurrentProcess ()) {
				stats = new MemoryStats {
					PrivateMemory = proc.PrivateMemorySize64,
					PeakVirtualMemory = proc.PeakVirtualMemorySize64,
					PagedSystemMemory = proc.PagedSystemMemorySize64,
					PagedMemory = proc.PagedMemorySize64,
					NonPagedSystemMemory = proc.NonpagedSystemMemorySize64
				};
				return stats;
			}
		}