Ejemplo n.º 1
0
 public static void End()
 {
     ClientLogger.Error("end");
     ProfilerHelper._newStats = ProfilerHelper.Capture();
     ClientLogger.Error("old:" + ProfilerHelper._oldStats.ToString());
     ClientLogger.Error("new:" + ProfilerHelper._newStats.ToString());
     ClientLogger.Error("diff:" + (ProfilerHelper._newStats - ProfilerHelper._oldStats).ToString());
 }
Ejemplo n.º 2
0
 private static ProfilerHelper.Stats Capture()
 {
     ProfilerHelper.Stats stats = new ProfilerHelper.Stats
     {
         totalMemory   = GC.GetTotalMemory(false),
         monoHeapSize  = (long)((ulong)Profiler.GetMonoHeapSize()),
         monoUsedSize  = (long)((ulong)Profiler.GetMonoUsedSize()),
         allocatedSize = (long)((ulong)Profiler.GetTotalAllocatedMemory()),
         collection    = new int[GC.MaxGeneration + 1]
     };
     for (int i = 0; i <= GC.MaxGeneration; i++)
     {
         stats.collection[i] = GC.CollectionCount(i);
     }
     return(stats);
 }
Ejemplo n.º 3
0
 public static ProfilerHelper.Stats operator -(ProfilerHelper.Stats x, ProfilerHelper.Stats y)
 {
     ProfilerHelper.Stats stats = new ProfilerHelper.Stats
     {
         totalMemory   = x.totalMemory - y.totalMemory,
         monoHeapSize  = x.monoHeapSize - y.monoHeapSize,
         monoUsedSize  = x.monoUsedSize - y.monoUsedSize,
         allocatedSize = x.allocatedSize - y.allocatedSize,
         collection    = new int[x.collection.Length]
     };
     for (int i = 0; i < x.collection.Length; i++)
     {
         stats.collection[i] = x.collection[i] - y.collection[i];
     }
     return(stats);
 }
Ejemplo n.º 4
0
 public static void Begin()
 {
     ClientLogger.Error("begin");
     ProfilerHelper._oldStats = ProfilerHelper.Capture();
 }